[Xapian-discuss] Search for exact match on document

Jorge Cardoso Leitão jorgecarleitao at gmail.com
Sat May 17 15:25:06 BST 2014


Hi.

I'm using Xapian, and I'm having some difficulty doing the following:

I have db with a field "name":
1 with name="foo"
2 with name="foo bar"
3 with name="foo bar for you u2".

I index this in the database using a prefix FNAME indicating the field
where the strings belong to.
delve -a returns something like

FNAMEfoo FNAMEbar ...

My question is: how can I can query by name the entry 2 without matching
entry 1 nor 3?

I tried using Query((FNAMEfoo PHRASE 2 FNAMEbar)) but this is returning me
two entries (naturally).

I know that, for obtaining the entry 1 alone, I can query Query('"XNAME8"')
(i.e. using the name between "'s), but
for the entry 2 I'm not being able to construct the query. I'm using python
Xapian bindings.

More generally, the question can be posed on the following terms: how can I
query exact matches to fields?

Thank you very much,
Jorge


More information about the Xapian-discuss mailing list