java.lang.Object
org.apache.lucene.search.Query
org.apache.lucene.queries.mlt.MoreLikeThisQuery
A simple wrapper for MoreLikeThis for use in scenarios where a Query object is required eg in
custom QueryParser extensions. At query.rewrite() time the reader is used to construct the actual
MoreLikeThis object and obtain the real Query object.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionMoreLikeThisQuery(String likeText, String[] moreLikeFields, Analyzer analyzer, String fieldName) -
Method Summary
Modifier and TypeMethodDescriptionbooleanOverride and implement query instance equivalence properly in a subclass.private booleanequalsTo(MoreLikeThisQuery other) intintintString[]floatSet<?>inthashCode()Override and implement query hash code properly in a subclass.rewrite(IndexReader reader) Expert: called to re-write queries into primitive queries.voidsetAnalyzer(Analyzer analyzer) voidsetLikeText(String likeText) voidsetMaxQueryTerms(int maxQueryTerms) voidsetMinDocFreq(int minDocFreq) voidsetMinTermFrequency(int minTermFrequency) voidsetMoreLikeFields(String[] moreLikeFields) voidsetPercentTermsToMatch(float percentTermsToMatch) voidsetStopWords(Set<?> stopWords) Prints a query to a string, withfieldassumed to be the default field and omitted.voidvisit(QueryVisitor visitor) Recurse through the query tree, visiting any child queriesMethods inherited from class org.apache.lucene.search.Query
classHash, createWeight, sameClassAs, toString
-
Field Details
-
likeText
-
moreLikeFields
-
analyzer
-
fieldName
-
percentTermsToMatch
private float percentTermsToMatch -
minTermFrequency
private int minTermFrequency -
maxQueryTerms
private int maxQueryTerms -
stopWords
-
minDocFreq
private int minDocFreq
-
-
Constructor Details
-
Method Details
-
rewrite
Description copied from class:QueryExpert: called to re-write queries into primitive queries. For example, a PrefixQuery will be rewritten into a BooleanQuery that consists of TermQuerys.Callers are expected to call
rewritemultiple times if necessary, until the rewritten query is the same as the original query.- Overrides:
rewritein classQuery- Throws:
IOException- See Also:
-
toString
Description copied from class:QueryPrints a query to a string, withfieldassumed to be the default field and omitted. -
getPercentTermsToMatch
public float getPercentTermsToMatch() -
setPercentTermsToMatch
public void setPercentTermsToMatch(float percentTermsToMatch) -
getAnalyzer
-
setAnalyzer
-
getLikeText
-
setLikeText
-
getMaxQueryTerms
public int getMaxQueryTerms() -
setMaxQueryTerms
public void setMaxQueryTerms(int maxQueryTerms) -
getMinTermFrequency
public int getMinTermFrequency() -
setMinTermFrequency
public void setMinTermFrequency(int minTermFrequency) -
getMoreLikeFields
-
setMoreLikeFields
-
getStopWords
-
setStopWords
-
getMinDocFreq
public int getMinDocFreq() -
setMinDocFreq
public void setMinDocFreq(int minDocFreq) -
hashCode
public int hashCode()Description copied from class:QueryOverride and implement query hash code properly in a subclass. This is required so thatQueryCacheworks properly. -
equals
Description copied from class:QueryOverride and implement query instance equivalence properly in a subclass. This is required so thatQueryCacheworks properly.Typically a query will be equal to another only if it's an instance of the same class and its document-filtering properties are identical that other instance. Utility methods are provided for certain repetitive code.
-
equalsTo
-
visit
Description copied from class:QueryRecurse through the query tree, visiting any child queries
-