lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ahmet Arslan <iori...@yahoo.com>
Subject Re: Slow Date-Range Queries
Date Thu, 29 Apr 2010 10:46:34 GMT

> I am currently having serious performance problems with
> date range queries. What I am doing, is validating a
> datasets published status by a valid_from and a valid_till
> date field.
> 
> I did get a performance boost of ~ 100% by switching from a
> normal solr.DateField to a solr.TrieDateField with
> precisionStep="8", however my query still takes about 1,3
> seconds.
> 
> My field defintion looks like this:
> 
> <fieldType name="date" class="solr.TrieDateField"
> precisionStep="8" sortMissingLast="true"
> omitNorms="true"/>
> 
> <field name="valid_from" type="date" indexed="true"
> stored="false" required="false" />
> <field name="valid_till" type="date" indexed="true"
> stored="false" required="false" />
> 
> 
> And the query looks like this:
> ((valid_from:[* TO 2010-04-29T10:34:12Z]) AND
> (valid_till:[2010-04-29T10:34:12Z TO *])) OR ((*:*
> -valid_from:[* TO *]) AND (*:* -valid_till:[* TO *])))
> 
> I use the empty checks for datasets which do not have a
> valid from/till range.
> 
> 
> Is there any way to get this any faster?

I can suggest you two things. 

1-) valid_till:[* TO *] and valid_from:[* TO *] type queries can be performance killer. You
can create a new boolean field ( populated via conditional copy or populated client side)
that holds the information whether valid_from exists or not. So that valid_till:[* TO *] can
be rewritten as valid_till_bool:true.

2-) If you are embedding these queries into q parameter, you can write your clauses into (filter
query) fq parameters so that they are cached. 


      

Mime
View raw message