cancel
Showing results for 
Search instead for 
Did you mean: 

How to have properties contribute to the node's TEXT index?

hbf
Champ on-the-rise
Champ on-the-rise
Dear list,

How can I achieve that a property's value is indexed in such a way that a Lucene TEXT query finds it?

More precisely: I have a custom model, for instance like this:

  <type name="my:node">
   <title>My node</title>
   <parent>cm:content</parent>
   <properties>
    <property name="my:prop">
     <type>d:text</type>
    </property>
   </properties>
  </type>

I understand that I can use a Lucene search @my\Smiley Tonguerop:"blabla" to find all nodes whose property "mySmiley Tonguerop" contains blabla.
How can I make Alfresco index the content of property "mySmiley Tonguerop" so that a Lucene search TEXT:"blabla" also finds these nodes?
That is, I want the value of "mySmiley Tonguerop" to be contributed to the TEXT index.

Many thanks,
Kaspar
6 REPLIES 6

benswitzer
Champ in-the-making
Champ in-the-making
I too would like to know how this is done, if its even possible.

I've been able to create custom models and extend the web client through the advanced search, but no idea how to do that for the 'simple search'.

loftux
Star Contributor
Star Contributor
It is possible to add custom properties to simple search, see
http://wiki.alfresco.com/wiki/Web_Client_Customisation_FAQ#Adding_Properties_to_Simple_Search

benswitzer
Champ in-the-making
Champ in-the-making
Thanks Loftux.  Works like a charm.  What I didn't realize was that I had to change the URI (duh).

Here is an example of what I did:

mymodel.xml

<namespaces>
   <namespace uri="http://www.mycontent.com/model/content/1.0" prefix="mycontent"/>
</namespaces>

<type name="mycontent:customType">
   <title>My node</title>
   <parent>cm:content</parent>
   <properties>
      <property name="mycontent:customProperty">
         <type>d:text</type>
      </property>
   </properties>
</type>

web-client-config-custom.xml

<config>
   <client>
      <simple-search-additional-attributes>
         <qname>{http://www.mycontent.com/model/content/1.0}customProperty</qname>
      </simple-search-additional-attributes>
   </client>
</config>

I have found it to work with both custom types and aspects.

Thanks a bunch!

Ben

hbf
Champ on-the-rise
Champ on-the-rise
It is possible to add custom properties to simple search, see
http://wiki.alfresco.com/wiki/Web_Client_Customisation_FAQ#Adding_Properties_to_Simple_Search

This is definitely one way to solve the issue: search not just in TEXT but in all other proberties.

I would be interested in a solution that indexes my properties to TEXT. Is it possible?

The reason I ask is that our custom models have many, many properties, so using the former approach results in huge Lucene queries: TEXT:"blabla" OR @my\Smiley Tonguerop1:"blabla" or @my\Smiley Tonguerop2:"blabla" OR …

Thanks,
Kaspar

t_broyer
Champ in-the-making
Champ in-the-making
Workaround: you could provide your own content transformers to prepend or append the property values when transforming to text/plain.

If I were you, I'd first ask the Lucene guys if it is at all possible, and then try to find a way to "plug" it in Alfresco.

andy
Champ on-the-rise
Champ on-the-rise
Hi

TEXT is not a real field ionr he index. It is expanded at query time. By default it maps to d:content -> all properties of type content.
You can define what TEXT (and ALL) means on SearchParameters objects. You can add other fields.
There is no easy way to change the default - before you ask.

Andy