I am doing a query and want to sort all the matched data by one of the
fields (date).
Whats the best way of doing this ?
The search will potentially match a lot of rows - so for performance I've
subclassed HitCollector and am adding all the returned documentIDs to a
list of integers if that makes any difference :
reader = IndexReader::open(...);
q = QueryParser::parse(...);
s = new IndexSearcher(reader);
s->_search(q, NULL, &hc);
class myHitCollector : public HitCollector {
private :
list<int32_t> hitList;
public:
int hitListCount;
myHitCollector() : HitCollector() {
clear();
hitListCount=0;
}
void clear() {
hitList.clear();
}
void push(int32_t doc) {
hitList.push_back(doc);
hitListCount++;
}
int pop() {
int32_t doc=hitList.front();
hitList.pop_front();
hitListCount--;
return doc;
}
void collect(const int32_t doc, const float_t score) {
push(doc);
}
};
again - is this the best way ?
Any help much appreciated!
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
CLucene-developers mailing list
CLucene-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/clucene-developers