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 TypeMethodDescriptionboolean
Override and implement query instance equivalence properly in a subclass.private boolean
equalsTo
(MoreLikeThisQuery other) int
int
int
String[]
float
Set<?>
int
hashCode()
Override and implement query hash code properly in a subclass.rewrite
(IndexReader reader) Expert: called to re-write queries into primitive queries.void
setAnalyzer
(Analyzer analyzer) void
setLikeText
(String likeText) void
setMaxQueryTerms
(int maxQueryTerms) void
setMinDocFreq
(int minDocFreq) void
setMinTermFrequency
(int minTermFrequency) void
setMoreLikeFields
(String[] moreLikeFields) void
setPercentTermsToMatch
(float percentTermsToMatch) void
setStopWords
(Set<?> stopWords) Prints a query to a string, withfield
assumed to be the default field and omitted.void
visit
(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:Query
Expert: 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
rewrite
multiple times if necessary, until the rewritten query is the same as the original query.- Overrides:
rewrite
in classQuery
- Throws:
IOException
- See Also:
-
toString
Description copied from class:Query
Prints a query to a string, withfield
assumed 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:Query
Override and implement query hash code properly in a subclass. This is required so thatQueryCache
works properly. -
equals
Description copied from class:Query
Override and implement query instance equivalence properly in a subclass. This is required so thatQueryCache
works 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:Query
Recurse through the query tree, visiting any child queries
-