0

Using C++, I've managed to follow the Xapian tutorial found here.

https://getting-started-with-xapian.readthedocs.io/en/latest/practical_example/index.html#

The indexer program works as I expect it to, but the search program - https://getting-started-with-xapian.readthedocs.io/en/latest/practical_example/searching/building.html - works only with a caveat.

When, for example, I run the equivalent of:

python2 code/python/search1.py db Dent watch

No matches are found, unless I instead write the following:

python2 code/python/search1.py db '"Dent" "watch"'

Which works as well as I expect. The problem is in not quite knowing why it works (though I know the '"' symbol is a search query modifier of some kind), and in how I should aim to prepare queries for processing.

For example, does the Xapian::QueryParser class constructor have an option to add the '"' symbols for me? Or should I preprocess input before I try to retrieve matches?

Charlie
  • 4,197
  • 5
  • 42
  • 59
  • It's very hard to tell what's gone wrong here, but running the index1 example followed by the search1 example without changes from the source of the getting started guide works fine for me (python 2.7.13, Xapian 1.4.3, running on linux). The "fix" you've posted will turn off a couple of the default flags which aren't used in the "Dent watch" search anyway, so it seems more likely that something else is going on — particularly as the code snippet you've posted uses different variable names to the original. You may have changed something else from the original to cause problems. – James Aylett May 15 '19 at 22:57
  • (Particularly since you talk about and tag C++, but then discuss running the python example…it feels like you haven't precisely described what you tried here to get the problem you're seeing.) – James Aylett May 15 '19 at 22:58

1 Answers1

0

For the record, using the following queryParser.parse_query(input, queryParser.FLAG_PHRASE) appear to fix the issue I had.

Charlie
  • 4,197
  • 5
  • 42
  • 59