0

We are using Lucene v3.6 in our code. We first index the data and then use Lucene search as well to search for terms. Using Luke I've confirmed that when we index a term such as Hashimoto's it gets indexed with the apostrophe I presume (because when I search for Hashimoto from the results obtained I can confirm that the corresponding field value contains the apostrophe as Hashimoto's. However, when I search for Hashimoto's (even in Luke) I do not get back any results for the field. e.g.

+names.name:hashimoto (works and returns multiple results some which have Hashimoto's as a term)
+names.name:hashimoto's (does not work - no results)

In both cases I'm using the StandardAnalyzer which from what I understand should be handling the apostrophe with no issue.

femtoRgon
  • 32,893
  • 7
  • 60
  • 87
user1111871
  • 137
  • 1
  • 12

1 Answers1

0

Looks like you are using a query that is not being analyzed. In general, query-time analysis is handled by the QueryParser. If you aren't using one, your query won't be analyzed. If you are manually constructing queries (TermQuery, for instance), it is assumed you have handled any analysis-related concerns yourself, so the term will be searched as is.

femtoRgon
  • 32,893
  • 7
  • 60
  • 87
  • In my code I am using the StandardAnalyzer. I get back the tokens from the StandardAnalyzer with the tokenStream method and use them to build the query. From some research e.g. http://stackoverflow.com/questions/1190699/storing-words-with-apostrophe-in-lucene-index I understand that the apostrophe should be supported natively using the StandardAnalyzer. Yet it doesn't seem so. And as i mentioned, in the case of using Luke to search my index as well and choosing the StandardAnalyzer there too was not helpful. – user1111871 Apr 10 '17 at 20:21