Got Isidor's answer as I was writing my own, and that's exactly what I was
writing. Usually you'll be using Filters on an already filtered results set
(after a first query which doesn't match all has been executed), and will be
using them to apply a more complex approach for filtering result, which you
couldn't have done otherwise (at least with ease).

BTW, you also should be looking into dropping the use of QueryParser unless
you're expecting a text query directly from the user. Building the query
using the Query derived classes would be way faster if your format isn't too
complex.

Itamar.

-----Original Message-----
From: Isidor Zeuner [mailto:cluc...@quidecco.de] 
Sent: Monday, September 14, 2009 7:40 PM
To: clucene-developers@lists.sourceforge.net
Subject: Re: [CLucene-dev] Finding a specific document in the index

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




------------------------------------------------------------------------------
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