public class WeightedSpanTermExtractor
extends java.lang.Object
WeightedSpanTerms from a Query based on whether
Terms from the Query are contained in a supplied TokenStream.| Modifier and Type | Class and Description |
|---|---|
protected static class |
WeightedSpanTermExtractor.PositionCheckingMap<K>
This class makes sure that if both position sensitive and insensitive
versions of the same term are added, the position insensitive one wins.
|
| Constructor and Description |
|---|
WeightedSpanTermExtractor() |
WeightedSpanTermExtractor(java.lang.String defaultField) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
collectSpanQueryFields(org.apache.lucene.search.spans.SpanQuery spanQuery,
java.util.Set<java.lang.String> fieldNames) |
protected void |
extract(org.apache.lucene.search.Query query,
java.util.Map<java.lang.String,WeightedSpanTerm> terms)
Fills a
Map with <@link WeightedSpanTerm>s using the terms from the supplied Query. |
protected void |
extractUnknownQuery(org.apache.lucene.search.Query query,
java.util.Map<java.lang.String,WeightedSpanTerm> terms) |
protected void |
extractWeightedSpanTerms(java.util.Map<java.lang.String,WeightedSpanTerm> terms,
org.apache.lucene.search.spans.SpanQuery spanQuery)
Fills a
Map with <@link WeightedSpanTerm>s using the terms from the supplied SpanQuery. |
protected void |
extractWeightedTerms(java.util.Map<java.lang.String,WeightedSpanTerm> terms,
org.apache.lucene.search.Query query)
Fills a
Map with <@link WeightedSpanTerm>s using the terms from the supplied Query. |
protected boolean |
fieldNameComparator(java.lang.String fieldNameToCheck)
Necessary to implement matches for queries against
defaultField |
boolean |
getExpandMultiTermQuery() |
protected org.apache.lucene.index.IndexReader |
getReaderForField(java.lang.String field) |
org.apache.lucene.analysis.TokenStream |
getTokenStream() |
java.util.Map<java.lang.String,WeightedSpanTerm> |
getWeightedSpanTerms(org.apache.lucene.search.Query query,
org.apache.lucene.analysis.TokenStream tokenStream)
Creates a Map of
WeightedSpanTerms from the given Query and TokenStream. |
java.util.Map<java.lang.String,WeightedSpanTerm> |
getWeightedSpanTerms(org.apache.lucene.search.Query query,
org.apache.lucene.analysis.TokenStream tokenStream,
java.lang.String fieldName)
Creates a Map of
WeightedSpanTerms from the given Query and TokenStream. |
java.util.Map<java.lang.String,WeightedSpanTerm> |
getWeightedSpanTermsWithScores(org.apache.lucene.search.Query query,
org.apache.lucene.analysis.TokenStream tokenStream,
java.lang.String fieldName,
org.apache.lucene.index.IndexReader reader)
Creates a Map of
WeightedSpanTerms from the given Query and TokenStream. |
boolean |
isCachedTokenStream() |
protected boolean |
mustRewriteQuery(org.apache.lucene.search.spans.SpanQuery spanQuery) |
void |
setExpandMultiTermQuery(boolean expandMultiTermQuery) |
protected void |
setMaxDocCharsToAnalyze(int maxDocCharsToAnalyze) |
void |
setWrapIfNotCachingTokenFilter(boolean wrap)
By default,
TokenStreams that are not of the type
CachingTokenFilter are wrapped in a CachingTokenFilter to
ensure an efficient reset - if you are already using a different caching
TokenStream impl and you don't want it to be wrapped, set this to
false. |
public WeightedSpanTermExtractor()
public WeightedSpanTermExtractor(java.lang.String defaultField)
protected void extract(org.apache.lucene.search.Query query,
java.util.Map<java.lang.String,WeightedSpanTerm> terms)
throws java.io.IOException
Map with <@link WeightedSpanTerm>s using the terms from the supplied Query.query - Query to extract Terms fromterms - Map to place created WeightedSpanTerms injava.io.IOExceptionprotected void extractUnknownQuery(org.apache.lucene.search.Query query,
java.util.Map<java.lang.String,WeightedSpanTerm> terms)
throws java.io.IOException
java.io.IOExceptionprotected void extractWeightedSpanTerms(java.util.Map<java.lang.String,WeightedSpanTerm> terms, org.apache.lucene.search.spans.SpanQuery spanQuery) throws java.io.IOException
Map with <@link WeightedSpanTerm>s using the terms from the supplied SpanQuery.terms - Map to place created WeightedSpanTerms inspanQuery - SpanQuery to extract Terms fromjava.io.IOExceptionprotected void extractWeightedTerms(java.util.Map<java.lang.String,WeightedSpanTerm> terms, org.apache.lucene.search.Query query) throws java.io.IOException
Map with <@link WeightedSpanTerm>s using the terms from the supplied Query.terms - Map to place created WeightedSpanTerms inquery - Query to extract Terms fromjava.io.IOExceptionprotected boolean fieldNameComparator(java.lang.String fieldNameToCheck)
defaultFieldprotected org.apache.lucene.index.IndexReader getReaderForField(java.lang.String field)
throws java.io.IOException
java.io.IOExceptionpublic java.util.Map<java.lang.String,WeightedSpanTerm> getWeightedSpanTerms(org.apache.lucene.search.Query query, org.apache.lucene.analysis.TokenStream tokenStream) throws java.io.IOException
WeightedSpanTerms from the given Query and TokenStream.
query - that caused hittokenStream - of text to be highlightedjava.io.IOExceptionpublic java.util.Map<java.lang.String,WeightedSpanTerm> getWeightedSpanTerms(org.apache.lucene.search.Query query, org.apache.lucene.analysis.TokenStream tokenStream, java.lang.String fieldName) throws java.io.IOException
WeightedSpanTerms from the given Query and TokenStream.
query - that caused hittokenStream - of text to be highlightedfieldName - restricts Term's used based on field namejava.io.IOExceptionpublic java.util.Map<java.lang.String,WeightedSpanTerm> getWeightedSpanTermsWithScores(org.apache.lucene.search.Query query, org.apache.lucene.analysis.TokenStream tokenStream, java.lang.String fieldName, org.apache.lucene.index.IndexReader reader) throws java.io.IOException
WeightedSpanTerms from the given Query and TokenStream. Uses a supplied
IndexReader to properly weight terms (for gradient highlighting).
query - that caused hittokenStream - of text to be highlightedfieldName - restricts Term's used based on field namereader - to use for scoringjava.io.IOExceptionprotected void collectSpanQueryFields(org.apache.lucene.search.spans.SpanQuery spanQuery,
java.util.Set<java.lang.String> fieldNames)
protected boolean mustRewriteQuery(org.apache.lucene.search.spans.SpanQuery spanQuery)
public boolean getExpandMultiTermQuery()
public void setExpandMultiTermQuery(boolean expandMultiTermQuery)
public boolean isCachedTokenStream()
public org.apache.lucene.analysis.TokenStream getTokenStream()
public void setWrapIfNotCachingTokenFilter(boolean wrap)
TokenStreams that are not of the type
CachingTokenFilter are wrapped in a CachingTokenFilter to
ensure an efficient reset - if you are already using a different caching
TokenStream impl and you don't want it to be wrapped, set this to
false.wrap - protected final void setMaxDocCharsToAnalyze(int maxDocCharsToAnalyze)
Copyright © 2000-2022 Apache Software Foundation. All Rights Reserved.