[Xapian-discuss] Stemming question`

Matthew Somerville matthew at mysociety.org
Sat Feb 23 00:39:50 GMT 2008


Jim wrote:
> The next question is, once I have found a document that has been stemmed 
> and I hit on a stem, can I generate the terms that were stemmed?

There is QueryParser->unstem_begin() which returns the term or terms in the 
query parsed that matches the stemmed term provided. You can see my usage of 
that function in: 
https://secure.mysociety.org/cvstrac/fileview?f=mysociety/twfy/www/includes/easyparliament/searchengine.php
where the comment says "Replace stemmed things with their unstemmed terms".

 > I'm working on a highlighting demo for the wiki and want to be able to
 > highlight words in the document that match the unstemmed forms of the
 > terms I'm getting back.

So I only use it for reconstructing a pretty description of the query, as if 
someone searches for "carers" I need to highlight both "carer" and "carers" 
given only "Zcarer" (from the parsed query) and "carers" (from the original 
query); to highlight stemmed words I go through the words of the results, 
stem them all and compare with the stemmed terms to see if they should be 
highlighted.

ATB,
Matthew




More information about the Xapian-discuss mailing list