You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by "Beard, Brian" <Br...@mybir.com> on 2007/10/09 16:22:27 UTC

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