[Xapian-discuss] Stemming and field prefixes

Mark Blythe list at markblythe.com
Wed Mar 28 04:27:10 BST 2007


Sure, here's a sample Perl script:

use strict;
use Search::Xapian qw(:standard);

my $stem = new Search::Xapian::Stem('english');
my $qp = new Search::Xapian::QueryParser();

$qp->set_stemmer($stem);
$qp->set_stemming_strategy(STEM_ALL);
$qp->add_boolean_prefix('interest', 'I');

my $q = $qp->parse_query('limited interest:limited');
print $q->get_description(), "\n";

When I run this, I get:

Xapian::Query((limit:(pos=1) FILTER Ilimited))

So, it stems "limited" as a regular query term, but not when prefixed.

On 3/27/07, Olly Betts <olly at survex.com> wrote:
>
> On Mon, Mar 26, 2007 at 10:18:56PM -0700, Mark Blythe wrote:
> > Is there a reason that QueryParser does not stem any field-prefixed
> terms
> > (like title:singing) even with the stemming strategy to STEM_ALL?
>
> It does for me.  I used:
>
>     qp.add_prefix("title", "XT");
>
> And query.get_description() gave:
>
>     Xapian::Query(XTsing:(pos=1))
>
> Can you post a sample which demonstrates your problem?
>
> Cheers,
>     Olly
>


More information about the Xapian-discuss mailing list