Soundex search in LuceneQueries

@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:

  1. I added a Soundex filter to the LuceneFactory. I used the example definition of the this docu:
	mapping.analyzerDef(LuceneAnalyzers.SOUNDEX_ANALYZER,StandardTokenizerFactory.class)
  	.filter(PhoneticFilterFactory.class)
  		.param("encoder", "Soundex")
  		.param("inject", "false");
  1. I annotated the fields in PersonName accordingly. To give an example:
	@Fields({
			@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;
  1. 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.

  2. 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();
			luceneQuery.list();
  1. 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

Files: