Lucene++ - a full-featured, c++ search engine
API Documentation
A Query that matches documents containing terms with a specified prefix. A PrefixQuery is built by QueryParser for input like app*. More...
#include <PrefixQuery.h>
Public Member Functions | |
PrefixQuery (const TermPtr &prefix) | |
Constructs a query for terms starting with prefix. | |
virtual | ~PrefixQuery () |
virtual String | getClassName () |
boost::shared_ptr< PrefixQuery > | shared_from_this () |
TermPtr | getPrefix () |
Returns the prefix of this query. | |
virtual String | toString (const String &field) |
Prints a user-readable version of this query. | |
virtual LuceneObjectPtr | clone (const LuceneObjectPtr &other=LuceneObjectPtr()) |
Returns a clone of this query. | |
virtual int32_t | hashCode () |
Return hash code for this object. | |
virtual bool | equals (const LuceneObjectPtr &other) |
Return whether two objects are equal. | |
![]() | |
MultiTermQuery () | |
virtual | ~MultiTermQuery () |
boost::shared_ptr< MultiTermQuery > | shared_from_this () |
int32_t | getTotalNumberOfTerms () |
Return the number of unique terms visited during execution of the query. If there are many of them, you may consider using another query type or optimize your total term count in index. | |
void | clearTotalNumberOfTerms () |
Resets the counting of unique terms. Do this before executing the query/filter. | |
virtual QueryPtr | rewrite (const IndexReaderPtr &reader) |
Called to re-write queries into primitive queries. For example, a PrefixQuery will be rewritten into a BooleanQuery that consists of TermQuerys. | |
virtual RewriteMethodPtr | getRewriteMethod () |
virtual void | setRewriteMethod (const RewriteMethodPtr &method) |
Sets the rewrite method to be used when executing the query. You can use one of the four core methods, or implement your own subclass of RewriteMethod . | |
![]() | |
Query () | |
virtual | ~Query () |
boost::shared_ptr< Query > | shared_from_this () |
virtual void | setBoost (double b) |
Sets the boost for this query clause to b. Documents matching this clause will (in addition to the normal weightings) have their score multiplied by b. | |
virtual double | getBoost () |
Gets the boost for this clause. Documents matching this clause will (in addition to the normal weightings) have their score multiplied by b. The boost is 1.0 by default. | |
virtual String | toString () |
Prints a query to a string. | |
virtual WeightPtr | createWeight (const SearcherPtr &searcher) |
Constructs an appropriate Weight implementation for this query. Only implemented by primitive queries, which re-write to themselves. | |
virtual WeightPtr | weight (const SearcherPtr &searcher) |
Constructs and initializes a Weight for a top-level query. | |
virtual QueryPtr | combine (Collection< QueryPtr > queries) |
Called when re-writing queries under MultiSearcher. | |
virtual void | extractTerms (SetTerm terms) |
Adds all terms occurring in this query to the terms set. Only works if this query is in its rewritten form. | |
virtual SimilarityPtr | getSimilarity (const SearcherPtr &searcher) |
Returns the Similarity implementation to be used for this query. Subclasses may override this method to specify their own Similarity implementation, perhaps one that delegates through that of the Searcher. By default the Searcher's Similarity implementation is returned. | |
String | boostString () |
Return given boost value as a string. | |
![]() | |
virtual | ~LuceneObject () |
virtual void | initialize () |
Called directly after instantiation to create objects that depend on this object being fully constructed. | |
virtual int32_t | compareTo (const LuceneObjectPtr &other) |
Compare two objects. | |
![]() | |
virtual | ~LuceneSync () |
virtual SynchronizePtr | getSync () |
Return this object synchronize lock. | |
virtual LuceneSignalPtr | getSignal () |
Return this object signal. | |
virtual void | lock (int32_t timeout=0) |
Lock this object using an optional timeout. | |
virtual void | unlock () |
Unlock this object. | |
virtual bool | holdsLock () |
Returns true if this object is currently locked by current thread. | |
virtual void | wait (int32_t timeout=0) |
Wait for signal using an optional timeout. | |
virtual void | notifyAll () |
Notify all threads waiting for signal. | |
Static Public Member Functions | |
static String | _getClassName () |
![]() | |
static String | _getClassName () |
static RewriteMethodPtr | CONSTANT_SCORE_FILTER_REWRITE () |
A rewrite method that first creates a private Filter, by visiting each term in sequence and marking all docs for that term. Matching documents are assigned a constant score equal to the query's boost. | |
static RewriteMethodPtr | SCORING_BOOLEAN_QUERY_REWRITE () |
A rewrite method that first translates each term into BooleanClause.Occur#SHOULD clause in a BooleanQuery, and keeps the scores as computed by the query. Note that typically such scores are meaningless to the user, and require non-trivial CPU to compute, so it's almost always better to use CONSTANT_SCORE_AUTO_REWRITE_DEFAULT instead. | |
static RewriteMethodPtr | CONSTANT_SCORE_BOOLEAN_QUERY_REWRITE () |
Like SCORING_BOOLEAN_QUERY_REWRITE except scores are not computed. Instead, each matching document receives a constant score equal to the query's boost. | |
static RewriteMethodPtr | CONSTANT_SCORE_AUTO_REWRITE_DEFAULT () |
Read-only default instance of ConstantScoreAutoRewrite , with ConstantScoreAutoRewrite#setTermCountCutoff set to ConstantScoreAutoRewrite#DEFAULT_TERM_COUNT_CUTOFF and ConstantScoreAutoRewrite#setDocCountPercent set to ConstantScoreAutoRewrite#DEFAULT_DOC_COUNT_PERCENT . Note that you cannot alter the configuration of this instance; you'll need to create a private instance instead. | |
![]() | |
static String | _getClassName () |
static QueryPtr | mergeBooleanQueries (Collection< BooleanQueryPtr > queries) |
Merges the clauses of a set of BooleanQuery's into a single BooleanQuery. | |
Protected Member Functions | |
virtual FilteredTermEnumPtr | getEnum (const IndexReaderPtr &reader) |
Construct the enumeration to be used, expanding the pattern term. | |
![]() | |
void | incTotalNumberOfTerms (int32_t inc) |
![]() | |
LuceneObject () | |
Protected Attributes | |
TermPtr | prefix |
![]() | |
RewriteMethodPtr | rewriteMethod |
int32_t | numberOfTerms |
![]() | |
double | boost |
![]() | |
SynchronizePtr | objectLock |
LuceneSignalPtr | objectSignal |
A Query that matches documents containing terms with a specified prefix. A PrefixQuery is built by QueryParser for input like app*.
This query uses the MultiTermQuery#CONSTANT_SCORE_AUTO_REWRITE_DEFAULT
rewrite method.
Lucene::PrefixQuery::PrefixQuery | ( | const TermPtr & | prefix | ) |
Constructs a query for terms starting with prefix.
|
virtual |
|
inlinestatic |
|
virtual |
Returns a clone of this query.
Reimplemented from Lucene::MultiTermQuery.
|
virtual |
Return whether two objects are equal.
Reimplemented from Lucene::MultiTermQuery.
|
inlinevirtual |
Reimplemented from Lucene::MultiTermQuery.
|
protectedvirtual |
Construct the enumeration to be used, expanding the pattern term.
Implements Lucene::MultiTermQuery.
TermPtr Lucene::PrefixQuery::getPrefix | ( | ) |
Returns the prefix of this query.
|
virtual |
Return hash code for this object.
Reimplemented from Lucene::MultiTermQuery.
|
inline |
|
virtual |
Prints a user-readable version of this query.
Reimplemented from Lucene::Query.
|
protected |