lunr-elastic-search
Version:
Uses Lunr.js to index and search the knowledge base.
3,428 lines (1,080 loc) • 75.5 kB
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Class: LunrSearch | lunr-elastic-search</title>
<script src="scripts/prettify/prettify.js"> </script>
<script src="scripts/prettify/lang-css.js"> </script>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="styles/bootstrap.min.css">
<link type="text/css" rel="stylesheet" href="styles/prettify-jsdoc.css">
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
<link type="text/css" rel="stylesheet" href="styles/tui-doc.css">
</head>
<body>
<nav class="lnb" id="lnb">
<div class="logo" style="">
<img src="img/toast-ui.png" width="100%" height="100%">
</div>
<div class="title">
<h1><a href="index.html" class="link">lunr-elastic-search</a></h1>
</div>
<div class="search-container" id="search-container">
<input type="text" placeholder="Search">
<ul></ul>
</div>
<div class="lnb-api hidden"><h3>Classes</h3><ul><li><a href="LunrSearch.html">LunrSearch</a><button type="button" class="hidden toggle-subnav btn btn-link"> <span class="glyphicon glyphicon-plus"></span></button><div class="hidden" id="LunrSearch_sub"><div class="member-type">Members</div><ul class="inner"><li><a href="LunrSearch.html#.VERSION">VERSION</a></li><li><a href="LunrSearch.html#builder">builder</a></li><li><a href="LunrSearch.html#docs">docs</a></li><li><a href="LunrSearch.html#domain">domain</a></li><li><a href="LunrSearch.html#editDistance">editDistance</a></li><li><a href="LunrSearch.html#index">index</a></li><li><a href="LunrSearch.html#pass">pass</a></li><li><a href="LunrSearch.html#plugins">plugins</a></li><li><a href="LunrSearch.html#user">user</a></li></ul><div class="member-type">Methods</div><ul class="inner"><li><a href="LunrSearch.html#.buildIndex">buildIndex</a></li><li><a href="LunrSearch.html#.exportIndex">exportIndex</a></li><li><a href="LunrSearch.html#.fetch">fetch</a></li><li><a href="LunrSearch.html#.getIndex">getIndex</a></li><li><a href="LunrSearch.html#.importIndex">importIndex</a></li><li><a href="LunrSearch.html#.isSupported">isSupported</a></li><li><a href="LunrSearch.html#.postIndex">postIndex</a></li><li><a href="LunrSearch.html#.search">search</a></li><li><a href="LunrSearch.html#buildIndex">buildIndex</a></li><li><a href="LunrSearch.html#exportIndex">exportIndex</a></li><li><a href="LunrSearch.html#fetch">fetch</a></li><li><a href="LunrSearch.html#getIndex">getIndex</a></li><li><a href="LunrSearch.html#importIndex">importIndex</a></li><li><a href="LunrSearch.html#postIndex">postIndex</a></li><li><a href="LunrSearch.html#search">search</a></li></ul><div class="member-type">Typedef</div><ul class="inner"><li><a href="LunrSearch.html#.Plugin">Plugin</a></li><li><a href="LunrSearch.html#.Result">Result</a></li></ul></div></li></ul></div><div class="lnb-api hidden"><h3>Namespaces</h3><ul><li><a href="plugin.html">plugin</a><button type="button" class="hidden toggle-subnav btn btn-link"> <span class="glyphicon glyphicon-plus"></span></button><div class="hidden" id="plugin_sub"></div></li><li><a href="plugin.freshdesk.html">plugin.freshdesk</a><button type="button" class="hidden toggle-subnav btn btn-link"> <span class="glyphicon glyphicon-plus"></span></button><div class="hidden" id="plugin.freshdesk_sub"><div class="member-type">Methods</div><ul class="inner"><li><a href="plugin.freshdesk.html#.fetch">fetch</a></li><li><a href="plugin.freshdesk.html#.isSupported">isSupported</a></li><li><a href="plugin.freshdesk.html#.plugin">plugin</a></li><li><a href="plugin.freshdesk.html#.process">process</a></li></ul></div></li><li><a href="util.html">util</a><button type="button" class="hidden toggle-subnav btn btn-link"> <span class="glyphicon glyphicon-plus"></span></button><div class="hidden" id="util_sub"><div class="member-type">Methods</div><ul class="inner"><li><a href="util.html#.definedFunction">definedFunction</a></li></ul></div></li></ul></div>
</nav>
<div id="resizer"></div>
<div class="main" id="main">
<section>
<header>
<h2><span class="attribs"><span class="type-signature"></span></span>LunrSearch<span class="signature">(domain, user, pass, options<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span></h2>
</header>
<article>
<div class="container-overview">
<dt>
<h4 class="name" id="LunrSearch">
new <span class="type-signature"></span>LunrSearch<span class="signature">(domain, user, pass, options<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span>
<div class="container-source members">
<code><a href="lunr.js.html">lunr.js</a></code>,
<code><a href="lunr.js.html#line31">line 31</a></code>
</div>
</h4>
</dt>
<dd>
<div class="description">
<p>A class to handle building, importing, exporting, and searching a lunr index.
It contains static and instance methods of each function so you can choose how to use it.</p>
</div>
<div class="container-params">
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th>Default</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>domain</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last"><p>the domain to use for all fetch requests</p></td>
</tr>
<tr>
<td class="name"><code>user</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last"><p>the username to use for all fetch requests</p></td>
</tr>
<tr>
<td class="name"><code>pass</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last"><p>the password to use for all fetch requests</p></td>
</tr>
<tr>
<td class="name"><code>options</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="default">
{}
</td>
<td class="description last">
<h6>Properties</h6>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th>Default</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>builder</code></td>
<td class="type">
<span class="param-type">lunr.Builder</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="default">
</td>
<td class="description last"><p>a custom builder to use instead of creating a new instance</p></td>
</tr>
<tr>
<td class="name"><code>plugins</code></td>
<td class="type">
<span class="param-type">Array.<Plugin></span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="default">
</td>
<td class="description last"><p>a list of plugins to use</p></td>
</tr>
<tr>
<td class="name"><code>editDistance</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="default">
1
</td>
<td class="description last"><p>a default edit distance to use in search queries</p></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
<dl class="details">
</dl>
<h5>Examples</h5>
<p class="code-caption">Instance usage</p>
<pre class="prettyprint"><code>const builder = new lunr.Builder() // if you need to,
builder.metadataWhitelist = ['tags'] // you can customize the builder that will be used internally
const lunrSearch = new LunrSearch('myfreshdeskdomain', 'freshdeskusername', 'freshdeskpassword', {
builder, // pass the custom builder if needed
plugins: [myCustomBuilderPlugin],
editDistance: 2 // in case your users can't type very well :)
})
lunrSearch.buildIndex().then(() => mySearchBar.addEventListener('input', () => lunrSeach.search(mySearchBar.value))</code></pre>
<p class="code-caption">Static usage</p>
<pre class="prettyprint"><code>const opts = {domain: 'freshdeskdomain', user: 'username', pass: 'password'}
const builder = new lunr.Builder() // custom builder, etc.
const indexPromise = LunrSearch.buildIndex({builder, ...opts}) // you can pass a custom builder into the static methods too
indexPromise.then(() => mySearchBar.addEventListener('input', () => lunrSeach.search(mySearchBar.value))</code></pre>
</dd>
</div>
<h3 class="subsection-title">Members</h3>
<dl>
<dt>
<h4 class="name" id=".VERSION">
<span class="type-signature"><span class="icon green">static</span> </span>VERSION<span class="type-signature"> :string</span>
<div class="container-source members">
<code><a href="lunr.js.html">lunr.js</a></code>,
<code><a href="lunr.js.html#line69">line 69</a></code>
</div>
</h4>
</dt>
<dd>
<div class="description">
<p>The package version.</p>
</div>
<!--
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">string</span>
</li>
</ul>
-->
<dl class="details">
</dl>
</dd>
<dt>
<h4 class="name" id="builder">
<span class="type-signature"></span>builder<span class="type-signature"> :lunr.Builder</span>
<div class="container-source members">
<code><a href="lunr.js.html">lunr.js</a></code>,
<code><a href="lunr.js.html#line115">line 115</a></code>
</div>
</h4>
</dt>
<dd>
<div class="description">
<p>a custom builder to use</p>
</div>
<!--
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">lunr.Builder</span>
</li>
</ul>
-->
<dl class="details">
</dl>
</dd>
<dt>
<h4 class="name" id="docs">
<span class="type-signature"></span>docs<span class="type-signature"> :Object</span>
<div class="container-source members">
<code><a href="lunr.js.html">lunr.js</a></code>,
<code><a href="lunr.js.html#line77">line 77</a></code>
</div>
</h4>
</dt>
<dd>
<div class="description">
<p>the fetched documents
the keys are the document ID and the value is the document.
useful for getting info about a search result.</p>
</div>
<!--
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">Object</span>
</li>
</ul>
-->
<dl class="details">
</dl>
</dd>
<dt>
<h4 class="name" id="domain">
<span class="type-signature"></span>domain<span class="type-signature"> :string</span>
<div class="container-source members">
<code><a href="lunr.js.html">lunr.js</a></code>,
<code><a href="lunr.js.html#line88">line 88</a></code>
</div>
</h4>
</dt>
<dd>
<div class="description">
<p>the domain to use for all fetch requests</p>
</div>
<!--
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">string</span>
</li>
</ul>
-->
<dl class="details">
</dl>
</dd>
<dt>
<h4 class="name" id="editDistance">
<span class="type-signature"></span>editDistance<span class="type-signature"> :number</span>
<div class="container-source members">
<code><a href="lunr.js.html">lunr.js</a></code>,
<code><a href="lunr.js.html#line133">line 133</a></code>
</div>
</h4>
</dt>
<dd>
<div class="description">
<p>a default edit distance to use in search queries</p>
</div>
<!--
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">number</span>
</li>
</ul>
-->
<dl class="details">
<dt class="tag-default">Default Value:</dt>
<dd class="tag-default"><ul class="dummy">
<li>0</li>
</ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="index">
<span class="type-signature"></span>index<span class="type-signature"> :lunr.Index</span>
<div class="container-source members">
<code><a href="lunr.js.html">lunr.js</a></code>,
<code><a href="lunr.js.html#line143">line 143</a></code>
</div>
</h4>
</dt>
<dd>
<div class="description">
<p>The built lunr index.</p>
</div>
<!--
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">lunr.Index</span>
</li>
</ul>
-->
<dl class="details">
</dl>
</dd>
<dt>
<h4 class="name" id="pass">
<span class="type-signature"></span>pass<span class="type-signature"> :string</span>
<div class="container-source members">
<code><a href="lunr.js.html">lunr.js</a></code>,
<code><a href="lunr.js.html#line106">line 106</a></code>
</div>
</h4>
</dt>
<dd>
<div class="description">
<p>the password to use for all fetch requests</p>
</div>
<!--
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">string</span>
</li>
</ul>
-->
<dl class="details">
</dl>
</dd>
<dt>
<h4 class="name" id="plugins">
<span class="type-signature"></span>plugins<span class="type-signature"> :Array.<Plugin></span>
<div class="container-source members">
<code><a href="lunr.js.html">lunr.js</a></code>,
<code><a href="lunr.js.html#line124">line 124</a></code>
</div>
</h4>
</dt>
<dd>
<div class="description">
<p>a list of plugins to use</p>
</div>
<!--
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">Array.<Plugin></span>
</li>
</ul>
-->
<dl class="details">
</dl>
</dd>
<dt>
<h4 class="name" id="user">
<span class="type-signature"></span>user<span class="type-signature"> :string</span>
<div class="container-source members">
<code><a href="lunr.js.html">lunr.js</a></code>,
<code><a href="lunr.js.html#line97">line 97</a></code>
</div>
</h4>
</dt>
<dd>
<div class="description">
<p>the username to use for all fetch requests</p>
</div>
<!--
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">string</span>
</li>
</ul>
-->
<dl class="details">
</dl>
</dd>
</dl>
<h3 class="subsection-title">Methods</h3>
<dl>
<dt>
<h4 class="name" id=".buildIndex">
<span class="type-signature"><span class="icon green">async</span>, <span class="icon green">static</span> </span>buildIndex<span class="signature">(options<span class="signature-attributes">opt</span>)</span><span class="type-signature"> → {lunr.Index}</span>
<div class="container-source members">
<code><a href="lunr.js.html">lunr.js</a></code>,
<code><a href="lunr.js.html#line368">line 368</a></code>
</div>
</h4>
</dt>
<dd>
<div class="description">
<p>Builds an index and returns it.
If no docs are supplied, they will be fetched.</p>
</div>
<div class="container-params">
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th>Default</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>options</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="default">
{}
</td>
<td class="description last">
<h6>Properties</h6>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>domain</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="description last"><p>the domain of the API to make the request to</p></td>
</tr>
<tr>
<td class="name"><code>user</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="description last"><p>the username for the API</p></td>
</tr>
<tr>
<td class="name"><code>pass</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="description last"><p>the password for the API</p></td>
</tr>
<tr>
<td class="name"><code>docs</code></td>
<td class="type">
<span class="param-type">Array.<Object></span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="description last"><p>list of docs to build the index with</p></td>
</tr>
<tr>
<td class="name"><code>builder</code></td>
<td class="type">
<span class="param-type">lunr.Builder</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="description last"><p>the builder to use for building the index</p></td>
</tr>
<tr>
<td class="name"><code>plugins</code></td>
<td class="type">
<span class="param-type">Array.<Plugin></span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="description last"><p>a list of plugins</p></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
<div class="container-returns">
<h5>Returns:</h5>
<span class="param-type">lunr.Index</span>
- <p>the built index</p>
</div>
<dl class="details">
</dl>
</dd>
<dt>
<h4 class="name" id=".exportIndex">
<span class="type-signature"><span class="icon green">async</span>, <span class="icon green">static</span> </span>exportIndex<span class="signature">(options<span class="signature-attributes">opt</span>)</span><span class="type-signature"> → {string}</span>
<div class="container-source members">
<code><a href="lunr.js.html">lunr.js</a></code>,
<code><a href="lunr.js.html#line342">line 342</a></code>
</div>
</h4>
</dt>
<dd>
<div class="description">
<p>Builds then serializes and exports a lunr index.</p>
</div>
<div class="container-params">
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th>Default</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>options</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="default">
{}
</td>
<td class="description last">
<h6>Properties</h6>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>domain</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="description last"><p>the domain of the API to make the request to</p></td>
</tr>
<tr>
<td class="name"><code>user</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="description last"><p>the username for the API</p></td>
</tr>
<tr>
<td class="name"><code>pass</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="description last"><p>the password for the API</p></td>
</tr>
<tr>
<td class="name"><code>builder</code></td>
<td class="type">
<span class="param-type">lunr.Builder</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="description last"><p>the builder to use for building the index</p></td>
</tr>
<tr>
<td class="name"><code>plugins</code></td>
<td class="type">
<span class="param-type">Array.<function()></span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="description last"><p>a list of plugins for the builder to use</p></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
<div class="container-returns">
<h5>Returns:</h5>
<span class="param-type">string</span>
- <p>the serialized index</p>
</div>
<dl class="details">
</dl>
</dd>
<dt>
<h4 class="name" id=".fetch">
<span class="type-signature"><span class="icon green">async</span>, <span class="icon green">static</span> </span>fetch<span class="signature">(options<span class="signature-attributes">opt</span>)</span><span class="type-signature"> → {Array.<Object>}</span>
<div class="container-source members">
<code><a href="lunr.js.html">lunr.js</a></code>,
<code><a href="lunr.js.html#line397">line 397</a></code>
</div>
</h4>
</dt>
<dd>
<div class="description">
<p>Fetches some documents that are ready to be indexed.</p>
</div>
<div class="container-params">
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th>Default</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>options</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="default">
{}
</td>
<td class="description last">
<h6>Properties</h6>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>domain</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="description last"><p>the domain of the API to make the request to</p></td>
</tr>
<tr>
<td class="name"><code>user</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="description last"><p>the username for the API</p></td>
</tr>
<tr>
<td class="name"><code>pass</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="description last"><p>the password for the API</p></td>
</tr>
<tr>
<td class="name"><code>plugins</code></td>
<td class="type">
<span class="param-type">Array.<Plugin></span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="description last"><p>a list of plugins</p></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
<div class="container-returns">
<h5>Returns:</h5>
<span class="param-type">Array.<Object></span>
- <p>the array of Objects to be indexed</p>
</div>
<dl class="details">
</dl>
</dd>
<dt>
<h4 class="name" id=".getIndex">
<span class="type-signature"><span class="icon green">async</span>, <span class="icon green">static</span> </span>getIndex<span class="signature">(url, auth<span class="signature-attributes">opt</span>)</span><span class="type-signature"> → {lunr.Index}</span>
<div class="container-source members">
<code><a href="lunr.js.html">lunr.js</a></code>,
<code><a href="lunr.js.html#line295">line 295</a></code>
</div>
</h4>
</dt>
<dd>
<div class="description">
<p>Gets and imports an index fram a URL.</p>
</div>
<div class="container-params">
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th>Default</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>url</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last"><p>the URL of the endpoint</p></td>
</tr>
<tr>
<td class="name"><code>auth</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="default">
{}
</td>
<td class="description last"><p>authentication details for the API</p>
<h6>Properties</h6>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>user</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="description last"><p>the username for the API</p></td>
</tr>
<tr>
<td class="name"><code>pass</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="description last"><p>the password for the API</p></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
<div class="container-returns">
<h5>Returns:</h5>
<span class="param-type">lunr.Index</span>
</div>
<dl class="details">
</dl>
</dd>
<dt>
<h4 class="name" id=".importIndex">
<span class="type-signature"><span class="icon green">static</span> </span>importIndex<span class="signature">(json)</span><span class="type-signature"> → {lunr.Index}</span>
<div class="container-source members">
<code><a href="lunr.js.html">lunr.js</a></code>,
<code><a href="lunr.js.html#line307">line 307</a></code>
</div>
</h4>
</dt>
<dd>
<div class="description">
<p>Imports an exported lunr index and returns it.</p>
</div>
<div class="container-params">
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>json</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last"><p>the stringified index to import</p></td>
</tr>
</tbody>
</table>
</div>
<div class="container-returns">
<h5>Returns:</h5>
<span class="param-type">lunr.Index</span>
</div>
<dl class="details">
</dl>
</dd>
<dt>
<h4 class="name" id=".isSupported">
<span class="type-signature"><span class="icon green">static</span> </span>isSupported<span class="signature">(plugins<span class="signature-attributes">opt</span>)</span><span class="type-signature"> → {Boolean}</span>
<div class="container-source members">
<code><a href="lunr.js.html">lunr.js</a></code>,
<code><a href="lunr.js.html#line420">line 420</a></code>
</div>
</h4>
</dt>
<dd>
<div class="description">
<p>Checks to see if certain functions are defined.</p>
</div>
<div class="container-params">
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>plugins</code></td>
<td class="type">
<span class="param-type">Array.<Plugin></span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="description last"><p>a list of plugins</p></td>
</tr>
</tbody>
</table>
</div>
<div class="container-returns">
<h5>Returns:</h5>
<span class="param-type">Boolean</span>
</div>
<dl class="details">
</dl>
</dd>
<dt>
<h4 class="name" id=".postIndex">
<span class="type-signature"><span class="icon green">async</span>, <span class="icon green">static</span> </span>postIndex<span class="signature">(index, url, auth<span class="signature-attributes">opt</span>)</span><span class="type-signature"> → {axios.Response}</span>
<div class="container-source members">
<code><a href="lunr.js.html">lunr.js</a></code>,
<code><a href="lunr.js.html#line324">line 324</a></code>
</div>
</h4>
</dt>
<dd>
<div class="description">
<p>Posts an exported index to a URL.</p>
</div>
<div class="container-params">
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th>Default</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>index</code></td>
<td class="type">
<span class="param-type">lunr.Index</span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last"><p>the index to be posted</p></td>
</tr>
<tr>
<td class="name"><code>url</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last"><p>the URL of the endpoint</p></td>
</tr>
<tr>
<td class="name"><code>auth</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="default">
{}
</td>
<td class="description last"><p>authentication details for the API</p>
<h6>Properties</h6>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>user</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="description last"><p>the username for the API</p></td>
</tr>
<tr>
<td class="name"><code>pass</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="description last"><p>the password for the API</p></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
<div class="container-returns">
<h5>Returns:</h5>
<span class="param-type">axios.Response</span>
</div>
<dl class="details">
</dl>
</dd>
<dt>
<h4 class="name" id=".search">
<span class="type-signature"><span class="icon green">static</span> </span>search<span class="signature">(query, index, options<span class="signature-attributes">opt</span>)</span><span class="type-signature"> → {Array.<Result>}</span>
<div class="container-source members">
<code><a href="lunr.js.html">lunr.js</a></code>,
<code><a href="lunr.js.html#line279">line 279</a></code>
</div>
</h4>
</dt>
<dd>
<div class="description">
<p>Searches the given index with the given query.
If query is falsey no search is performed.</p>
</div>
<div class="container-params">
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th>Default</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>query</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last"><p>the query to search with</p></td>
</tr>
<tr>
<td class="name"><code>index</code></td>
<td class="type">