Class: SearchQuery

SearchQuery

new SearchQuery()

Class for building of FTS search queries. This class should never be constructed directly, instead you should use the SearchQuery.new static method to instantiate a SearchQuery.

Since:
  • 2.1.7 (stability: committed)

Members

<static, readonly> HighlightStyle :number

Enumeration for specifying FTS highlight styling.

Type:
  • number
Properties:
Name Type Default Description
HTML number html

This causes hits to be highlighted using HTML tags.

ANSI number ansi

This causes hits to be highlighted with ANSI character codes.

Methods

<static> boolean() → {BooleanQuery}

boolean creates a compound BooleanQuery composed of several other Query objects.

Returns:
Type
BooleanQuery

<static> booleanField(val) → {BooleanFieldQuery}

booleanField creates a BooleanFieldQuery for searching boolean fields in an index.

Parameters:
Name Type Description
val boolean
Returns:
Type
BooleanFieldQuery

<static> conjuncts(queries) → {ConjunctionQuery}

conjuncts creates a ConjunctionQuery for matching all of a list of subqueries in an index.

Parameters:
Name Type Description
queries Array.<SearchQuery.Query>
Returns:
Type
ConjunctionQuery

<static> dateRange() → {DateRangeQuery}

dateRange creates a DateRangeQuery for matching date ranges in an index.

Returns:
Type
DateRangeQuery

<static> disjuncts(queries) → {ConjunctionQuery}

disjuncts creates a DisjunctionQuery for matching any of a list of subqueries in an index.

Parameters:
Name Type Description
queries Array.<SearchQuery.Query>
Returns:
Type
ConjunctionQuery

<static> docIds(ids) → {DocIdQuery}

docIds creates a DocIdQuery which allows you to match a list of document ids in an index.

Parameters:
Name Type Description
ids Array.<string>
Returns:
Type
DocIdQuery

<static> match(match) → {MatchQuery}

match creates a Query MatchQuery matching text.

Parameters:
Name Type Description
match string
Returns:
Type
MatchQuery

<static> matchAll() → {MatchAllQuery}

matchAll creates a MatchAllQuery which matches anything.

Returns:
Type
MatchAllQuery

<static> matchNone() → {MatchNoneQuery}

matchNone creates a MatchNoneQuery which matches nothing.

Returns:
Type
MatchNoneQuery

<static> matchPhrase(phrase) → {MatchPhraseQuery}

matchPhase creates a new MatchPhraseQuery object for matching phrases in the index.

Parameters:
Name Type Description
phrase string
Returns:
Type
MatchPhraseQuery

<static> new(indexName, query) → {SearchQuery}

Creates a new search query from an index name and search query definition.

Parameters:
Name Type Description
indexName string
query SearchQuery.Query
Since:
  • 2.1.7 (stability: committed)
Returns:
Type
SearchQuery

<static> numericRange() → {NumericRangeQuery}

numericRange creates a NumericRangeQuery for matching numeric ranges in an index.

Returns:
Type
NumericRangeQuery

<static> phrase(terms) → {PhraseQuery}

phrase creates a new PhraseQuery for searching a phrase in an index.

Parameters:
Name Type Description
terms Array.<string>
Returns:
Type
PhraseQuery

<static> prefix(prefix) → {PrefixQuery}

prefix creates a new MatchQuery for searching for a prefix in an index.

Parameters:
Name Type Description
prefix string
Returns:
Type
PrefixQuery

<static> regexp(regexp) → {RegexpQuery}

regexp creates a new RegexpQuery object for matching against a regexp query in the index.

Parameters:
Name Type Description
regexp string
Returns:
Type
RegexpQuery

<static> string(query) → {StringQuery}

string creates a StringQuery for matching strings.

Parameters:
Name Type Description
query string
Returns:
Type
StringQuery

<static> term(term) → {TermQuery}

term creates a TermQuery for searching terms in an index.

Parameters:
Name Type Description
term string
Returns:
Type
TermQuery

<static> wildcard(wildcard) → {WildcardQuery}

wildcard creates a WildcardQuery which allows you to match a string with wildcards in an index.

Parameters:
Name Type Description
wildcard string
Returns:
Type
WildcardQuery

addFacet(name, facet) → {SearchQuery}

Adds a SearchFacet object to return information about as part of the execution of this query.

Parameters:
Name Type Description
name string
facet SeachFacet
Since:
  • 2.1.7 (stability: committed)
Returns:
Type
SearchQuery

explain(explain) → {SearchQuery}

Includes information about the internal search semantics used to execute your query.

Parameters:
Name Type Description
explain boolean
Since:
  • 2.1.7 (stability: committed)
Returns:
Type
SearchQuery

fields(fields) → {SearchQuery}

Specifies the fields you wish to receive in the result set.

Parameters:
Name Type Description
fields Array.<string>
Since:
  • 2.1.7 (stability: committed)
Returns:
Type
SearchQuery

highlight(style, fields) → {SearchQuery}

Requests a particular highlight style and field list for this query.

Parameters:
Name Type Description
style SearchQuery.HighlightStyle
fields Array.<string>
Since:
  • 2.1.7 (stability: committed)
Returns:
Type
SearchQuery

limit(limit) → {SearchQuery}

Specifies the maximum number of results to return.

Parameters:
Name Type Description
limit number
Since:
  • 2.1.7 (stability: committed)
Returns:
Type
SearchQuery

skip(skip) → {SearchQuery}

Specifies how many results to skip from the beginning of the result set.

Parameters:
Name Type Description
skip number
Since:
  • 2.1.7 (stability: committed)
Returns:
Type
SearchQuery

timeout(timeout) → {SearchQuery}

Specifies the maximum time to wait (in millseconds) for this query to complete.

Parameters:
Name Type Description
timeout number
Since:
  • 2.1.7 (stability: committed)
Returns:
Type
SearchQuery