[Xapian-discuss] Datefield problems. Indexing or configuration problems?

Arnoud ten Hoedt (Roönaän Webdevelopment) webmaster at roonaan.nl
Mon Sep 25 11:56:25 BST 2006


Hello,

We use omage/xapian with php, and are having troubles with our date-fields and our date-range searches.

Our scriptindex is formatted as follows:
    topicday  : boolean=DTD field=topicdate
    topicmonth: boolean=DTM
    topicyear : boolean=DTY
    replyday  : boolean=DRD field=replydate
    replymonth: boolean=DRM
    replyyear : boolean=DRY    
    topicdate : value=1
    topicdatei: value=2
    replydate : value=3
    replydatei: value=4

When we perform searches with date ranges limit, we get unexpected results:
Our first query on "omega" in year 2005, returns 9 results. 8 in january, 1 on 11/aug/2005
DB=forum 'P=omega' DEFAULTOP=AND B=XF1 B=XF2 B=DTY2005

However when we narrow the search to use the DTM field and focus on august, we get no results at all
DB=forum 'P=omega' DEFAULTOP=AND B=XF1 B=XF2 B=DTM200508

Narrowing further down, using the DTD fields, also doesn't yield any results
DB=forum 'P=omega' DEFAULTOP=AND B=XF1 B=XF2 B=DTD20050811

Doing a search on "surrounding" dates, doesn't help a bit:
DB=forum 'P=omega' DEFAULTOP=AND B=XF1 B=XF2 B=DTD20050810 B=DTD20050811 B=DTD20050812

Currently, I am quite lost as to where to start looking.
Is this a problem about having indexed our topics incorrectly. Or should I look for configuration problems in the scriptindex or other parts of our setup?

When indexing, we use the following php script for the date fields:
 $recordTxt.= 'topicday='  .date('Ymd',$topicData['time'])."\n";
 $recordTxt.= 'topicmonth='.date('Ym' ,$topicData['time'])."\n";
 $recordTxt.= 'topicyear=' .date('Y',  $topicData['time'])."\n";
 $recordTxt.= 'replyday='  .date('Ymd',$topicData['lastreply'])."\n";
 $recordTxt.= 'replymonth='.date('Ym', $topicData['lastreply'])."\n";
 $recordTxt.= 'replyyear=' .date('Y',  $topicData['lastreply'])."\n";
 $recordTxt.= 'topicdate=' .($topicData['time'])."\n";
 $recordTxt.= 'topicdatei='.($year2020-$topicData['time'])."\n";
 $recordTxt.= 'replydate=' .($topicData['lastreply'])."\n";
 $recordTxt.= 'replydatei='.($year2020-$topicData['lastreply'])."\n";

Any help appreciated,

-r-


More information about the Xapian-discuss mailing list