lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Greg Huber <gregh3...@gmail.com>
Subject AnalyzingInfixSuggester suggest apostrophe
Date Mon, 23 Dec 2019 10:11:31 GMT
Hello,

I am using the AnalyzingInfixSuggester for my suggester, and trying to 
get the apostrophe to work correctly (highlighter and search).


I am adding a field to my main index for the suggester with the 
apostrophe included:

document.add(new StoredField(FieldConstants.C_DESCRIPTION_SUGGEST, 
item.getDescription() ));


and then build the suggest dictionary using the main index field:


DocumentDictionary ldd = new DocumentDictionary(
       DirectoryReader.open(sourceFSDirectory),
       FieldConstants.C_DESCRIPTION_SUGGEST,
       FieldConstants.C_WEIGHT_LINES,
       FieldConstants.CONSTANT_PAYLOAD,
       FieldConstants.CONSTANT);


I am then using the AnalyzingInfixSuggester with this custom analyzer build:

return CustomAnalyzer.builder()
                     .withTokenizer(StandardTokenizerFactory.class)
                     .addTokenFilter(LowerCaseFilterFactory.class)
.addTokenFilter(SuggestStopFilterFactory.class).build();


The problem is if I include the apostrophe in the main index field, then 
do a search without the apostrophe it does not find it.  Similarly vice 
versa.

Is there an alternative analyser build that would make both ways work? 
ie ignore the apostrophe?


Cheers Greg



---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message