solr: find last/highest unique key & range search

CorgiGirl

New Member
i have an lucene index with an "uniqueKey"\[code\]<uniqueKey>ID</uniqueKey>\[/code\]As far as i know, this key have to be "text" (not int or long).\[code\]<field name="ID" type="string" indexed="true" stored="true"/>\[/code\]An small application used the lucene index in order to search only in those records, which are added since the last run of that application.To reach that goal, i'm trying the following.[*]Load the last ID (from flatfile)into the variable $oldID[*]get the current (last/highest) IDfrom Solr/lucene into the variable$currentID[*]execute an range search between$oldID and $currentID[*]Save the $currentID into a flat filefor next Search/for next runUnfortunately I notice a problem:A.) how to find the highest ID? or B.) how i handle the unique key as an digit, not text/charI tried something like that:\[code\]http://localhost:8080/solr/select/?defType=func&q=max(ID,0)&fq=ID:[$oldID+TO+$currentID]&fl=ID\[/code\]...which returns strange thinks: "999999" as the highest value. That's not correct, because the highest ID is 1043725. I think this is because ID is an Text-FieldC.) maybe there is any other way to search only at the last added recoreds?Thanks for any kind of help!
 
Top