document_store.js.html 28.9 KB
Newer Older
Alexandra Rogova's avatar
Alexandra Rogova committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559
<!DOCTYPE html>
<html>
  <head>
    <meta name="viewport" content="width=device-width" charset="utf-8">
    <title>elasticlunr</title>
    <link rel="stylesheet" href="http://getbootstrap.com/2.3.2/assets/css/bootstrap.css">
    <link rel="stylesheet" href="http://getbootstrap.com/2.3.2/assets/css/bootstrap-responsive.css">
    <link rel="stylesheet" href="http://getbootstrap.com/2.3.2/assets/css/docs.css">
    <style>
      body > .navbar .brand {
        float:left;
        text-shadow: rgba(255, 255, 255, 0.0980392) 0px 1px 0px, rgba(255, 255, 255, 0.4) 0px 0px 30px;
        color: white;
        margin-left:0px;
        font-weight:normal;
      }
      
      .bs-docs-sidenav.affix {
        box-shadow: 0 0 20px 1px rgba(0, 0, 0, 0.5);
        z-index: 10;
      }
      
      .bs-docs-sidenav i{
        width: 8px;
        height: 8px;
        padding: 0px;
        margin: 0px;
        display: inline-block;
        margin-right:0.5em;
      }
      
      .bs-docs-sidenav > li > a {
          word-wrap: break-word;
      }
      
      .bs-docs-sidenav > li:first-child > a {
        border-top-right-radius: 6px;
        border-top-left-radius: 6px;
      }
      
      code[class*="language-"],pre[class*="language-"]{color:black;text-shadow:0 1px white;font-family:Consolas,Monaco,'Andale Mono',monospace;direction:ltr;text-align:left;white-space:pre;word-spacing:normal;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-hyphens:none;-moz-hyphens:none;-ms-hyphens:none;hyphens:none}pre[class*="language-"]{padding:1em;margin:.5em 0;overflow:auto}:not(pre)>code[class*="language-"],pre[class*="language-"]{background:#f5f2f0}:not(pre)>code[class*="language-"]{padding:.1em;border-radius:.3em}.token.comment,.token.prolog,.token.doctype,.token.cdata{color:slategray}.token.punctuation{color:#999}.namespace{opacity:.7}.token.property,.token.tag,.token.boolean,.token.number{color:#905}.token.selector,.token.attr-name,.token.string{color:#690}.token.operator,.token.entity,.token.url,.language-css .token.string,.style .token.string{color:#a67f59;background:hsla(0,0%,100%,.5)}.token.atrule,.token.attr-value,.token.keyword{color:#07a}.token.regex,.token.important{color:#e90}.token.important{font-weight:bold}.token.entity{cursor:help}
      div.description {margin: 14px 0; padding-top: 14px; border-bottom:1px solid #eee; }
      .tags {}
      .ctx-type {
        display:inline-block;
        margin-right:0.5em;
        //- float:right; margin-top:8px
      }
      
      footer iframe{vertical-align:middle;}
      
    </style>
  </head>
  <body data-spy="scroll" data-target=".scrollspy">
    <div class="navbar navbar-inverse navbar-fixed-top">
      <div class="navbar-inner">
        <div class="container"><a class="brand">Doxx</a>
          <div class="nav-collapse collapse">
            <ul class="nav pull-right sponsored"></ul>
          </div>
        </div>
      </div>
    </div>
    <header id="overview" class="jumbotron subhead">
      <div class="container">
        <h1>elasticlunr</h1>
        <p class="lead"></p>
      </div>
    </header>
    <div class="container">
      <div class="row">
        <div class="span3 bs-docs-sidebar">
          <ul class="nav nav-list bs-docs-sidenav affix-top">
            <li><a href="index.html">Main</a></li>
            <li><a href="configuration.js.html">configuration.js</a></li>
            <li class="active"><a href="document_store.js.html">document_store.js</a></li>
            <li><a href="elasticlunr.js.html">elasticlunr.js</a></li>
            <li><a href="event_emitter.js.html">event_emitter.js</a></li>
            <li><a href="index.js.html">index.js</a></li>
            <li><a href="inverted_index.js.html">inverted_index.js</a></li>
            <li><a href="pipeline.js.html">pipeline.js</a></li>
            <li><a href="sorted_set.js.html">sorted_set.js</a></li>
            <li><a href="stemmer.js.html">stemmer.js</a></li>
            <li><a href="stop_word_filter.js.html">stop_word_filter.js</a></li>
            <li><a href="tokenizer.js.html">tokenizer.js</a></li>
            <li><a href="trimmer.js.html">trimmer.js</a></li>
            <li><a href="utils.js.html">utils.js</a></li>
          </ul>
          <div class="scrollspy">
            <ul class="nav nav-list bs-docs-sidenav affix-top">
              <li><a href="#DocumentStore"><i class="alert alert-success"></i><span>DocumentStore</span></a>
              </li>
              <li><a href="#load"><i class="alert alert-info"></i><span>load</span></a>
              </li>
              <li><a href="#isDocStored"><i class="alert alert-info"></i><span>isDocStored</span></a>
              </li>
              <li><a href="#addDoc"><i class="alert alert-info"></i><span>addDoc</span></a>
              </li>
              <li><a href="#getDoc"><i class="alert alert-info"></i><span>getDoc</span></a>
              </li>
              <li><a href="#hasDoc"><i class="alert alert-info"></i><span>hasDoc</span></a>
              </li>
              <li><a href="#removeDoc"><i class="alert alert-info"></i><span>removeDoc</span></a>
              </li>
              <li><a href="#addFieldLength"><i class="alert alert-info"></i><span>addFieldLength</span></a>
              </li>
              <li><a href="#updateFieldLength"><i class="alert alert-info"></i><span>updateFieldLength</span></a>
              </li>
              <li><a href="#getFieldLength"><i class="alert alert-info"></i><span>getFieldLength</span></a>
              </li>
              <li><a href="#toJSON"><i class="alert alert-info"></i><span>toJSON</span></a>
              </li>
              <li><a href="#clone"><i class="alert alert-info"></i><span>clone</span></a>
              </li>
            </ul>
          </div>
        </div>
        <div class="span9">
          <section id="DocumentStore">
            <h1>DocumentStore</h1>
            <h5 class="subheader"></h5>
            <p>
              <div class="label label-success radius ctx-type">constructor</div><span>elasticlunr.DocumentStore()</span>
            </p>
          </section>
          <table class="table table-bordered table-striped">
            <thead>
              <tr>
                <th style="width:20%">Option name</th>
                <th style="width:20%">Type</th>
                <th>Description</th>
              </tr>
            </thead>
            <tbody>
              <tr>
                <td>save</td>
                <td>Boolean</td>
                <td><p>If the original JSON document should be stored.</p></td>
              </tr>
            </tbody>
          </table>
          <div class="description"><p>elasticlunr.DocumentStore is a simple key-value document store used for storing sets of tokens for<br />documents stored in index.</p><p>elasticlunr.DocumentStore store original JSON format documents that you could build search snippet by this original JSON document.</p><p>user could choose whether original JSON format document should be store, if no configuration then document will be stored defaultly.<br />If user care more about the index size, user could select not store JSON documents, then this will has some defects, such as user<br />could not use JSON document to generate snippets of search results.</p> </div>
          <pre><code class="language-javascript">elasticlunr.DocumentStore = function (save) {
  if (save === null || save === undefined) {
    this._save = true;
  } else {
    this._save = save;
  }

  this.docs = {};
  this.docInfo = {};
  this.length = 0;
};</code></pre>
          <section id="load">
            <h1>load</h1>
            <h5 class="subheader"></h5>
            <p>
              <div class="label label-info radius ctx-type">method</div><span>elasticlunr.DocumentStore.load()</span>
            </p>
          </section>
          <table class="table table-bordered table-striped">
            <thead>
              <tr>
                <th style="width:20%">Option name</th>
                <th style="width:20%">Type</th>
                <th>Description</th>
              </tr>
            </thead>
            <tbody>
              <tr>
                <td>serialisedData</td>
                <td>Object</td>
                <td><p>The serialised document store to load.</p></td>
              </tr>
              <tr>
                <td>return</td>
                <td>elasticlunr.DocumentStore</td>
                <td></td>
              </tr>
            </tbody>
          </table>
          <div class="description"><p>Loads a previously serialised document store</p> </div>
          <pre><code class="language-javascript">elasticlunr.DocumentStore.load = function (serialisedData) {
  var store = new this;

  store.length = serialisedData.length;
  store.docs = serialisedData.docs;
  store.docInfo = serialisedData.docInfo;
  store._save = serialisedData.save;

  return store;
};</code></pre>
          <section id="isDocStored">
            <h1>isDocStored</h1>
            <h5 class="subheader"></h5>
            <p>
              <div class="label label-info radius ctx-type">method</div><span>elasticlunr.DocumentStore.prototype.isDocStored()</span>
            </p>
          </section>
          <div class="description"><p>check if current instance store the original doc</p> </div>
          <pre><code class="language-javascript">elasticlunr.DocumentStore.prototype.isDocStored = function () {
  return this._save;
};</code></pre>
          <section id="addDoc">
            <h1>addDoc</h1>
            <h5 class="subheader"></h5>
            <p>
              <div class="label label-info radius ctx-type">method</div><span>elasticlunr.DocumentStore.prototype.addDoc()</span>
            </p>
          </section>
          <table class="table table-bordered table-striped">
            <thead>
              <tr>
                <th style="width:20%">Option name</th>
                <th style="width:20%">Type</th>
                <th>Description</th>
              </tr>
            </thead>
            <tbody>
              <tr>
                <td>docRef</td>
                <td>Integer,String</td>
                <td><p>The key used to store the JSON format doc.</p></td>
              </tr>
              <tr>
                <td>doc</td>
                <td>Object</td>
                <td><p>The JSON format doc.</p></td>
              </tr>
            </tbody>
          </table>
          <div class="description"><p>Stores the given doc in the document store against the given id.<br />If docRef already exist, then update doc.</p><p>Document is store by original JSON format, then you could use original document to generate search snippets.</p> </div>
          <pre><code class="language-javascript">elasticlunr.DocumentStore.prototype.addDoc = function (docRef, doc) {
  if (!this.hasDoc(docRef)) this.length++;

  if (this._save === true) {
    this.docs[docRef] = clone(doc);
  } else {
    this.docs[docRef] = null;
  }
};</code></pre>
          <section id="getDoc">
            <h1>getDoc</h1>
            <h5 class="subheader"></h5>
            <p>
              <div class="label label-info radius ctx-type">method</div><span>elasticlunr.DocumentStore.prototype.getDoc()</span>
            </p>
          </section>
          <table class="table table-bordered table-striped">
            <thead>
              <tr>
                <th style="width:20%">Option name</th>
                <th style="width:20%">Type</th>
                <th>Description</th>
              </tr>
            </thead>
            <tbody>
              <tr>
                <td>docRef</td>
                <td>Integer,String</td>
                <td><p>The key to lookup and retrieve from the document store.</p></td>
              </tr>
              <tr>
                <td>return</td>
                <td>Object</td>
                <td></td>
              </tr>
            </tbody>
          </table>
          <div class="description"><p>Retrieves the JSON doc from the document store for a given key.</p><p>If docRef not found, return null.<br />If user set not storing the documents, return null.</p> </div>
          <pre><code class="language-javascript">elasticlunr.DocumentStore.prototype.getDoc = function (docRef) {
  if (this.hasDoc(docRef) === false) return null;
  return this.docs[docRef];
};</code></pre>
          <section id="hasDoc">
            <h1>hasDoc</h1>
            <h5 class="subheader"></h5>
            <p>
              <div class="label label-info radius ctx-type">method</div><span>elasticlunr.DocumentStore.prototype.hasDoc()</span>
            </p>
          </section>
          <table class="table table-bordered table-striped">
            <thead>
              <tr>
                <th style="width:20%">Option name</th>
                <th style="width:20%">Type</th>
                <th>Description</th>
              </tr>
            </thead>
            <tbody>
              <tr>
                <td>docRef</td>
                <td>Integer,String</td>
                <td><p>The id to look up in the document store.</p></td>
              </tr>
              <tr>
                <td>return</td>
                <td>Boolean</td>
                <td></td>
              </tr>
            </tbody>
          </table>
          <div class="description"><p>Checks whether the document store contains a key (docRef).</p> </div>
          <pre><code class="language-javascript">elasticlunr.DocumentStore.prototype.hasDoc = function (docRef) {
  return docRef in this.docs;
};</code></pre>
          <section id="removeDoc">
            <h1>removeDoc</h1>
            <h5 class="subheader"></h5>
            <p>
              <div class="label label-info radius ctx-type">method</div><span>elasticlunr.DocumentStore.prototype.removeDoc()</span>
            </p>
          </section>
          <table class="table table-bordered table-striped">
            <thead>
              <tr>
                <th style="width:20%">Option name</th>
                <th style="width:20%">Type</th>
                <th>Description</th>
              </tr>
            </thead>
            <tbody>
              <tr>
                <td>docRef</td>
                <td>Integer,String</td>
                <td><p>The id to remove from the document store.</p></td>
              </tr>
            </tbody>
          </table>
          <div class="description"><p>Removes the value for a key in the document store.</p> </div>
          <pre><code class="language-javascript">elasticlunr.DocumentStore.prototype.removeDoc = function (docRef) {
  if (!this.hasDoc(docRef)) return;

  delete this.docs[docRef];
  delete this.docInfo[docRef];
  this.length--;
};</code></pre>
          <section id="addFieldLength">
            <h1>addFieldLength</h1>
            <h5 class="subheader"></h5>
            <p>
              <div class="label label-info radius ctx-type">method</div><span>elasticlunr.DocumentStore.prototype.addFieldLength()</span>
            </p>
          </section>
          <table class="table table-bordered table-striped">
            <thead>
              <tr>
                <th style="width:20%">Option name</th>
                <th style="width:20%">Type</th>
                <th>Description</th>
              </tr>
            </thead>
            <tbody>
              <tr>
                <td>docRef</td>
                <td>Integer,String</td>
                <td><p>document&#39;s id or reference</p></td>
              </tr>
              <tr>
                <td>fieldName</td>
                <td>String</td>
                <td><p>field name</p></td>
              </tr>
              <tr>
                <td>length</td>
                <td>Integer</td>
                <td><p>field length</p></td>
              </tr>
            </tbody>
          </table>
          <div class="description"><p>Add field length of a document&#39;s field tokens from pipeline results.<br />The field length of a document is used to do field length normalization even without the original JSON document stored.</p> </div>
          <pre><code class="language-javascript">elasticlunr.DocumentStore.prototype.addFieldLength = function (docRef, fieldName, length) {
  if (docRef === null || docRef === undefined) return;
  if (this.hasDoc(docRef) == false) return;

  if (!this.docInfo[docRef]) this.docInfo[docRef] = {};
  this.docInfo[docRef][fieldName] = length;
};</code></pre>
          <section id="updateFieldLength">
            <h1>updateFieldLength</h1>
            <h5 class="subheader"></h5>
            <p>
              <div class="label label-info radius ctx-type">method</div><span>elasticlunr.DocumentStore.prototype.updateFieldLength()</span>
            </p>
          </section>
          <table class="table table-bordered table-striped">
            <thead>
              <tr>
                <th style="width:20%">Option name</th>
                <th style="width:20%">Type</th>
                <th>Description</th>
              </tr>
            </thead>
            <tbody>
              <tr>
                <td>docRef</td>
                <td>Integer,String</td>
                <td><p>document&#39;s id or reference</p></td>
              </tr>
              <tr>
                <td>fieldName</td>
                <td>String</td>
                <td><p>field name</p></td>
              </tr>
              <tr>
                <td>length</td>
                <td>Integer</td>
                <td><p>field length</p></td>
              </tr>
            </tbody>
          </table>
          <div class="description"><p>Update field length of a document&#39;s field tokens from pipeline results.<br />The field length of a document is used to do field length normalization even without the original JSON document stored.</p> </div>
          <pre><code class="language-javascript">elasticlunr.DocumentStore.prototype.updateFieldLength = function (docRef, fieldName, length) {
  if (docRef === null || docRef === undefined) return;
  if (this.hasDoc(docRef) == false) return;

  this.addFieldLength(docRef, fieldName, length);
};</code></pre>
          <section id="getFieldLength">
            <h1>getFieldLength</h1>
            <h5 class="subheader"></h5>
            <p>
              <div class="label label-info radius ctx-type">method</div><span>elasticlunr.DocumentStore.prototype.getFieldLength()</span>
            </p>
          </section>
          <table class="table table-bordered table-striped">
            <thead>
              <tr>
                <th style="width:20%">Option name</th>
                <th style="width:20%">Type</th>
                <th>Description</th>
              </tr>
            </thead>
            <tbody>
              <tr>
                <td>docRef</td>
                <td>Integer,String</td>
                <td><p>document id or reference</p></td>
              </tr>
              <tr>
                <td>fieldName</td>
                <td>String</td>
                <td><p>field name</p></td>
              </tr>
              <tr>
                <td>return</td>
                <td>Integer</td>
                <td><p>field length</p></td>
              </tr>
            </tbody>
          </table>
          <div class="description"><p>get field length of a document by docRef</p> </div>
          <pre><code class="language-javascript">elasticlunr.DocumentStore.prototype.getFieldLength = function (docRef, fieldName) {
  if (docRef === null || docRef === undefined) return 0;

  if (!(docRef in this.docs)) return 0;
  if (!(fieldName in this.docInfo[docRef])) return 0;
  return this.docInfo[docRef][fieldName];
};</code></pre>
          <section id="toJSON">
            <h1>toJSON</h1>
            <h5 class="subheader"></h5>
            <p>
              <div class="label label-info radius ctx-type">method</div><span>elasticlunr.DocumentStore.prototype.toJSON()</span>
            </p>
          </section>
          <div class="description"><p>Returns a JSON representation of the document store used for serialisation.</p> </div>
          <pre><code class="language-javascript">elasticlunr.DocumentStore.prototype.toJSON = function () {
  return {
    docs: this.docs,
    docInfo: this.docInfo,
    length: this.length,
    save: this._save
  };
};</code></pre>
          <section id="clone">
            <h1>clone</h1>
            <h5 class="subheader"></h5>
            <p>
              <div class="label label-info radius ctx-type">function</div><span>clone()</span>
            </p>
          </section>
          <table class="table table-bordered table-striped">
            <thead>
              <tr>
                <th style="width:20%">Option name</th>
                <th style="width:20%">Type</th>
                <th>Description</th>
              </tr>
            </thead>
            <tbody>
              <tr>
                <td>object</td>
                <td>Object</td>
                <td><p>in JSON format</p></td>
              </tr>
              <tr>
                <td>return</td>
                <td>Object</td>
                <td><p>copied object</p></td>
              </tr>
            </tbody>
          </table>
          <div class="description"><p>Cloning object</p> </div>
          <pre><code class="language-javascript">function clone(obj) {
  if (null === obj || &quot;object&quot; !== typeof obj) return obj;

  var copy = obj.constructor();

  for (var attr in obj) {
    if (obj.hasOwnProperty(attr)) copy[attr] = obj[attr];
  }

  return copy;
}</code></pre>
        </div>
      </div>
    </div>
    <footer class="footer">
      <div class="container">
        <p>Documentation generated with <a href="https://github.com/FGRibreau/doxx">Doxx </a> created by <a href="https://twitter.com/FGRibreau" data-show-count="false" class="twitter-follow-button">Francois-Guillaume Ribreau </a></p>
        <p>Doxx is sponsored by <a href="http://bringr.net/?btt" title="Outil d'analyse des réseaux sociaux" class="bringr">Bringr </a> and <a href="https://redsmin.com/?btt" title="Full Redis GUI" class="redsmin">Redsmin</a></p>
        <p>Theme borrowed from Twitter Bootstrap</p>
      </div>
    </footer>
    <script src="http://platform.twitter.com/widgets.js"></script>
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8/jquery.min.js"></script>
    <script src="http://leaverou.github.com/prefixfree/prefixfree.js"></script>
    <script src="http://getbootstrap.com/2.3.2/assets/js/bootstrap-transition.js"></script>
    <script src="http://getbootstrap.com/2.3.2/assets/js/bootstrap-scrollspy.js"></script>
    <script src="http://getbootstrap.com/2.3.2/assets/js/bootstrap-dropdown.js"></script>
    <script src="http://getbootstrap.com/2.3.2/assets/js/bootstrap-collapse.js"></script>
    <script src="http://getbootstrap.com/2.3.2/assets/js/bootstrap-affix.js"></script>
    <script>
      /**
       * Prism: Lightweight, robust, elegant syntax highlighting
       * MIT license http://www.opensource.org/licenses/mit-license.php/
       * @author Lea Verou http://lea.verou.me
       */(function(){var e=/\blang(?:uage)?-(?!\*)(\w+)\b/i,t=self.Prism={util:{type:function(e){return Object.prototype.toString.call(e).match(/\[object (\w+)\]/)[1]},clone:function(e){var n=t.util.type(e);switch(n){case"Object":var r={};for(var i in e)e.hasOwnProperty(i)&&(r[i]=t.util.clone(e[i]));return r;case"Array":return e.slice()}return e}},languages:{extend:function(e,n){var r=t.util.clone(t.languages[e]);for(var i in n)r[i]=n[i];return r},insertBefore:function(e,n,r,i){i=i||t.languages;var s=i[e],o={};for(var u in s)if(s.hasOwnProperty(u)){if(u==n)for(var a in r)r.hasOwnProperty(a)&&(o[a]=r[a]);o[u]=s[u]}return i[e]=o},DFS:function(e,n){for(var r in e){n.call(e,r,e[r]);t.util.type(e)==="Object"&&t.languages.DFS(e[r],n)}}},highlightAll:function(e,n){var r=document.querySelectorAll('code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code');for(var i=0,s;s=r[i++];)t.highlightElement(s,e===!0,n)},highlightElement:function(r,i,s){var o,u,a=r;while(a&&!e.test(a.className))a=a.parentNode;if(a){o=(a.className.match(e)||[,""])[1];u=t.languages[o]}if(!u)return;r.className=r.className.replace(e,"").replace(/\s+/g," ")+" language-"+o;a=r.parentNode;/pre/i.test(a.nodeName)&&(a.className=a.className.replace(e,"").replace(/\s+/g," ")+" language-"+o);var f=r.textContent;if(!f)return;f=f.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/\u00a0/g," ");var l={element:r,language:o,grammar:u,code:f};t.hooks.run("before-highlight",l);if(i&&self.Worker){var c=new Worker(t.filename);c.onmessage=function(e){l.highlightedCode=n.stringify(JSON.parse(e.data));l.element.innerHTML=l.highlightedCode;s&&s.call(l.element);t.hooks.run("after-highlight",l)};c.postMessage(JSON.stringify({language:l.language,code:l.code}))}else{l.highlightedCode=t.highlight(l.code,l.grammar);l.element.innerHTML=l.highlightedCode;s&&s.call(r);t.hooks.run("after-highlight",l)}},highlight:function(e,r){return n.stringify(t.tokenize(e,r))},tokenize:function(e,n){var r=t.Token,i=[e],s=n.rest;if(s){for(var o in s)n[o]=s[o];delete n.rest}e:for(var o in n){if(!n.hasOwnProperty(o)||!n[o])continue;var u=n[o],a=u.inside,f=!!u.lookbehind||0;u=u.pattern||u;for(var l=0;l<i.length;l++){var c=i[l];if(i.length>e.length)break e;if(c instanceof r)continue;u.lastIndex=0;var h=u.exec(c);if(h){f&&(f=h[1].length);var p=h.index-1+f,h=h[0].slice(f),d=h.length,v=p+d,m=c.slice(0,p+1),g=c.slice(v+1),y=[l,1];m&&y.push(m);var b=new r(o,a?t.tokenize(h,a):h);y.push(b);g&&y.push(g);Array.prototype.splice.apply(i,y)}}}return i},hooks:{all:{},add:function(e,n){var r=t.hooks.all;r[e]=r[e]||[];r[e].push(n)},run:function(e,n){var r=t.hooks.all[e];if(!r||!r.length)return;for(var i=0,s;s=r[i++];)s(n)}}},n=t.Token=function(e,t){this.type=e;this.content=t};n.stringify=function(e){if(typeof e=="string")return e;if(Object.prototype.toString.call(e)=="[object Array]"){for(var r=0;r<e.length;r++)e[r]=n.stringify(e[r]);return e.join("")}var i={type:e.type,content:n.stringify(e.content),tag:"span",classes:["token",e.type],attributes:{}};i.type=="comment"&&(i.attributes.spellcheck="true");t.hooks.run("wrap",i);var s="";for(var o in i.attributes)s+=o+'="'+(i.attributes[o]||"")+'"';return"<"+i.tag+' class="'+i.classes.join(" ")+'" '+s+">"+i.content+"</"+i.tag+">"};if(!self.document){self.addEventListener("message",function(e){var n=JSON.parse(e.data),r=n.language,i=n.code;self.postMessage(JSON.stringify(t.tokenize(i,t.languages[r])));self.close()},!1);return}var r=document.getElementsByTagName("script");r=r[r.length-1];if(r){t.filename=r.src;document.addEventListener&&!r.hasAttribute("data-manual")&&document.addEventListener("DOMContentLoaded",t.highlightAll)}})();;
      Prism.languages.markup={comment:/&lt;!--[\w\W]*?--(&gt;|&gt;)/g,prolog:/&lt;\?.+?\?&gt;/,doctype:/&lt;!DOCTYPE.+?&gt;/,cdata:/&lt;!\[CDATA\[[\w\W]+?]]&gt;/i,tag:{pattern:/&lt;\/?[\w:-]+\s*(?:\s+[\w:-]+(?:=(?:("|')(\\?[\w\W])*?\1|\w+))?\s*)*\/?&gt;/gi,inside:{tag:{pattern:/^&lt;\/?[\w:-]+/i,inside:{punctuation:/^&lt;\/?/,namespace:/^[\w-]+?:/}},"attr-value":{pattern:/=(?:('|")[\w\W]*?(\1)|[^\s>]+)/gi,inside:{punctuation:/=|&gt;|"/g}},punctuation:/\/?&gt;/g,"attr-name":{pattern:/[\w:-]+/g,inside:{namespace:/^[\w-]+?:/}}}},entity:/&amp;#?[\da-z]{1,8};/gi};Prism.hooks.add("wrap",function(e){e.type==="entity"&&(e.attributes.title=e.content.replace(/&amp;/,"&"))});;
      Prism.languages.css={comment:/\/\*[\w\W]*?\*\//g,atrule:/@[\w-]+?(\s+[^;{]+)?(?=\s*{|\s*;)/gi,url:/url\((["']?).*?\1\)/gi,selector:/[^\{\}\s][^\{\}]*(?=\s*\{)/g,property:/(\b|\B)[a-z-]+(?=\s*:)/ig,string:/("|')(\\?.)*?\1/g,important:/\B!important\b/gi,ignore:/&(lt|gt|amp);/gi,punctuation:/[\{\};:]/g};Prism.languages.markup&&Prism.languages.insertBefore("markup","tag",{style:{pattern:/(&lt;|<)style[\w\W]*?(>|&gt;)[\w\W]*?(&lt;|<)\/style(>|&gt;)/ig,inside:{tag:{pattern:/(&lt;|<)style[\w\W]*?(>|&gt;)|(&lt;|<)\/style(>|&gt;)/ig,inside:Prism.languages.markup.tag.inside},rest:Prism.languages.css}}});;
      Prism.languages.clike={comment:{pattern:/(^|[^\\])(\/\*[\w\W]*?\*\/|\/\/.*?(\r?\n|$))/g,lookbehind:!0},string:/("|')(\\?.)*?\1/g,keyword:/\b(if|else|while|do|for|return|in|instanceof|function|new|try|catch|finally|null|break|continue)\b/g,"boolean":/\b(true|false)\b/g,number:/\b-?(0x)?\d*\.?[\da-f]+\b/g,operator:/[-+]{1,2}|!|=?&lt;|=?&gt;|={1,2}|(&amp;){1,2}|\|?\||\?|\*|\//g,ignore:/&(lt|gt|amp);/gi,punctuation:/[{}[\];(),.:]/g};;
      Prism.languages.javascript=Prism.languages.extend("clike",{keyword:/\b(var|let|if|else|while|do|for|return|in|instanceof|function|new|with|typeof|try|catch|finally|null|break|continue)\b/g,number:/\b(-?(0x)?\d*\.?[\da-f]+|NaN|-?Infinity)\b/g});Prism.languages.insertBefore("javascript","keyword",{regex:{pattern:/(^|[^/])\/(?!\/)(\[.+?]|\\.|[^/\r\n])+\/[gim]{0,3}(?=\s*($|[\r\n,.;})]))/g,lookbehind:!0}});Prism.languages.markup&&Prism.languages.insertBefore("markup","tag",{script:{pattern:/(&lt;|<)script[\w\W]*?(>|&gt;)[\w\W]*?(&lt;|<)\/script(>|&gt;)/ig,inside:{tag:{pattern:/(&lt;|<)script[\w\W]*?(>|&gt;)|(&lt;|<)\/script(>|&gt;)/ig,inside:Prism.languages.markup.tag.inside},rest:Prism.languages.javascript}}});;
      
    </script>
    <!-- App js-->
    <script>
      $(function(){
        var $window = $(window);
        $('.scrollspy .nav').affix({
          offset: {
            top: function () { return $window.width() <= 980 ? 480 : 400 }
          , bottom: 50
          }
        });
      })
    </script>
  </body>
</html>