@raff It was more about understanding the library better and I could not find any details regarding this. But you are right I should have tried it myself.
However, I am facing some issue with the Phonetic filter where I am a bit lost. So let me shorty describe what I have done so far:
- I added a Soundex filter to the LuceneFactory. I used the example definition of the this docu:
- I annotated the fields in PersonName accordingly. To give an example:
@Field(name = "familyName2Exact", analyzer = @Analyzer(definition = LuceneAnalyzers.EXACT_ANALYZER), boost = @Boost(4f)),
@Field(name = "familyName2Soundex", analyzer = @Analyzer(definition = LuceneAnalyzers.SOUNDEX_ANALYZER), boost = @Boost(8f))
private String familyName2;
As far as I can tell the setting up of the LuceneAnalyzer did finish after this two steps and it can be used within a search. Do I miss an adjustment? Anything looking odd in the code above.
The next step is to implement the actual search function. The code basically looks like the following:
List<String> fields = new ArrayList<>();
fields.addAll(Arrays.asList("familyNameSoundex", "familyName2Soundex", "middleNameSoundex", "givenNameSoundex"));
LuceneQuery<PersonName> luceneQuery = LuceneQuery
.newQuery(PersonName.class, sessionFactory.getCurrentSession(), query, fields).useOrQueryParser();
- The problem is that this query results in an empty set. That is wrong since the test case (getSimilarPeople_shouldMatchSearchToFamilyName2() of PersonServiceTest expects at least two matches.
If I adapt the code to use familyName2Exact it is working. That is why my conclusion is that something is wrong with the analyzer setup. The search routine seems to be valid.
Does someone has an idea how to fix this issue? @bistenes @dkayiwa perhaps