Lingjuan Peng | 20 Nov 14:53
Picon

help me please! Date range search support problem

dear all:
        hi! i am new user of Xapian. now i want to suuport search with date
range. something like  i want to search the pages of time span
"20090901...20090928" when i input 20090901 and 20090928 in the main search
web. but now i am so confused of the code.could you please give me some
help? and thank you very much!
and my code is as follows:
            qp.set_default_op(Xapian::
Query::OP_AND);
            Xapian::Query query =
qp.parse_query(StrQUERY_STRING);//StrQUERY_STRING is the key query terms.
            Xapian::Query range =
Xapian::Query(Xapian::Query::OP_VALUE_RANGE, 0, StrTimeBegin,
StrTimeEnd);//StrTimeBegin and StrTimeEnd are the time span i input in
            enquire.set_query(query);
....

and when i run the program,the output is " parsed query is :
Xapian::Query((usa:(pos=1) FILTER VALUE_RANGE 0  ))"
that means the begin time and end time didn't transfer to the program.please
tell me how to do ? thank you very much!
best wishes!

caddie
Olly Betts | 21 Nov 13:10
Favicon
Gravatar

Re: help me please! Date range search support problem


On Fri, Nov 20, 2009 at 09:53:17PM +0800, Lingjuan Peng wrote: > and when i run the program,the output is " parsed query is : > Xapian::Query((usa:(pos=1) FILTER VALUE_RANGE 0 ))" > that means the begin time and end time didn't transfer to the program.please > tell me how to do ? thank you very much!
My guess is that the start and end of the range are encoded as strings of non-printing characters. Try piping the output through "cat -vet" to show them if they are. If not, please post more complete code - ideally something I can run myself and get the same output as you do. Cheers, Olly

Gmane