Here’s what I intend to do:
doc = xapian.Document()
doc.set_data(somedata)
..
..
doc.add_term("Ajohn doe")
Assume the prefix “author” is available for document author.
Now I want to be able to run this search “searchterm AND author:john doe“
This is obviously not working because “doe” is being considered part of the author (the QueryParser is translating it to “searchterm AND author:john OR doe”). Should I do this:
doc.add-term("Ajohn_doe")
and search by “searchterm AND author:john_doe“? Are there any alternatives for searching text with spaces in general?
The most common way of doing this would be to add terms
AjohnandAdoe(probably using Xapian’sTermGenerator, which will do word splitting and term creation for you). Having done this, you can then run a searchauthor:"john doe"(a prefixed phrase search, which will be able to search across multiple terms). Something like the following:(Tested against a semi-recent Xapian trunk, although I don’t believe anything is particularly new here.)