[Xapian-discuss] Stopper Problems

Colin Bell colinabell at gmail.com
Wed Mar 7 16:08:57 GMT 2007


Hi All

Thanks to everyone for a great bit of software. I have made good  
progress with it and I am currently just getting over some of the  
last hurdles.

I have made a stopper which I use for indexing (and retrieval) which  
doesn't seem to stop much. (I've pasted a trimmed example Below) .  
Loads of the words in the stopper keep coming through.

I use it as follows:

	QueryParser qp;
	qp.set_stemmer(Xapian::Stem("english"));
	qp.set_stemming_strategy(Xapian::QueryParser::STEM_ALL);
     qp.set_stopper(new MyStopper());
     qp.set_default_op(Xapian::Query::OP_AND);
	Xapian::Query query = qp.parse_query(text);


Can anyone see what I might be doing wrong. ?

Many thanks

class MyStopper : public Xapian::Stopper {
   public:
     bool operator()(const string &t) const {
	switch (t[0]) {
	    case 'b':
	    return (t == "b" || t == "bad" || t == "be" || t == "became" ||  
t == "because" || t == "become" || t == "becomes" || t == "becoming"  
|| t == "been" || t == "before" || t == "began" || t == "behind" || t  
== "below" || t == "beside" || t == "besides" || t == "best" || t ==  
"better" || t == "between" || t == "big" || t == "bigg" || t ==  
"bigger" || t == "biggest" || t == "both" || t == "bring" || t ==  
"bringing" || t == "brings" || t == "brought" || t == "but" || t ==  
"by");
	    case '1':
	    return (t == "1" || t == "10th" || t == "11th" || t == "12th" ||  
t == "13th" || t == "14th" || t == "15th" || t == "16th" || t ==  
"17th" || t == "18th" || t == "19th" || t == "1st");
	    case '2':
	    return (t == "2" || t == "20th" || t == "21st" || t == "22nd" ||  
t == "23rd" || t == "24th" || t == "25th" || t == "26th" || t ==  
"27th" || t == "28th" || t == "29th" || t == "2nd");
	    case '3':
	    return (t == "3" || t == "30th" || t == "31st" || t == "3rd");
	    case '4':
	    return (t == "4" || t == "4th");
		default:
		return false;
		}
     }
};



More information about the Xapian-discuss mailing list