[Xapian-discuss] value range in perl

Jim Spath jspath at pangeamedia.com
Fri Oct 26 19:08:42 BST 2007


Jim Spath wrote:
> I've been struggling trying to figure out now to do a value range search 
> in Perl.
> 
> My omega indexer_script file has the following line in it:
> 
> create_date : value=0 date=yyyymmdd
> 
> I've been able to sort on this value by doing the following:
> 
> $enq->set_sort_by_value_then_relevance(0);
> 
> But I'm getting stuck on the value range.  When I attempt to add 
> MM/DD/YYYY..MM/DD/YYYY to the query string, it doesn't seem to recognize 
> that I am trying to use a value range:
> 
> query string: test 10/26/2006..10/26/2007
> 
> Xapian::Query((Ztest:(pos=1) AND (10:(pos=2) PHRASE 6 26:(pos=3) PHRASE 
> 6 2006:(pos=4) PHRASE 6 10:(pos=5) PHRASE 6 26:(pos=6) PHRASE 6 
> 2007:(pos=7))))
> 
> FYI, we are using 1.0.0.0 ... do I simply need to upgrade, or am I doing 
> something else wrong?
> 
> Thanks!
> - Jim

I think I figured out the problem after much digging and searching:

$qp->add_valuerangeprocessor(new 
Search::Xapian::DateValueRangeProcessor(0));

I do have a followup question...

In our search application, the Search::Xapian::QueryParser object is 
persistent.  Is there any kind of negative effect of having a value 
range processor set in the parser object when it isn't actually needed?

Most of our search requests will not be utilizing the date range option, 
so I'm somewhat concerned about using an option that isn't necessary 
most of the time.

- Jim



More information about the Xapian-discuss mailing list