[Xapian-discuss] queries on numerical fields not working

gervin23 gervin23 at fastmail.fm
Mon Sep 27 10:16:23 BST 2004


i have docs full of fielded information. each doc as 7 fields applied. 
searching these fields is working perfectly on terms that are pure 
letters but doesn't work on terms that are pure digits (haven't tested 
combination). the way i've indexed these fields is 'F' field_name + ':' 
+ field_value. so for the 'year' field, i would have something like 
'Fyear:2004', for month 'Fmonth:june', etc... i'm using set_prefix() on 
each field so things are sent to queryparser correctly. i'm also issuing 
query.get_description() and here's the interesting info:
---
'Xapian::Query(Fmonth:june:(pos=1))' returns hits
'Xapian::Query(Fyear::2004:(pos=1))' returns no hits
---

notice the extra ':' before the '2004'. i'm generating these terms using 
iterations so i'm not introducing any typos that i know of. printing 
these terms to output just before sending them to queryparser doesn't 
show any inconsistencies either.

here's the portion of my script which calls set_prefix:
for k in field_shelf.keys():
   queryparser.set_prefix(k, k + ':')
interestingly, changing "k + ':'" to just "k" reverses the effect fixing 
the issue for numeric terms but kills it for lettered terms.

delve on the record that should be getting a hit shows the following:
---
Term List for record #5: 1 19 1963 2002 2003 30 45174 45543 45585 
Fcountry:kenya Ffd-firstchildcontent:kenya Fmonth:june Fregion:africa 
Fregion:saharan Fregion:sub Fsubject:changes Fsubject:government 
Fvolume:50 Fyear:2004 abdi address administration
---

fyi, this is using the python binding v0.8.2.

any ideas?

thanks,
andrew



More information about the Xapian-discuss mailing list