[opencms-dev] How to restrict the search

Ernesto De Santis opencms at colaborativa.net
Tue Feb 21 18:11:57 CET 2006


Why don't work your code?
What do your code?

The CmsSearch don't have a parameter to filter a query. I think that it 
is necessary in futures releases.


Option 1:

Index the property "includeInSearch" as Keyword, for it you need code a 
new DocumentFactory.
In search time, do a BooleanQuery as this:

Query userQuery = QueryParser.parse(user query);
Query filterQuery = new TermQuery(new Term("includeInSearch", "true"));
Query query = new BooleanQuery();
query.add(userQuery, true, false);
query.add(filterQuery, true, false);

searcher.search(query);

negative point: filterQuery put noise in the score value

Option 2:

In search time, read the property from vfs for each hit and check the 
value. Then, show the hit or not.

negative point: pagination more hard, cant of results not real, etc.

Bye,
Ernesto.

Thierry Collogne escribió:
> Hi all,
> 
> I am using opencms 6.0.4. I have implemented search functionality in my 
> website. The problem is that I would like to restrict the search.
> 
> I have created a new property "includeInSearch". If this is true, than 
> the page is shown in te results, otherwise the page is not shown.
> 
> But when I want to display the search results, this doesn't work.
> Is there a way to restrict the search, instead of filtering the results, 
> like I do?
> 
> Thank you,
> 
> Thierry
> 
> 
> 
> _______________________________________________
> This mail is sent to you from the opencms-dev mailing list
> To change your list options, or to unsubscribe from the list, please visit
> http://lists.opencms.org/mailman/listinfo/opencms-dev
> 
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: opencms.vcf
Type: text/x-vcard
Size: 263 bytes
Desc: not available
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20060221/57325fbd/attachment.vcf>


More information about the opencms-dev mailing list