[Xapian-discuss] Re: Query / Database question
Ross Lawley
ross.lawley at gmail.com
Tue Feb 27 17:28:21 GMT 2007
Hi Olly,
Thanks for your help - its good to be able to debug it a little - I've found
my bug!
My content.index was at fault:
<code>
type: field=type_id boolean=XTYPE
</code>
<code>
type_id: field=type_id boolean=XTYPE
</code>
So I wasn't relating the field correctly, as I think I thought it would be
an alias, but its great that its working now!
Thanks again,
Ross
On 2/27/07, Olly Betts <olly at survex.com> wrote:
>
> On Tue, Feb 27, 2007 at 11:29:13AM +0000, Ross Lawley wrote:
> > $xapian_stemmer = new XapianStem("english");
> > $xapian_query_parser = new XapianQueryParser;
> > $xapian_query_parser->set_stemmer($xapian_stemmer);
> > $xapian_query_parser->set_stemming_strategy (0);
>
> It's better to use the named constants here - the underlying values are
> an implementation detail, and it's not impossible that they could
> change.
>
> Currently 0 means "STEM_NONE", which it probably not what you want since
> you're also setting a stemming language.
>
> > However, with that query I never return any results - yet I know there
> are
> > items indexed with the XTYPE value of 11.
>
> I suspect that the terms being added don't match those that the
> queryparser is generating a query for.
>
> You can see if XTYPE11 is in the document using delve:
>
> delve /path/to/database -t XTYPE11.
>
> By default delve currently stems terms with the english stemmer, so
> appending a "." prevents this. This is really a misfeature that ought
> to be fixed.
>
> If it isn't, look at a document to find out the terms which are there:
>
> delve /path/to/database -r 1
>
> If that's OK, look at the query you're getting from the QueryParser:
>
> echo $xapian_query->get_description();
>
> > Also, I'm looping the search terms and expanding them so that a search
> for
> > "zulu" would become "title:zulu OR description:zulu" Should I be doing
> > that, searching for just "zulu" doesn't return any results.
>
> I would usually just index the terms both with their prefix and without
> one:
>
> title: index=S index
> description: index=XDESC index
>
> > Also on a side note is there any way to add more weighting to results
> that
> > match the title over the description?
>
> You can either increase the wdf of terms from the title at index time
> using "weight=N" for some integer N > 1, for example:
>
> title: weight=3 index=S index
>
> Or you can set the within query frequency (wqf) at query time, but
> that's not currently possible using the QueryParser class.
>
> Cheers,
> Olly
>
More information about the Xapian-discuss
mailing list