[Xapian-discuss] 答复: Does Xapian support value in [value1, value2, value3...]?

Bruce Zhang bruce.zhang at trustgo.com
Thu Jul 28 06:11:43 BST 2011


I am still new to Xapian, and didn't make this successfully,

 

for example, my data are:

document 1

  name=xxxx,xxx

  desc=...

  country=us, fr

 

document 2:

  name=...

  desc=...

  country=jp,cn

 

I want to be able to search by country, like query document by us or jp or cn

 

I use scriptindex to build indexing database. then how should I wrote my index scripts?

  country : ???

 

I use omega to query, then how should I create command line?

./omega DB=default B=XCOUNTRY???

 

thanks lot for help,

 

Bruce

 

 

发件人: Matt Goodall [mailto:matt.goodall at gmail.com] 
发送时间: Wednesday, July 27, 2011 9:43 PM
收件人: Bruce Zhang
主题: Re: [Xapian-discuss] Does Xapian support value in [value1, value2, value3...]?

 

On 27 July 2011 14:08, Bruce Zhang <bruce.zhang at trustgo.com> wrote:

Hi guys,

I wonder if Xapian support the operations like value in [value1, value2,
value3...]?

from Xapian document, for query, the supported operations are index,
boolean...
but we have requirements to query see if a value is in a list of values.

it is already supported or we need to add ourselves?

 

You can achieve this by adding an exact (unstemmed, etc) term for each value and then querying for any one of the values in the usual way.

 

For example. if you have a document that has some general, indexable content and a list of tags, ["foo", "bar"], you could add "Xtag:foo" and "Xtag:bar" terms for the tags. Then, configure a QueryParser with a "tag"->"Xtag:" prefix and you can search for "tag:foo", "tag:bar", "tag:foo AND tag:bar", etc.

 

- Matt



More information about the Xapian-discuss mailing list