lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mark harwood <markharw...@yahoo.co.uk>
Subject Re: combining Filter's & Query's to search
Date Tue, 09 Oct 2007 14:56:53 GMT
Note that as of Lucene 2.1 QueryParser was changed to use RangeFilters in place of RangeQuerys
by default.

You can simply subclass QueryParser to override construction of wildcardQuerys etc. These
methods are over-ridable to provide a hook for you to return a Query object of your choosing
(e.g. ConstantScoreQuery wrapping your choice of filter)

Cheers
Mark



----- Original Message ----
From: "Beard, Brian" <Brian.Beard@mybir.com>
To: java-user@lucene.apache.org
Sent: Tuesday, 9 October, 2007 3:22:27 PM
Subject: combining Filter's & Query's to search

I'm currently using rangeFilter's and queryWrapperFilter's to get
 around
the max boolean clause limit.

A couple of questions concerning this:

1) Is it good design practice to substitue every term containing a
wildcard with a queryWrapperFilter, and a rangeQuery with a
  RangeFilter
and ChainedFilter'ing these together (to avoid the possibility of a
maxBooleanClause limit being exceeded)? 

We have a searcher that stays open continuously, and reopens when we
have new updates (remains to be seen in deployment, but will probably
occur on approximately an hourly basis). So even though we're caching
the filters with the CachedWrapperFilter, any particular cached filter
may not get used that often and extraneous ones may be left around. The
index will eventually have up to 1/2 million+ records at 3-4K per
document ~1-2GB. We're also using multiple indexes with MultiSearcher
 to
be able to tailor how the updates are done. (Currently at 2 indexes for
two data sources). It's also a user requirement to be able to search on
leading wildcards.

2) The second part of this has to do with whether a mechanism like
QueryParser exists to help with constructing the filters above.
Currently, I'm using ChainedFilter to chain filters together. But this
works at just the top level. Is it possible from a nested boolean
expression to appropriately insert a FilteredQuery at the right spot.

So, for example, if the query were
name:joe OR (id:123 AND date:[20070101 TO 20071231])

    It would be possible to use something like 
    searcher.search(theQuery, rangeFilter)

    It would also be possible to use a FilteredQuery with id and a   
    RangeFilter first, and using a BooleanQuery with an OR. 

Is there any way in Lucene to automatically construct FilteredQuery's
when the search is done? I'm basically trying to be lazy and not
re-write something as complicated as QueryParser.parse if it already
exists. It would be great to use the power of QueryParser so that
rangeFilters were always used instead of a RangeQuery.





---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org






      ___________________________________________________________
Yahoo! Answers - Got a question? Someone out there knows the answer. Try it
now.
http://uk.answers.yahoo.com/ 

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message