lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Beard, Brian" <Brian.Be...@mybir.com>
Subject RE: combining Filter's & Query's to search
Date Tue, 09 Oct 2007 15:35:59 GMT
WooHoo! That's good news.

Now I seee the ConstantScoreRangeQuery in QueryParser.getRangeQuery.
So all I have to do is over-ride QueryParser.getWildcardQuery.

-----Original Message-----
From: mark harwood [mailto:markharw00d@yahoo.co.uk] 
Sent: Tuesday, October 09, 2007 10:57 AM
To: java-user@lucene.apache.org
Subject: Re: combining Filter's & Query's to search

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




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