public class LuceneSearchQueryBuilder extends AbstractSearchQueryBuilder
SearchQueryBuilder interface using
lucene as underlying search-engine.| Modifier and Type | Field and Description |
|---|---|
private org.apache.lucene.analysis.Analyzer |
analyzer
The analyzer to use.
|
private LuceneFieldManager |
fieldManager
The
LuceneFieldManager. |
private Boolean |
ignoreLeadingWildcard |
private org.apache.lucene.util.Version |
luceneVersion
The
Version of lucene. |
static LuceneSearchQuery |
NULL_QUERY |
private static Pattern |
PATTERN_NORMALIZE_ASTERISK
The pattern to normalize wildcards.
|
private static Pattern |
PATTERN_NORMALIZE_QUESTIONMARK
The pattern to normalize wildcards.
|
static String |
PROPERTY_IGNORE_LEADING_WILDCARDS
The name of the
property for
isIgnoreLeadingWildcards(). |
| Constructor and Description |
|---|
LuceneSearchQueryBuilder(org.apache.lucene.analysis.Analyzer analyzer,
org.apache.lucene.util.Version version,
LuceneFieldManager fieldManager)
The constructor.
|
| Modifier and Type | Method and Description |
|---|---|
ComplexSearchQuery |
createComplexQuery()
This method creates a
complex query. |
protected SearchQuery |
createNullQuery()
This method creates (or gets) a query that matches anything.
|
SearchQuery |
createPhraseQuery(String field,
String phrase)
|
SearchQuery |
createRangeQuery(String field,
String minimum,
String maximum,
boolean minimumInclusive,
boolean maximumInclusive)
This method creates a
SearchQuery for a range of values. |
SearchQuery |
createWordQuery(String field,
String word)
|
protected org.apache.lucene.analysis.Analyzer |
getAnalyzer() |
protected org.apache.lucene.util.Version |
getLuceneVersion()
This method gets the
Version. |
protected boolean |
isIgnoreLeadingWildcards()
This method determines if leading wildcards will be ignored.
|
boolean |
refresh()
This method refreshes the given object.
|
parseStandardQuery, parseStandardQuerygetLoggerpublic static final String PROPERTY_IGNORE_LEADING_WILDCARDS
property for
isIgnoreLeadingWildcards().private static final Pattern PATTERN_NORMALIZE_ASTERISK
private static final Pattern PATTERN_NORMALIZE_QUESTIONMARK
public static final LuceneSearchQuery NULL_QUERY
createNullQuery()private final org.apache.lucene.analysis.Analyzer analyzer
private final org.apache.lucene.util.Version luceneVersion
Version of lucene.private Boolean ignoreLeadingWildcard
isIgnoreLeadingWildcards()private final LuceneFieldManager fieldManager
LuceneFieldManager.public LuceneSearchQueryBuilder(org.apache.lucene.analysis.Analyzer analyzer,
org.apache.lucene.util.Version version,
LuceneFieldManager fieldManager)
analyzer - is the Analyzer.version - is the Version of lucene.fieldManager - is the LuceneFieldManager.protected boolean isIgnoreLeadingWildcards()
true if leading wildcards ('*' or '?') are ignored, false otherwise.protected org.apache.lucene.analysis.Analyzer getAnalyzer()
protected org.apache.lucene.util.Version getLuceneVersion()
Version.Version.protected SearchQuery createNullQuery()
createNullQuery in class AbstractSearchQueryBuilderentry.public ComplexSearchQuery createComplexQuery()
complex query. You can then add sub-queries to this
query with logical operations.public SearchQuery createPhraseQuery(String field, String phrase)
field - is the name of the field
to search.phrase - is the exact phrase to search for.public SearchQuery createRangeQuery(String field, String minimum, String maximum, boolean minimumInclusive, boolean maximumInclusive)
SearchQuery for a range of values.field - is the name of the field(s) to match.minimum - is the minimum or infimum value.maximum - is the maximum or supremum value.minimumInclusive - - true if the minimum is included and matches,
false if the minimum is treated as infimum and only higher values will
match.maximumInclusive - - true if the maximum is included and matches,
false if the maximum is treated as supremum and only lower values will
match.SearchQuery.public SearchQuery createWordQuery(String field, String word)
field - is the name of the field
where to search.word - is the single term or glob pattern (e.g. "moon?i*" to match "moonlight" or "moonride") to
search for.public boolean refresh()
true if something has changed, false otherwise. If the implementation can not determine the
change it should return true.Copyright © 2001–2016 mmm-Team. All rights reserved.