[Xapian-discuss] Simulating Fields
Luis Alberto Zarrabeitia Gomez
kyrie at uh.cu
Mon May 4 05:26:43 BST 2009
Quoting Olly Betts <olly at survex.com>:
> On Sun, May 03, 2009 at 10:04:03PM -0400, Luis Alberto Zarrabeitia Gomez
> wrote:
> >
> > Quoting James Aylett <james-xapian at tartarus.org>:
> >
> > > You can use the QueryParser for this; set a term prefix before parsing
> > > the query, for instance.
> >
> > I tried to do this (qp is a QueryParser instance, with the same stemmer)
> >
> > ===
> > qp.set_stemming_strategy(xapian.QueryParser.STEM_SOME)
> > qp.add_boolean_prefix("realtitle",'XTITLE')
> > qp.add_prefix("title","XTITLE")
> > ===
>
> I'm not sure what you think "realtitle" is going to be useful for. It
> doesn't generally make sense to have the same term prefix generated by
> both boolean and probabilistic prefixes.
Neither do I :D. I was trying to experiment which kind of prefix would help
me... and as the probabilistic query wasn't working (see below), I tried a
boolean one.
> If you want a phrase, the syntax is double quotes:
>
> title:"Sex and the City"
>
> If you want to apply the prefix to all terms in a subexpression, use
> brackets:
>
> title:(Sex and the City)
>
> Note that the syntax supported by the QueryParser is described here:
>
> http://xapian.org/docs/queryparser.html
Ohhh. I didn't know that. I hadn't found that page. Thanks!.
Now, what would you recommend to match the document titled "sex and the city",
but not "sex and the city 2: the return"? Adding a value to the document and
then checking it for the documents in the result set?
> > Could you provide me an example?
>
> document.add_term("XTITLE" + page.title)
>
> I'm not sure I'd recommend this approach though - there's a limit of
> about 240 bytes on the length of terms.
Good to know!
Thanks.
--
Luis Zarrabeitia
Facultad de Matemática y Computación, UH
http://profesores.matcom.uh.cu/~kyrie
--
Participe en Universidad 2010, del 8 al 12 de febrero de 2010
La Habana, Cuba
http://www.universidad2010.cu
More information about the Xapian-discuss
mailing list