Hi Mike,

> 
> All records have a "tag" field containing the word "tag", that's why I'm 
> searching for tag:tag (to find all records and then apply filters).
> 
> Is there a better way to do this? Because that way, it's so slow that we 
> can't consider using that system in production.
> 

Searches for a term matching all documents is almost always the worst
solution. In your case, it leads to first retrieving all documents,
and checking if they match the filter one-by-one. A more efficient
approach (and one I'm using successfully myself) is to run a
BooleanQuery to match the two index fields PK and TYPE, and taking out
tag:tag from the query altogether. This way, the indexing on the two
terms will be used, so no CPU cycles at all will be used for documents
matching neither PK nor TYPE.

Best regards,

Isidor

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
CLucene-developers mailing list
CLucene-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/clucene-developers

Reply via email to