How challenging would it be to add something to QueryParser to allow you to specify that you want to use filters?
I have a similiar case where I do a search for term1 AND term2 AND links:http???www?url?com?dir* If lucene would use order of operations or in some way do the first two searches first, it would reduce the amount of work it has to do by 95%. Right now it looks like it's doing a full scan of my whole index (8 GB) because of the wildcards that I have in the search. By filtering on teh first two terms things would be SO much faster.. don't know if this is possible due to lucene's data structure however.. -----Original Message----- From: Erik Hatcher [mailto:[EMAIL PROTECTED] Sent: Thursday, November 13, 2003 1:16 PM To: Lucene Users List Subject: Re: Query Filters on term A in query "A AND (B OR C OR D)" On Thursday, November 13, 2003, at 04:07 PM, Jie Yang wrote: > Erik, Just to make sure I understand you right, In an > example query: ZipCode:CA10927 AND Gender:Male Are we talking about that query being entered by the user and you handing it just like that to QueryParser? If so, then QueryFilter won't help. > Sure I know ZipCode returns fewer results, do you mean > I build a filter > > QueryFilter x = new QueryFilter("ZipCode", "CA10927", > ..); Well, that is not quite the right API, but something like this: Query maleQuery = new TermQuery(new Term("Gender", "Male")); Filter filter = new QueryFilter(maleQuery); Hits hits = searcher.search(new TermQuery("ZipCode","CA10927"), filter); Keep in mind all that Doug has said on this topic as well. In this case, it probably won't be any faster than a single query, maybe even slower. But if you use the same instance of the filter for future searches there will certainly be a benefit. Erik --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
