[opencms-dev] Search on name of resources in OpenCms 8.x

Luc Feys lfeys at reference.be
Wed May 9 22:30:40 CEST 2012


Hello,

I am using OpenCms 8.0.3 and I am trying to define a search index to find resources in the workplace based on their filename. I have defined the following indexes, sources, field definitions:

<index>
            <name>Dictionairies</name>
            <rebuild>auto</rebuild>
            <project>Offline</project>
            <locale>all</locale>
            <configuration>dictionairies_field_config</configuration>
            <sources>
                        <source>dictionairies_source</source>
            </sources>
            <param name="org.opencms.search.CmsSearchIndex.checkTimeRange">false</param>
</index>

<indexsource>
            <name>dictionairies_source</name>
            <indexer class="org.opencms.search.CmsVfsIndexer"/>
            <resources>
                        <resource>/sites/lifecapsule/configuration/Dictionary/</resource>
            </resources>
            <documenttypes-indexed>
                        <name>xmlcontent</name>
                        <name>xmlpage</name>
            </documenttypes-indexed>
</indexsource>

<fieldconfiguration>
            <name>dictionairies_field_config</name>
            <fields>
                        <field name="res_name" display="Name" store="true" index="untokenized" excerpt="true">
                                   <mapping type="attribute">name</mapping>
                        </field>
                        <field name="content" display="Content" store="true" index="true" excerpt="true">
                                   <mapping type="content"/>
                        </field>
            </fields>
</fieldconfiguration>

Based on a look I had in the code/javadoc of the following classes, I would expect this to work.
*) org.opencms.search.fields.CmsSearchFieldMapping.java indicates the CmsResourceAttribute enum is used to match the mapping param
*) org.opencms.file.I_CmsResource.CmsResourceAttribute contains a 'name' attribute that corresponds to the filename (without parent path)

When I have a look at my lucene index using Luke, I see that the 'res_name' field has been indexed. If I execute a search in Luke, I get the expected results.

But searching on it in the OpenCms workplace does not result in any hits. I do select the correct index, and check the 'Name' checkbox to make sure the name field is used in the search.

Any ideas on what I might be doing wrong?

Kind regards,

Luc Feys

[Description: REFlogo]<http://www.reference.be/>

Team Leader Java






The Reference NV
Stapelplein 70 bus 201
9000 Gent, Belgium
www.reference.be<http://www.reference.be>
www.facebook.com/agencyTheReference<http://www.facebook.com/agencyTheReference>






Phone:

+32 9 269 12 84

Fax:

+32 9 234 05 37

Mobile:

+32 495 90 54 33

Twitter:

@TheReference<http://www.twitter.com/TheReference>








[Description: http://customers.reference.be/reference/mailImages/training_20120524.jpg]<http://www.reference.be/nl/over-ons/evenementen/professionele-strategieen-link-building/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20120509/465739a4/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.gif
Type: image/gif
Size: 1056 bytes
Desc: image001.gif
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20120509/465739a4/attachment.gif>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image003.jpg
Type: image/jpeg
Size: 997 bytes
Desc: image003.jpg
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20120509/465739a4/attachment.jpg>


More information about the opencms-dev mailing list