[Xapian-discuss] Problem with stemming and prefixes.

Ivan Sutter ivansutter at gmail.com
Thu Oct 9 11:48:42 BST 2008


Hi there,

I am encountering problems with stemming and prefixes.
I want to filter my queries with prefixes using add_term and add_prefix (as
I've seen it's the best solution).

So, here is the situation : my database contains movie titles, movie
categories and production years.
I do not filter the titles, but I filter the categories and the years, using
:
$doc->add_term("XYEAR".mysql_result(/* request to the year's field */));
$doc->add_term("XCAT".strtolower(mysql_result(/* request to the category's
field */)));
Note that the strtolower() is not the source of the problem and it is
mandatory.

Then, I set the add_term (I stop with the "year" case because it works) :
$queryparser->add_prefix("cat", "XCAT");

Then I call my request through Firefox :
http://coolurl/search.php?myssearch=cat:Thriller

That works. It returns all the thriller movies.

But this :
http://coolurl/search.php?myssearch=cat:thriller
Do not work.

Indeed, a "print $query->get_description();" tells me that the queries are
respectively :
Xapian::Query(XCATthriller:(pos=1))
Xapian::Query(ZXCATthrill:(pos=1))

And the STEM_SOME flag is activated and of course I need it for standard
queries...
As I know, stemming works only with words that do not begin with capital
letter, so here it's the case.

Finally, I know why I do not get the results I want, but I don't know how to
fix it !
I've read a thread with someone who had problems with custom stems but here
it's not the case !

So, if someone have an idea ! Thanks in advance.

Ivan Sutter


More information about the Xapian-discuss mailing list