Class DirectCandidateGenerator
- java.lang.Object
-
- org.elasticsearch.search.suggest.phrase.CandidateGenerator
-
- org.elasticsearch.search.suggest.phrase.DirectCandidateGenerator
-
public final class DirectCandidateGenerator extends CandidateGenerator
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classDirectCandidateGenerator.Candidatestatic classDirectCandidateGenerator.CandidateSetstatic classDirectCandidateGenerator.TokenConsumer
-
Constructor Summary
Constructors Constructor Description DirectCandidateGenerator(DirectSpellChecker spellchecker, String field, SuggestMode suggestMode, IndexReader reader, double nonErrorLikelihood, int numCandidates)DirectCandidateGenerator(DirectSpellChecker spellchecker, String field, SuggestMode suggestMode, IndexReader reader, double nonErrorLikelihood, int numCandidates, Analyzer preFilter, Analyzer postFilter, Terms terms)
-
Method Summary
-
Methods inherited from class org.elasticsearch.search.suggest.phrase.CandidateGenerator
createCandidate, createCandidate, drawCandidates
-
-
-
-
Constructor Detail
-
DirectCandidateGenerator
public DirectCandidateGenerator(DirectSpellChecker spellchecker, String field, SuggestMode suggestMode, IndexReader reader, double nonErrorLikelihood, int numCandidates) throws IOException
- Throws:
IOException
-
DirectCandidateGenerator
public DirectCandidateGenerator(DirectSpellChecker spellchecker, String field, SuggestMode suggestMode, IndexReader reader, double nonErrorLikelihood, int numCandidates, Analyzer preFilter, Analyzer postFilter, Terms terms) throws IOException
- Throws:
IOException
-
-
Method Detail
-
isKnownWord
public boolean isKnownWord(BytesRef term) throws IOException
- Specified by:
isKnownWordin classCandidateGenerator- Throws:
IOException
-
termStats
public TermStats termStats(BytesRef term) throws IOException
- Specified by:
termStatsin classCandidateGenerator- Throws:
IOException
-
internalTermStats
public TermStats internalTermStats(BytesRef term) throws IOException
- Throws:
IOException
-
getField
public String getField()
-
drawCandidates
public DirectCandidateGenerator.CandidateSet drawCandidates(DirectCandidateGenerator.CandidateSet set) throws IOException
- Specified by:
drawCandidatesin classCandidateGenerator- Throws:
IOException
-
preFilter
protected BytesRef preFilter(BytesRef term, CharsRefBuilder spare, BytesRefBuilder byteSpare) throws IOException
- Throws:
IOException
-
postFilter
protected void postFilter(DirectCandidateGenerator.Candidate candidate, CharsRefBuilder spare, BytesRefBuilder byteSpare, List<DirectCandidateGenerator.Candidate> candidates) throws IOException
- Throws:
IOException
-
createCandidate
public DirectCandidateGenerator.Candidate createCandidate(BytesRef term, TermStats termStats, double channelScore, boolean userInput) throws IOException
- Specified by:
createCandidatein classCandidateGenerator- Throws:
IOException
-
analyze
public static int analyze(Analyzer analyzer, BytesRef toAnalyze, String field, DirectCandidateGenerator.TokenConsumer consumer, CharsRefBuilder spare) throws IOException
- Throws:
IOException
-
analyze
public static int analyze(TokenStream stream, DirectCandidateGenerator.TokenConsumer consumer) throws IOException
NOTE: this method closes the TokenStream, even on exception, which is awkward because really the caller who calledAnalyzer.tokenStream(java.lang.String, java.io.Reader)should close it, but when trying that there are recursion issues when we try to use the same TokenStream twice in the same recursion...- Throws:
IOException
-
-