I need to create an autosuggestor, so I am using Lucene Suggest module. My requirement is
IndexWriter indexWriter = new IndexWriter(directory, config);
Document doc = new Document();
doc.Add(new StringField("content", "Humpty Dumpty sat on a wall", Field.Store.YES));
doc.Add(new StringField("kid", "1", Field.Store.YES));
indexWriter.AddDocument(doc);
doc = new Document();
doc.Add(new StringField("content", "Humpty Dumpty had a great fall", Field.Store.YES));
doc.Add(new StringField("kid", "2", Field.Store.YES));
indexWriter.AddDocument(doc);
doc = new Document();
doc.Add(new StringField("content", "All the king's horses and all the king's men", Field.Store.YES));
doc.Add(new StringField("kid", "1", Field.Store.YES));
indexWriter.AddDocument(doc);
doc = new Document();
doc.Add(new StringField("content", "Couldn't put Humpty together again", Field.Store.YES));
doc.Add(new StringField("kid", "2", Field.Store.YES));
indexWriter.AddDocument(doc);
indexWriter.Commit();
IndexReader indexReader = DirectoryReader.Open(directory);
var dictionary = new LuceneDictionary(indexReader, "content");
var jkk = dictionary.GetEntryEnumerator();
FuzzySuggester fuzzySuggester = new FuzzySuggester(new StandardAnalyzer(LuceneVersion.LUCENE_48));
fuzzySuggester.Build(dictionary);
My requirement is to create separate Suggestor for different values of Kid , in above example basically 2 FuzzySelector one for kid=1 and other kid=2, I am unable to understand , how can I do that. Other way , is to just use the normal lucene search