We're using Xapian 1.0.7. I have an algorithm to pre-read a query and find words that we want to stem differently than the standard stemming. These terms have a prefix of XZ in the index. However, when I prepend XZ on these terms and then use the QueryParser, they resulting query shows the XZ as lowercase, combined with my custom stem, and of course the term is not found. Some code (PHP): $xapStem=new XapianStem('english'); $xapQP=new XapianQueryParser(); $xapQP->set_database($this->xapDB); $xapQP->set_stemmer($xapStem); $xapQP->set_stemming_strategy(XapianQueryParser::STEM_SOME); $xapQP->set_default_op(XapianQuery::OP_AND); $iFlags=XapianQueryParser::FLAG_BOOLEAN | XapianQueryParser::FLAG_PHRASE | XapianQueryParser::FLAG_PURE_NOT; $xapQueryParsed=$xapQP->parse_query($strSearch,$iFlags); I have the query "IIS and sharp". IIS is a custom stem, so the query goes to the QueryParser as "XZiis and sharp". The QueryParser translates this into Xapian::Query((xziis:(pos=1) AND Zsharp:(pos=2))). But what I want is for that first term to look like XZiis. I'm not running any "add_prefix" commands before parsing the query. Is that necessary? In this case, I don't want the functionality where the user can put in their own prefix with a colon. Thanks for your input! Mike Boone. http://boonedocks.net/mike/
Mike Boone wrote:> I have the query "IIS and sharp". IIS is a custom stem, so the query > goes to the QueryParser as "XZiis and sharp". The QueryParser > translates this into Xapian::Query((xziis:(pos=1) AND > Zsharp:(pos=2))).Yes, as it ignores case and assumes you've just given it words (don't you have to have "and" in upper case, though? You said you had FLAG_BOOLEAN, not FLAG_BOOLEAN_ANY_CASE). > In this case, I don't want the functionality where the> user can put in their own prefix with a colon.Just don't tell them about it? :) Have something stupid, e.g.: add_prefix("wangleflooble", "XZ") and then convert "IIS and sharp" into "wangleflooble:IIS and sharp" before feeding to QueryParser. ATB, Matthew