lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Khash Sajadi <kh...@sajadi.co.uk>
Subject Re: Using filters to speed up queries
Date Sat, 23 Oct 2010 22:52:10 GMT
On the topic of BooleanQuery. Would the order of the queries being added
matter? Is it clever enough to skip the second query when the first one is
returning nothing and is a MUST?

On 23 October 2010 23:47, Khash Sajadi <khash@sajadi.co.uk> wrote:

> Thanks. Will try it. Been thinking about separate indexes but have one
> worry: memory and file handle issues.
>
> I'm worried that in scenarios I might end up with thousands of
> IndexReaders/IndexWriters open in the process (it is Windows). How is that
> going to play out with memory?
>
>
> On 23 October 2010 23:44, Mark Harwood <markharw00d@yahoo.co.uk> wrote:
>
>> Look at BooleanQuery with 2 "must" clauses - one for the query, one for a
>> ConstantScoreQuery wrapping the filter.
>> BooleanQuery should then use automatically use skips when reading matching
>> docs from the main query and skip to the next docs identified by the filter.
>> Give it a try, otherwise you may be looking at using separate indexes
>>
>>
>> On 23 Oct 2010, at 23:18, Khash Sajadi wrote:
>>
>> > My index contains documents for different users. Each document has the
>> user id as a field on it.
>> >
>> > There are about 500 different users with 3 million documents.
>> >
>> > Currently I'm calling Search with the query (parsed from user) and
>> FieldCacheTermsFilter for the user id.
>> >
>> > It works but the performance is not great.
>> >
>> > Ideally, I would like to perform the search only on the documents that
>> are relevant, this should make it much faster. However, it seems
>> Search(Query, Filter) runs the query first and then applies the filter.
>> >
>> > Is there a way to improve this? (i.e. run the query only on a subset of
>> documents)
>> >
>> > Thanks
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
>> For additional commands, e-mail: dev-help@lucene.apache.org
>>
>>
>

Mime
View raw message