I am having a bit of a problem with my search queries being parsed
correctly it seems, and I wonder if anyone else has experienced this.
I have written an index using StandardAnalyzer for analysis. I want to
search that index by passing my user query through a QueryParser
instance which is also using a StandardAnalyzer. However the resultant
query does not seem to be a valid term query and therefore the search
produces no hits.
Specifically I have a bunch of docs with the phrase “museum of art” in
the source text.
A query ‘museum art’ gets parsed into ‘+contents:museum +contents:art’
which works just fine and produces hits.
A query of ‘museum of art’ gets parsed into ‘+contents:museum +contents:
+contents:art’ which produces no hits. The resulting term query itself
seems to be malformed, containing an extraneous term for a stop word
which was (correctly) filtered out.
Using the Luke gui tool for Lucene, I have verified that passing my
query through StandardAnalyzer should indeed work, as it produces the
expected term query and the expected hits in that environment. But as
for the same query in Ferret, I’m at a loss.
This should be easily reproducible with the following code fragment:
parser = Ferret::QueryParser.new(‘contents’, :analyzer =>
Ferret::Analysis::StandardAnalyzer.new, :occur_default =>
q1 = parser.parse(‘museum art’)
q2 = parser.parse(‘museum of art’)
puts q1, q2
Thanks for any insight.