Term modifiers
You can modify query terms to provide a wide range of search options.
The following term modifiers are supported:
- Wildcard searches
- Lucene supports single- and multiple-character wildcard searches
within single terms. Use the question mark (
?
) for a single-character wildcard search and an asterisk (*
) for a multiple-character wildcard search. Multiple-character wildcard searches look for zero or more characters.Attention: The wildcard characters?
or*
cannot be used as the first character of a search.- Examples:
- Search for the words
test
ortext
:te?t
- Search for
test
,tests
, ortester
:test*
- Search for the words
- Fuzzy searches
- A fuzzy search is a type of search that finds matches even if
search terms are misspelled or only partial words are specified. To
do a fuzzy search, use the tilde (
~
) symbol at the end of a term.- Example:
- Search for a term similar in spelling to
word
:word~
This search term will match
wood
,work
,dword
,wordy
,ford
, and so on, as well asword
.
- Search for a term similar in spelling to
- Proximity searches
- Lucene supports finding words that are within a short distance
of one another in a record field. To perform a proximity search, use
the tilde (
~
) symbol followed by a number at the end of a phrase.- Example:
- Search for and
Beta2
within ten words of one another in a record field:"Beta1 Beta2"~10
- Search for and
- Range searches
- Range searches allow you to match records that contain field values
between the lower and upper bounds specified by the query. Range queries
can be inclusive or exclusive.Inclusive-range queries are denoted by square brackets and the operator
TO
:[LowerBound TO UpperBound]
Exclusive-range queries are denoted by curly brackets and the operatorTO
:{LowerBound TO UpperBound}
Range queries are not reserved for numeric fields. You can also perform a range search on fields with alphabetic values. Sorting is performed lexicographically. As such, records returned by a range-search query do not have a relevance score.
- Examples:
- Find records with SubmitDate field values
between
2007
and2008
, inclusive:SubmitDate:[2007 TO 2008]
- Narrow your search to the month of October 2007:
SubmitDate:[20071001 TO 20071031]
- Find records with SubmitDate field values
that range from 01 October 2008 through the newest record in the user
database, inclusive:
SubmitDate:[20081001 TO *]
- Find records with Headline values that
range between
alpha
anddelta
, includingalpha
and excludingdelta
:Headline:[alpha TO delta}
Your result set might include records with headlines that start with
alpha
,alpha1
,beta
,beta1
, andbeta2
.
- Find records with SubmitDate field values
between
- Boosting a term
- Lucene provides a relevance score for matching records that is
calculated by the configured analyzers. To boost the weight of a term
or phrase in a query, use a caret (
^
) symbol and a boost factor (a number) following the term or phrase. The higher the boost factor, the more relevant the term or phrase is.The default boost factor is 1. Although the boost factor must be a positive number, it can be less than 1, for example, 0.2, to lower the relevance of records that contain the term or phrase.
- Examples:
- Suppose you plan to run the following search:
beta OR alpha
To make records with the termbeta
appear more relevant in the result set score than records with the termalpha
, use the boost symbol^
followed by a boost factor:beta^4 OR alpha
- Make the records containing the phrase
beta 7.1
appear more relevant in the result set score than those containing the phrasealpha 7.1
:"beta 7.1"^2 OR "alpha 7.1"
- Suppose you plan to run the following search: