UNPKG

nolr

Version:

Solr Node Client with ES6 Support

3,287 lines (1,024 loc) 109 kB
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width"> <title>Documentation Class: Query</title> <!--[if lt IE 9]> <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> <link type="text/css" rel="stylesheet" href="styles/sunlight.default.css"> <link type="text/css" rel="stylesheet" href="styles/site.cerulean.css"> </head> <body> <div class="navbar navbar-default navbar-fixed-top "> <div class="container"> <div class="navbar-header"> <a class="navbar-brand" href="index.html">Documentation</a> <button class="navbar-toggle" type="button" data-toggle="collapse" data-target="#topNavigation"> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> </div> <div class="navbar-collapse collapse" id="topNavigation"> <ul class="nav navbar-nav"> <li class="dropdown"> <a href="classes.list.html" class="dropdown-toggle" data-toggle="dropdown">Classes<b class="caret"></b></a> <ul class="dropdown-menu "> <li><a href="Client.html">Client</a></li><li><a href="Query.html">Query</a></li> </ul> </li> <li class="dropdown"> <a href="global.html" class="dropdown-toggle" data-toggle="dropdown">Global<b class="caret"></b></a> <ul class="dropdown-menu "> <li><a href="global.html#_">_</a></li> </ul> </li> </ul> <div class="col-sm-3 col-md-3"> <form class="navbar-form" role="search"> <div class="input-group"> <input type="text" class="form-control" placeholder="Search" name="q" id="search-input"> <div class="input-group-btn"> <button class="btn btn-default" id="search-submit"><i class="glyphicon glyphicon-search"></i></button> </div> </div> </form> </div> </div> </div> </div> <div class="container" id="toc-content"> <div class="row"> <div class="col-md-8"> <div id="main"> <h1 class="page-title">Class: Query</h1> <section> <header> <h2> Query </h2> </header> <article> <div class="container-overview"> <hr> <dt> <h4 class="name" id="Query"><span class="type-signature"></span>new Query()</h4> </dt> <dd> <div class="description"> <p>Solr Query</p> </div> <dl class="details"> </dl> </dd> </div> <h3 class="subsection-title">Methods</h3> <dl> <hr> <dt> <h4 class="name" id="addParams"><span class="type-signature"></span>addParams(params)</h4> </dt> <dd> <div class="description"> <p>Add params</p> </div> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>params</code></td> <td class="type"> <span class="param-type">Array.&lt;Object></span> </td> <td class="description last"> <h6 class="method-params-label method-subparams-label">Properties</h6> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>field</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last"><p>params field</p></td> </tr> <tr> <td class="name"><code>value</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last"><p>params value</p></td> </tr> </tbody> </table> </td> </tr> </tbody> </table> <dl class="details"> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type"><a href="Query.html">Query</a></span> </dd> </dl> </dd> <hr> <dt> <h4 class="name" id="df"><span class="type-signature"></span>df(params)</h4> </dt> <dd> <div class="description"> <p>Set the default query field.</p> </div> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>params</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last"><p>default field for search</p></td> </tr> </tbody> </table> <dl class="details"> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type"><a href="Query.html">Query</a></span> </dd> </dl> </dd> <hr> <dt> <h4 class="name" id="dismax"><span class="type-signature"></span>dismax()</h4> </dt> <dd> <div class="description"> <p>Set DisMax query parser</p> </div> <dl class="details"> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type"><a href="Query.html">Query</a></span> </dd> </dl> </dd> <hr> <dt> <h4 class="name" id="edismax"><span class="type-signature"></span>edismax()</h4> </dt> <dd> <div class="description"> <p>Set eDisMax query parser</p> </div> <dl class="details"> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type"><a href="Query.html">Query</a></span> </dd> </dl> </dd> <hr> <dt> <h4 class="name" id="facetQuery"><span class="type-signature"></span>facetQuery(params)</h4> </dt> <dd> <div class="description"> <p>Set facet query params</p> </div> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>params</code></td> <td class="type"> <span class="param-type">Object</span> | <span class="param-type">String</span> </td> <td class="description last"><p>facet object or facet string</p> <h6 class="method-params-label method-subparams-label">Properties</h6> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Argument</th> <th>Default</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>on</code></td> <td class="type"> <span class="param-type">Boolean</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="default"> true </td> <td class="description last"><p>Turn on or off facet</p></td> </tr> <tr> <td class="name"><code>query</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="default"> </td> <td class="description last"><p>Specifies a Lucene query to generate a facet count.</p></td> </tr> <tr> <td class="name"><code>field</code></td> <td class="type"> <span class="param-type">String</span> | <span class="param-type">Array</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="default"> </td> <td class="description last"><p>Identifies a field to be treated as a facet.</p></td> </tr> <tr> <td class="name"><code>prefix</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="default"> </td> <td class="description last"><p>Limits the terms used for faceting to those that begin with the specified prefix.</p></td> </tr> <tr> <td class="name"><code>contains</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="default"> </td> <td class="description last"><p>Limits the terms used for faceting to those that contain the specified substring.</p></td> </tr> <tr> <td class="name"><code>containsIgnoreCase</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="default"> </td> <td class="description last"><p>If facet.contains is used, ignore case when searching for the specified substring.</p></td> </tr> <tr> <td class="name"><code>sort</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="default"> </td> <td class="description last"><p>Controls how faceted results are sorted. (count|index)</p></td> </tr> <tr> <td class="name"><code>limit</code></td> <td class="type"> <span class="param-type">Number</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="default"> </td> <td class="description last"><p>Controls how many constraints should be returned for each facet.</p></td> </tr> <tr> <td class="name"><code>offset</code></td> <td class="type"> <span class="param-type">Number</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="default"> </td> <td class="description last"><p>Specifies an offset into the facet results at which to begin displaying facets.</p></td> </tr> <tr> <td class="name"><code>mincount</code></td> <td class="type"> <span class="param-type">Number</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="default"> </td> <td class="description last"><p>Specifies the minimum counts required for a facet field to be included in the response.</p></td> </tr> <tr> <td class="name"><code>missing</code></td> <td class="type"> <span class="param-type">Boolean</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="default"> </td> <td class="description last"><p>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.</p></td> </tr> <tr> <td class="name"><code>method</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="default"> </td> <td class="description last"><p>Selects the algorithm or method Solr should use when faceting a field. (enum|fc|fcs)</p></td> </tr> </tbody> </table> </td> </tr> </tbody> </table> <dl class="details"> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type"><a href="Query.html">Query</a></span> </dd> </dl> </dd> <hr> <dt> <h4 class="name" id="fl"><span class="type-signature"></span>fl(params)</h4> </dt> <dd> <div class="description"> <p>Set field params</p> </div> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>params</code></td> <td class="type"> <span class="param-type">String</span> | <span class="param-type">Array.&lt;String></span> </td> <td class="description last"><p>field name</p></td> </tr> </tbody> </table> <dl class="details"> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type"><a href="Query.html">Query</a></span> </dd> </dl> </dd> <hr> <dt> <h4 class="name" id="fq"><span class="type-signature"></span>fq(params)</h4> </dt> <dd> <div class="description"> <p>Set filter query params</p> </div> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>params</code></td> <td class="type"> <span class="param-type">Object</span> | <span class="param-type">Array.&lt;Object></span> </td> <td class="description last"><p>filter options</p> <h6 class="method-params-label method-subparams-label">Properties</h6> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Argument</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>field</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="description last"><p>filter field</p></td> </tr> <tr> <td class="name"><code>value</code></td> <td class="type"> <span class="param-type">String</span> | <span class="param-type">Number</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="description last"><p>filter value</p></td> </tr> </tbody> </table> </td> </tr> </tbody> </table> <dl class="details"> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type"><a href="Query.html">Query</a></span> </dd> </dl> </dd> <hr> <dt> <h4 class="name" id="groupQuery"><span class="type-signature"></span>groupQuery(params)</h4> </dt> <dd> <div class="description"> <p>Set group query params</p> </div> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>params</code></td> <td class="type"> <span class="param-type">Object</span> | <span class="param-type">String</span> </td> <td class="description last"><p>group object or group string</p> <h6 class="method-params-label method-subparams-label">Properties</h6> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Argument</th> <th>Default</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>on</code></td> <td class="type"> <span class="param-type">Boolean</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="default"> true </td> <td class="description last"><p>Turn on or off group</p></td> </tr> <tr> <td class="name"><code>field</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="default"> </td> <td class="description last"><p>The name of the field by which to group results.</p></td> </tr> <tr> <td class="name"><code>query</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="default"> </td> <td class="description last"><p>Return a single group of documents that match the given query.</p></td> </tr> <tr> <td class="name"><code>limit</code></td> <td class="type"> <span class="param-type">Number</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="default"> </td> <td class="description last"><p>Specifies the number of results to return for each group. The default value is 1.</p></td> </tr> <tr> <td class="name"><code>offset</code></td> <td class="type"> <span class="param-type">Number</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="default"> </td> <td class="description last"><p>Specifies an initial offset for the document list of each group.</p></td> </tr> <tr> <td class="name"><code>sort</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="default"> </td> <td class="description last"><p>Specifies how Solr sorts documents within each group.</p></td> </tr> <tr> <td class="name"><code>format</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="default"> </td> <td class="description last"><p>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.</p></td> </tr> <tr> <td class="name"><code>main</code></td> <td class="type"> <span class="param-type">Boolean</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="default"> </td> <td class="description last"><p>If true, the result of the first field grouping command is used as the main result list in the response, using group.format=simple.</p></td> </tr> <tr> <td class="name"><code>ngroups</code></td> <td class="type"> <span class="param-type">Boolean</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="default"> </td> <td class="description last"><p>If true, Solr includes the number of groups that have matched the query in the results. The default value is false.</p></td> </tr> <tr> <td class="name"><code>truncate</code></td> <td class="type"> <span class="param-type">Boolean</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="default"> </td> <td class="description last"><p>If true, facet counts are based on the most relevant document of each group matching the query. The default value is false.</p></td> </tr> <tr> <td class="name"><code>facet</code></td> <td class="type"> <span class="param-type">Boolean</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="default"> </td> <td class="description last"><p>Determines whether to compute grouped facets for the field facets specified in facet.field parameters.</p></td> </tr> <tr> <td class="name"><code>cachePercent</code></td> <td class="type"> <span class="param-type">Number</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="default"> </td> <td class="description last"><p>Determines whether to compute grouped facets for the field facets specified in facet.field parameters.</p></td> </tr> </tbody> </table> </td> </tr> </tbody> </table> <dl class="details"> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type"><a href="Query.html">Query</a></span> </dd> </dl> </dd> <hr> <dt> <h4 class="name" id="hlQuery"><span class="type-signature"></span>hlQuery(params)</h4> </dt> <dd> <div class="description"> <p>Set hl query params</p> </div> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>params</code></td> <td class="type"> <span class="param-type">Object</span> | <span class="param-type">String</span> </td> <td class="description last"><p>hl object or hl string</p> <h6 class="method-params-label method-subparams-label">Properties</h6> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Argument</th> <th>Default</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>on</code></td> <td class="type"> <span class="param-type">Boolean</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="default"> true </td> <td class="description last"><p>Turn on or off hl</p></td> </tr> <tr> <td class="name"><code>q</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="default"> </td> <td class="description last"><p>Specifies an overriding query term for highlighting</p></td> </tr> <tr> <td class="name"><code>qparser</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="default"> </td> <td class="description last"><p>Specifies a qparser to use for the hl.q query.</p></td> </tr> <tr> <td class="name"><code>fl</code></td> <td class="type"> <span class="param-type">String</span> | <span class="param-type">Array</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="default"> </td> <td class="description last"><p>Specifies a list of fields to highlight.</p></td> </tr> <tr> <td class="name"><code>snippets</code></td> <td class="type"> <span class="param-type">Number</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="default"> </td> <td class="description last"><p>Specifies maximum number of highlighted snippets to generate per field.</p></td> </tr> <tr> <td class="name"><code>fragsize</code></td> <td class="type"> <span class="param-type">Number</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="default"> </td> <td class="description last"><p>Specifies the size, in characters, of fragments to consider for highlighting.</p></td> </tr> <tr> <td class="name"><code>mergeContiguous</code></td> <td class="type"> <span class="param-type">Boolean</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="default"> </td> <td class="description last"><p>Instructs Solr to collapse contiguous fragments into a single fragment.</p></td> </tr> <tr> <td class="name"><code>requireFieldMatch</code></td> <td class="type"> <span class="param-type">Boolean</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="default"> </td> <td class="description last"><p>If set to true, highlights terms only if they appear in the specified field.</p></td> </tr> <tr> <td class="name"><code>maxAnalyzedChars</code></td> <td class="type"> <span class="param-type">Number</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="default"> </td> <td class="description last"><p>Specifies the number of characters into a document that Solr should look for suitable snippets.</p></td> </tr> <tr> <td class="name"><code>maxMultiValuedToExamine</code></td> <td class="type"> <span class="param-type">Number</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="default"> </td> <td class="description last"><p>Specifies the maximum number of entries in a multi-valued field to examine before stopping.</p></td> </tr> <tr> <td class="name"><code>maxMultiValuedToMatch</code></td> <td class="type"> <span class="param-type">Number</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="default"> </td> <td class="description last"><p>Specifies the maximum number of matches in a multi-valued field that are found before stopping.</p></td> </tr> <tr> <td class="name"><code>alternateField</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="default"> </td> <td class="description last"><p>Specifies a field to be used as a backup default summary if Solr cannot generate a snippet (i.e., because no terms match).</p></td> </tr> <tr> <td class="name"><code>maxAlternateFieldLength</code></td> <td class="type"> <span class="param-type">Number</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="default"> </td> <td class="description last"><p>Specifies the maximum number of characters of the field to return.</p></td> </tr> <tr> <td class="name"><code>formatter</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="default"> simple </td> <td class="description last"><p>Selects a formatter for the highlighted output.</p></td> </tr> <tr> <td class="name"><code>simplePre</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="default"> </td> <td class="description last"><p>Specifies the text that should appear before. (<em>)</p></td> </tr> <tr> <td class="name"><code>simplePost</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="default"> </td> <td class="description last"><p>Specifies the text that should appear after. (</em>)</p></td> </tr> <tr> <td class="name"><code>fragmenter</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="default"> </td> <td class="description last"><p>Specifies a text snippet generator for highlighted text.</p></td> </tr> <tr> <td class="name"><code>usePhraseHighlighter</code></td> <td class="type"> <span class="param-type">Boolean</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="default"> </td> <td class="description last"><p>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.</p></td> </tr> <tr> <td class="name"><code>highlightMultiTerm</code></td> <td class="type"> <span class="param-type">Boolean</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="default"> </td> <td class="description last"><p>If set to true, Solr will use highlight phrase terms that appear in multi-term queries.</p></td> </tr> <tr> <td class="name"><code>regexSlop</code></td> <td class="type"> <span class="param-type">Number</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="default">