[opencms-dev] Search index for picture description in photoalbum

Florian Hopf hopf at synyx.de
Thu May 12 13:14:33 CEST 2011


Hi,

Am 12.05.2011 11:17, schrieb Yves Glodt:
> is it possible to create a search which will only search in the
> description text of of a picture?
> 
> Background: On a site I would like to add some tags into the description
> field of the pictures in a photoalbum.
> 
> Then I would like to create a search field wher people can search for
> tags, and get the pictures which have the tag assigned.
> 

This should be possible and even quite easy. CmsSearch provides a method
to only search on certain fields and for a certain resource type. It
should work like this:

CmsSearch search = ...;
search.addFieldQueryMust(CmsSearchField.FIELD_DESCRIPTION, searchQuery);
search.setResourceType(CmsResourceTypeImage.getStaticTypeName());

Then the result will only contain images that contain the searchQuery in
the description.

Regards
Florian



More information about the opencms-dev mailing list