new Query()
Solr Query
Methods
-
addParams(params)
-
Add params
Parameters:
Name Type Description paramsArray.<Object> Properties
Name Type Description fieldString params field
valueString params value
Returns:
- Type
- Query
-
df(params)
-
Set the default query field.
Parameters:
Name Type Description paramsString default field for search
Returns:
- Type
- Query
-
dismax()
-
Set DisMax query parser
Returns:
- Type
- Query
-
edismax()
-
Set eDisMax query parser
Returns:
- Type
- Query
-
facetQuery(params)
-
Set facet query params
Parameters:
Name Type Description paramsObject | String facet object or facet string
Properties
Name Type Argument Default Description onBoolean <optional>
true Turn on or off facet
queryString <optional>
Specifies a Lucene query to generate a facet count.
fieldString | Array <optional>
Identifies a field to be treated as a facet.
prefixString <optional>
Limits the terms used for faceting to those that begin with the specified prefix.
containsString <optional>
Limits the terms used for faceting to those that contain the specified substring.
containsIgnoreCaseString <optional>
If facet.contains is used, ignore case when searching for the specified substring.
sortString <optional>
Controls how faceted results are sorted. (count|index)
limitNumber <optional>
Controls how many constraints should be returned for each facet.
offsetNumber <optional>
Specifies an offset into the facet results at which to begin displaying facets.
mincountNumber <optional>
Specifies the minimum counts required for a facet field to be included in the response.
missingBoolean <optional>
Controls whether Solr should compute a count of all matching results which have no value for the field, in addition to the term-based constraints of a facet field.
methodString <optional>
Selects the algorithm or method Solr should use when faceting a field. (enum|fc|fcs)
Returns:
- Type
- Query
-
fl(params)
-
Set field params
Parameters:
Name Type Description paramsString | Array.<String> field name
Returns:
- Type
- Query
-
fq(params)
-
Set filter query params
Parameters:
Name Type Description paramsObject | Array.<Object> filter options
Properties
Name Type Argument Description fieldString <optional>
filter field
valueString | Number <optional>
filter value
Returns:
- Type
- Query
-
groupQuery(params)
-
Set group query params
Parameters:
Name Type Description paramsObject | String group object or group string
Properties
Name Type Argument Default Description onBoolean <optional>
true Turn on or off group
fieldString <optional>
The name of the field by which to group results.
queryString <optional>
Return a single group of documents that match the given query.
limitNumber <optional>
Specifies the number of results to return for each group. The default value is 1.
offsetNumber <optional>
Specifies an initial offset for the document list of each group.
sortString <optional>
Specifies how Solr sorts documents within each group.
formatString <optional>
If this parameter is set to simple, the grouped documents are presented in a single flat list, and the start and rows parameters affect the numbers of documents instead of groups.
mainBoolean <optional>
If true, the result of the first field grouping command is used as the main result list in the response, using group.format=simple.
ngroupsBoolean <optional>
If true, Solr includes the number of groups that have matched the query in the results. The default value is false.
truncateBoolean <optional>
If true, facet counts are based on the most relevant document of each group matching the query. The default value is false.
facetBoolean <optional>
Determines whether to compute grouped facets for the field facets specified in facet.field parameters.
cachePercentNumber <optional>
Determines whether to compute grouped facets for the field facets specified in facet.field parameters.
Returns:
- Type
- Query
-
hlQuery(params)
-
Set hl query params
Parameters:
Name Type Description paramsObject | String hl object or hl string
Properties
Name Type Argument Default Description onBoolean <optional>
true Turn on or off hl
qString <optional>
Specifies an overriding query term for highlighting
qparserString <optional>
Specifies a qparser to use for the hl.q query.
flString | Array <optional>
Specifies a list of fields to highlight.
snippetsNumber <optional>
Specifies maximum number of highlighted snippets to generate per field.
fragsizeNumber <optional>
Specifies the size, in characters, of fragments to consider for highlighting.
mergeContiguousBoolean <optional>
Instructs Solr to collapse contiguous fragments into a single fragment.
requireFieldMatchBoolean <optional>
If set to true, highlights terms only if they appear in the specified field.
maxAnalyzedCharsNumber <optional>
Specifies the number of characters into a document that Solr should look for suitable snippets.
maxMultiValuedToExamineNumber <optional>
Specifies the maximum number of entries in a multi-valued field to examine before stopping.
maxMultiValuedToMatchNumber <optional>
Specifies the maximum number of matches in a multi-valued field that are found before stopping.
alternateFieldString <optional>
Specifies a field to be used as a backup default summary if Solr cannot generate a snippet (i.e., because no terms match).
maxAlternateFieldLengthNumber <optional>
Specifies the maximum number of characters of the field to return.
formatterString <optional>
simple Selects a formatter for the highlighted output.
simplePreString <optional>
Specifies the text that should appear before. ()
simplePostString <optional>
Specifies the text that should appear after. ()
fragmenterString <optional>
Specifies a text snippet generator for highlighted text.
usePhraseHighlighterBoolean <optional>
If set to true, Solr will use the Lucene SpanScorer class to highlight phrase terms only when they appear within the query phrase in the document.
highlightMultiTermBoolean <optional>
If set to true, Solr will use highlight phrase terms that appear in multi-term queries.
regexSlopNumber <optional>
When using the regex fragmenter (hl.fragmenter =regex), this parameter defines the factor by which the fragmenter can stray from the ideal fragment size (given by hl.fragsize) to accommodate a regular expression.
regexPatternString <optional>
Specifies the regular expression for fragmenting. This could be used to extract sentences.
regexMaxAnalyzedCharsNumber <optional>
Instructs Solr to analyze only this many characters from a field when using the regex fragmenter (after which, the fragmenter produces fixed-sized fragments).
preserveMultiBoolean <optional>
If true, multi-valued fields will return all values in the order they were saved in the index. If false, only values that match the highlight request will be returned.
Returns:
- Type
- Query
-
mltQuery(params)
-
Set mlt query params
Parameters:
Name Type Description paramsObject | String mlt object or mlt string
Properties
Name Type Argument Default Description onBoolean <optional>
true Turn on or off mlt
flString | Array <optional>
Specifies the fields to use for similarity. If possible, these should have stored termVectors.
mintfNumber <optional>
Specifies the Minimum Term Frequency, the frequency below which terms will be ignored in the source document.
mindfNumber <optional>
Specifies the Minimum Document Frequency, the frequency at which words will be ignored which do not occur in at least this many documents.
maxdfNumber <optional>
Specifies the Maximum Document Frequency, the frequency at which words will be ignored which occur in more than this many documents.
minwlNumber <optional>
Sets the minimum word length below which words will be ignored.
maxwlNumber <optional>
Sets the maximum word length above which words will be ignored.
maxqtNumber <optional>
Sets the maximum number of query terms that will be included in any generated query.
maxntpNumber <optional>
Sets the maximum number of tokens to parse in each example document field that is not stored with TermVector support.
boostBoolean <optional>
Specifies if the query will be boosted by the interesting term relevance. It can be either "true" or "false".
qfString <optional>
Query fields and their boosts using the same format as that used by the DisMaxRequestHandler. These fields must also be specified in mlt.fl.
countNumber <optional>
Specifies the number of similar documents to be returned for each result. The default value is 5.
matchIncludeBoolean <optional>
Specifies whether or not the response should include the matched document. If set to false, the response will look like a normal select response.
matchOffsetNumber <optional>
Specifies an offset into the main query search results to locate the document on which the MoreLikeThis query should operate. By default, the query operates on the first result for the q parameter.
interestingTermsString <optional>
Controls how the MoreLikeThis component presents the "interesting" terms (the top TF/IDF terms) for the query. ("list"|"details"|"none")
Returns:
- Type
- Query
-
q(params)
-
Set query params
Parameters:
Name Type Description paramsObject | String query object or query string
Properties
Name Type Argument Description strString <optional>
native str query ( ex) '(name:test OR category:test)' )
Returns:
- Type
- Query
-
qop(params)
-
Set default query operator
Parameters:
Name Type Description paramsString default operator('AND'|'OR')
Returns:
- Type
- Query
-
rows(params)
-
Set rows params
Parameters:
Name Type Description paramsNumber size number
Returns:
- Type
- Query
-
sort(params)
-
Set sort params
Parameters:
Name Type Description paramsObject sort options
Returns:
- Type
- Query
-
spellcheckQuery(params)
-
Set spellcheck query params
Parameters:
Name Type Description paramsObject | String spell object or spell string
Properties
Name Type Argument Default Description onBoolean <optional>
true Turn on or off spell
qString <optional>
Selects the query to be spellchecked.
buildBoolean <optional>
Instructs Solr to build a dictionary for use in spellchecking.
collateBoolean <optional>
Causes Solr to build a new query based on the best suggestion for each term in the submitted query.
maxCollationsNumber <optional>
This parameter specifies the maximum number of collations to return.
maxCollationTriesNumber <optional>
This parameter specifies the number of collation possibilities for Solr to try before giving up.
maxCollationEvaluationsNumber <optional>
This parameter specifies the maximum number of word correction combinations to rank and evaluate prior to deciding which collation candidates to test against the index.
collateExtendedResultsBoolean <optional>
If true, returns an expanded response detailing the collations found. If s pellcheck.collate is false, this parameter will be ignored.
collateMaxCollectDocsNumber <optional>
The maximum number of documents to collect when testing potential Collations
countNumber <optional>
Specifies the maximum number of spelling suggestions to be returned.
dictionaryString <optional>
Specifies the dictionary that should be used for spellchecking.
extendedResultsBoolean <optional>
Causes Solr to return additional information about spellcheck results, such as the frequency of each original term in the index (origFreq) as well as the frequency of each suggestion in the index (frequency).
onlyMorePopularBoolean <optional>
Limits spellcheck responses to queries that are more popular than the original query.
maxResultsForSuggestNumber <optional>
The maximum number of hits the request can return in order to both generate spelling suggestions and set the "correctlySpelled" element to "false".
alternativeTermCountNumber <optional>
The count of suggestions to return for each query term existing in the index and/or dictionary.
reloadBoolean <optional>
Reloads the spellchecker.
accuracyNumber <optional>
Specifies an accuracy value to help decide whether a result is worthwhile. The value is a float between 0 and 1.
Returns:
- Type
- Query
-
start(params)
-
Set start params
Parameters:
Name Type Description paramsNumber offset number
Returns:
- Type
- Query
-
termsQuery(params)
-
Set terms query params
Parameters:
Name Type Description paramsObject | String terms object or terms string
Properties
Name Type Argument Default Description onBoolean <optional>
true Turn on or off terms
flString The name of the field to get the terms from.
lowerString <optional>
The term to start at. If not specified, the empty string is used, meaning start at the beginning of the field.
lowerInclBoolean <optional>
The term to start at. Include the lower bound term in the result set. Default is true.
mincountNumber <optional>
The minimum doc frequency to return in order to be included.
maxcountNumber <optional>
The maximum doc frequency.
prefixString <optional>
Restrict matches to terms that start with the prefix.
regexString <optional>
Restrict matches to terms that match the regular expression.
regexFlagString <optional>
Flags to be used when evaluating the regular expression defined in the "terms.regex" parameter.(case_insensitive|comments|multiline|literal|dotall|unicode_case|canon_eq|unix_lines)
limitNumber <optional>
The maximum number of terms to return.
upperString <optional>
The term to stop at. Either upper or terms.limit must be set.
upperInclBoolean <optional>
Include the upper bound term in the result set. Default is false.
rawBoolean <optional>
If true, return the raw characters of the indexed term, regardless of if it is human readable.
sortString <optional>
If count, sorts the terms by the term frequency (highest count first). If index, returns the terms in index order.(count|index)
Returns:
- Type
- Query
-
toString()
-
Make query to string
Returns:
- Type
- String
-
wt(params)
-
Set the response type.
Parameters:
Name Type Description paramsString response type (json|xml)
Returns:
- Type
- Query