Elasticsearch pagination implementation finished
This commit is contained in:
parent
0fae87c4c8
commit
78de638645
374
documentation/classes/EsHitDto.html
Normal file
374
documentation/classes/EsHitDto.html
Normal file
@ -0,0 +1,374 @@
|
||||
<!doctype html>
|
||||
<html class="no-js" lang="">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="x-ua-compatible" content="ie=edge">
|
||||
<title>hometask documentation</title>
|
||||
<meta name="description" content="">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
|
||||
<link rel="icon" type="image/x-icon" href="../images/favicon.ico">
|
||||
<link rel="stylesheet" href="../styles/style.css">
|
||||
<link rel="stylesheet" href="../styles/dark.css">
|
||||
<link rel="stylesheet" href="../styles/readthedocs.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="navbar navbar-default navbar-fixed-top visible-xs">
|
||||
<a href="../" class="navbar-brand">hometask documentation</a>
|
||||
<button type="button" class="btn btn-default btn-menu ion-ios-menu" id="btn-menu"></button>
|
||||
</div>
|
||||
|
||||
<div class="xs-menu menu" id="mobile-menu">
|
||||
<div id="book-search-input" role="search"><input type="text" placeholder="Type to search"></div> <compodoc-menu></compodoc-menu>
|
||||
</div>
|
||||
|
||||
<div class="container-fluid main">
|
||||
<div class="row main">
|
||||
<div class="hidden-xs menu">
|
||||
<compodoc-menu mode="normal"></compodoc-menu>
|
||||
</div>
|
||||
<!-- START CONTENT -->
|
||||
<div class="content class">
|
||||
<div class="content-data">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<ol class="breadcrumb">
|
||||
<li>Classes</li>
|
||||
<li >EsHitDto</li>
|
||||
</ol>
|
||||
|
||||
<ul class="nav nav-tabs" role="tablist">
|
||||
<li class="active">
|
||||
<a href="#info" role="tab" id="info-tab" data-toggle="tab" data-link="info">Info</a>
|
||||
</li>
|
||||
<li >
|
||||
<a href="#source" role="tab" id="source-tab" data-toggle="tab" data-link="source">Source</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane fade active in" id="c-info">
|
||||
<p class="comment">
|
||||
<h3>File</h3>
|
||||
</p>
|
||||
<p class="comment">
|
||||
<code>src/core/domain/dtos/es-hit.dto.ts</code>
|
||||
</p>
|
||||
|
||||
|
||||
<p class="comment">
|
||||
<h3>Description</h3>
|
||||
</p>
|
||||
<p class="comment">
|
||||
<p>Structure of the document stored and retrieved from Elasticsearch</p>
|
||||
|
||||
</p>
|
||||
|
||||
|
||||
|
||||
|
||||
<section>
|
||||
<h3 id="index">Index</h3>
|
||||
<table class="table table-sm table-bordered index-table">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<h6><b>Properties</b></h6>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<ul class="index-list">
|
||||
<li>
|
||||
<span class="modifier">Optional</span>
|
||||
<a href="#_score" >_score</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#_source" >_source</a>
|
||||
</li>
|
||||
<li>
|
||||
<span class="modifier">Optional</span>
|
||||
<a href="#sort" >sort</a>
|
||||
</li>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
|
||||
|
||||
<section>
|
||||
|
||||
<h3 id="inputs">
|
||||
Properties
|
||||
</h3>
|
||||
<table class="table table-sm table-bordered">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<a name="_score"></a>
|
||||
<span class="name">
|
||||
<span class="modifier">Optional</span>
|
||||
<span ><b>_score</b></span>
|
||||
<a href="#_score"><span class="icon ion-ios-link"></span></a>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<i>Type : </i> <code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/number" target="_blank" >number</a></code>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<b>Decorators : </b>
|
||||
<br />
|
||||
<code>
|
||||
@IsOptional()<br />@ApiProperty({description: 'Relevance score', example: 1.2355})<br />
|
||||
</code>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-line">Defined in <a href="" data-line="44" class="link-to-prism">src/core/domain/dtos/es-hit.dto.ts:44</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-description"><p>Hit relevance score</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
<table class="table table-sm table-bordered">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<a name="_source"></a>
|
||||
<span class="name">
|
||||
<span ><b>_source</b></span>
|
||||
<a href="#_source"><span class="icon ion-ios-link"></span></a>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<i>Type : </i> <code><a href="../classes/PaperDto.html" target="_self" >PaperDto</a></code>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<b>Decorators : </b>
|
||||
<br />
|
||||
<code>
|
||||
@IsNotEmpty()<br />@ApiProperty({description: 'Actual document (paper) stored in Elasticsearch', example: undefined})<br />
|
||||
</code>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-line">Defined in <a href="" data-line="24" class="link-to-prism">src/core/domain/dtos/es-hit.dto.ts:24</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-description"><p>Actual document stored in Elasticsearch</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
<table class="table table-sm table-bordered">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<a name="sort"></a>
|
||||
<span class="name">
|
||||
<span class="modifier">Optional</span>
|
||||
<span ><b>sort</b></span>
|
||||
<a href="#sort"><span class="icon ion-ios-link"></span></a>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<i>Type : </i> <code>[]</code>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<b>Decorators : </b>
|
||||
<br />
|
||||
<code>
|
||||
@IsOptional()<br />@ApiProperty({description: 'List of objects that represents how the hit was sorted', example: undefined})<br />
|
||||
</code>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-line">Defined in <a href="" data-line="34" class="link-to-prism">src/core/domain/dtos/es-hit.dto.ts:34</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-description"><p>List of objects that represents how the hit was sorted</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="tab-pane fade tab-source-code" id="c-source">
|
||||
<pre class="line-numbers compodoc-sourcecode"><code class="language-typescript">import { ApiProperty } from "@nestjs/swagger";
|
||||
import { IsArray, IsDefined, IsIn, IsInt, IsNotEmpty, IsOptional, IsString } from "class-validator";
|
||||
import { PaperDto } from "./paper.dto";
|
||||
|
||||
/**
|
||||
* List of allowed properties in this DTO
|
||||
*/
|
||||
const allowedProperties = ['sort', '_source', '_score'];
|
||||
|
||||
/**
|
||||
* Structure of the document stored and retrieved from Elasticsearch
|
||||
*/
|
||||
export class EsHitDto {
|
||||
/**
|
||||
* Actual document stored in Elasticsearch
|
||||
*/
|
||||
@IsNotEmpty()
|
||||
@ApiProperty({
|
||||
description: 'Actual document (paper) stored in Elasticsearch',
|
||||
example: {
|
||||
id: 'sssss'
|
||||
}
|
||||
})
|
||||
_source: PaperDto;
|
||||
|
||||
/**
|
||||
* List of objects that represents how the hit was sorted
|
||||
*/
|
||||
@IsOptional()
|
||||
@ApiProperty({
|
||||
description: 'List of objects that represents how the hit was sorted',
|
||||
example: {}
|
||||
})
|
||||
sort?: [];
|
||||
|
||||
/**
|
||||
* Hit relevance score
|
||||
*/
|
||||
@IsOptional()
|
||||
@ApiProperty({
|
||||
description: 'Relevance score',
|
||||
example: 1.2355
|
||||
})
|
||||
_score?: number;
|
||||
}</code></pre>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div><div class="search-results">
|
||||
<div class="has-results">
|
||||
<h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
|
||||
<ul class="search-results-list"></ul>
|
||||
</div>
|
||||
<div class="no-results">
|
||||
<h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- END CONTENT -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<label class="dark-mode-switch">
|
||||
<input type="checkbox">
|
||||
<span class="slider">
|
||||
<svg class="slider-icon" viewBox="0 0 24 24" fill="none" height="20" stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" width="20" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M21 12.79A9 9 0 1111.21 3 7 7 0 0021 12.79z"></path>
|
||||
</svg>
|
||||
</span>
|
||||
</label>
|
||||
|
||||
<script>
|
||||
var COMPODOC_CURRENT_PAGE_DEPTH = 1;
|
||||
var COMPODOC_CURRENT_PAGE_CONTEXT = 'class';
|
||||
var COMPODOC_CURRENT_PAGE_URL = 'EsHitDto.html';
|
||||
var MAX_SEARCH_RESULTS = 15;
|
||||
</script>
|
||||
|
||||
<script src="../js/libs/custom-elements.min.js"></script>
|
||||
<script src="../js/libs/lit-html.js"></script>
|
||||
|
||||
<script src="../js/menu-wc.js" defer></script>
|
||||
<script nomodule src="../js/menu-wc_es5.js" defer></script>
|
||||
|
||||
<script src="../js/libs/bootstrap-native.js"></script>
|
||||
|
||||
<script src="../js/libs/es6-shim.min.js"></script>
|
||||
<script src="../js/libs/EventDispatcher.js"></script>
|
||||
<script src="../js/libs/promise.min.js"></script>
|
||||
<script src="../js/libs/zepto.min.js"></script>
|
||||
|
||||
<script src="../js/compodoc.js"></script>
|
||||
|
||||
<script src="../js/tabs.js"></script>
|
||||
<script src="../js/menu.js"></script>
|
||||
<script src="../js/libs/clipboard.min.js"></script>
|
||||
<script src="../js/libs/prism.js"></script>
|
||||
<script src="../js/sourceCode.js"></script>
|
||||
<script src="../js/search/search.js"></script>
|
||||
<script src="../js/search/lunr.min.js"></script>
|
||||
<script src="../js/search/search-lunr.js"></script>
|
||||
<script src="../js/search/search_index.js"></script>
|
||||
<script src="../js/lazy-load-graphs.js"></script>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
@ -91,15 +91,22 @@
|
||||
<td class="col-md-4">
|
||||
<ul class="index-list">
|
||||
<li>
|
||||
<span class="modifier">Optional</span>
|
||||
<a href="#pit" >pit</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#query" >query</a>
|
||||
</li>
|
||||
<li>
|
||||
<span class="modifier">Optional</span>
|
||||
<a href="#search_after" >search_after</a>
|
||||
</li>
|
||||
<li>
|
||||
<span class="modifier">Optional</span>
|
||||
<a href="#size" >size</a>
|
||||
</li>
|
||||
<li>
|
||||
<span class="modifier">Optional</span>
|
||||
<a href="#sort" >sort</a>
|
||||
</li>
|
||||
</ul>
|
||||
@ -115,6 +122,30 @@
|
||||
</table>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<h3 id="constructor">Constructor</h3>
|
||||
<table class="table table-sm table-bordered">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<code>constructor()</code>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-line">Defined in <a href="" data-line="70" class="link-to-prism">src/core/domain/dtos/es-query.dto.ts:70</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-description"><p>Constructs an empty object</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
|
||||
@ -127,6 +158,7 @@
|
||||
<td class="col-md-4">
|
||||
<a name="pit"></a>
|
||||
<span class="name">
|
||||
<span class="modifier">Optional</span>
|
||||
<span ><b>pit</b></span>
|
||||
<a href="#pit"><span class="icon ion-ios-link"></span></a>
|
||||
</span>
|
||||
@ -134,19 +166,28 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<i>Type : </i> <code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/object" target="_blank" >object</a></code>
|
||||
<i>Type : </i> <code><a href="../interfaces/EsPit.html" target="_self" >EsPit</a></code>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<b>Decorators : </b>
|
||||
<br />
|
||||
<code>
|
||||
@IsOptional()<br />@IsObject()<br />@ApiProperty({description: 'PIT object', example: undefined})<br />
|
||||
</code>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-line">Defined in <a href="" data-line="39" class="link-to-prism">src/core/domain/dtos/es-query.dto.ts:39</a></div>
|
||||
<div class="io-line">Defined in <a href="" data-line="48" class="link-to-prism">src/core/domain/dtos/es-query.dto.ts:48</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-description"><p>Object, that stores Point-In-Time ID and time alive</p>
|
||||
<div class="io-description"><p>Object, that stores PIT ID and time alive</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@ -166,7 +207,7 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<i>Type : </i> <code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/object" target="_blank" >object</a></code>
|
||||
<i>Type : </i> <code><a href="../interfaces/EsQuery.html" target="_self" >EsQuery</a></code>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
@ -175,13 +216,13 @@
|
||||
<b>Decorators : </b>
|
||||
<br />
|
||||
<code>
|
||||
@IsDefined()<br />@IsObject()<br />@ApiProperty({description: 'Search query object passed to Elasticsearch', example: false})<br />
|
||||
@IsDefined()<br />@IsObject()<br />@ApiProperty({description: 'Search query object passed to Elasticsearch', example: undefined})<br />
|
||||
</code>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-line">Defined in <a href="" data-line="34" class="link-to-prism">src/core/domain/dtos/es-query.dto.ts:34</a></div>
|
||||
<div class="io-line">Defined in <a href="" data-line="37" class="link-to-prism">src/core/domain/dtos/es-query.dto.ts:37</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@ -194,12 +235,55 @@
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
<table class="table table-sm table-bordered">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<a name="search_after"></a>
|
||||
<span class="name">
|
||||
<span class="modifier">Optional</span>
|
||||
<span ><b>search_after</b></span>
|
||||
<a href="#search_after"><span class="icon ion-ios-link"></span></a>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<i>Type : </i> <code>[]</code>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<b>Decorators : </b>
|
||||
<br />
|
||||
<code>
|
||||
@IsOptional()<br />@IsArray()<br />@ApiProperty({description: '', example: undefined})<br />
|
||||
</code>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-line">Defined in <a href="" data-line="70" class="link-to-prism">src/core/domain/dtos/es-query.dto.ts:70</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-description"><p>Pagination info</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
<table class="table table-sm table-bordered">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<a name="size"></a>
|
||||
<span class="name">
|
||||
<span class="modifier">Optional</span>
|
||||
<span ><b>size</b></span>
|
||||
<a href="#size"><span class="icon ion-ios-link"></span></a>
|
||||
</span>
|
||||
@ -216,13 +300,13 @@
|
||||
<b>Decorators : </b>
|
||||
<br />
|
||||
<code>
|
||||
@IsDefined()<br />@IsNumber()<br />@IsInt()<br />@ApiProperty({description: 'Maximum number of elements returned by Elasticsearch', example: 30})<br />
|
||||
@IsOptional()<br />@IsDefined()<br />@IsNumber()<br />@IsInt()<br />@ApiProperty({description: 'Maximum number of elements returned by Elasticsearch', example: 30})<br />
|
||||
</code>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-line">Defined in <a href="" data-line="23" class="link-to-prism">src/core/domain/dtos/es-query.dto.ts:23</a></div>
|
||||
<div class="io-line">Defined in <a href="" data-line="26" class="link-to-prism">src/core/domain/dtos/es-query.dto.ts:26</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@ -241,6 +325,7 @@
|
||||
<td class="col-md-4">
|
||||
<a name="sort"></a>
|
||||
<span class="name">
|
||||
<span class="modifier">Optional</span>
|
||||
<span ><b>sort</b></span>
|
||||
<a href="#sort"><span class="icon ion-ios-link"></span></a>
|
||||
</span>
|
||||
@ -248,19 +333,28 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<i>Type : </i> <code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/object" target="_blank" >object</a></code>
|
||||
<i>Type : </i> <code>[]</code>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<b>Decorators : </b>
|
||||
<br />
|
||||
<code>
|
||||
@IsOptional()<br />@IsArray()<br />@ApiProperty({description: '', example: undefined})<br />
|
||||
</code>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-line">Defined in <a href="" data-line="44" class="link-to-prism">src/core/domain/dtos/es-query.dto.ts:44</a></div>
|
||||
<div class="io-line">Defined in <a href="" data-line="59" class="link-to-prism">src/core/domain/dtos/es-query.dto.ts:59</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-description"><p>Object, that stores</p>
|
||||
<div class="io-description"><p>Sorting info</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@ -280,7 +374,9 @@
|
||||
|
||||
<div class="tab-pane fade tab-source-code" id="c-source">
|
||||
<pre class="line-numbers compodoc-sourcecode"><code class="language-typescript">import { ApiProperty } from "@nestjs/swagger";
|
||||
import { IsDefined, IsInt, IsNotEmpty, IsNumber, IsObject } from "class-validator";
|
||||
import { IsArray, IsDefined, IsInt, IsNotEmpty, IsNumber, IsObject, IsOptional } from "class-validator";
|
||||
import { EsPit } from "../interfaces/es-pit.interface";
|
||||
import { EsQuery } from "../interfaces/es-query.interface"
|
||||
|
||||
/**
|
||||
* List of allowed properties in this DTO
|
||||
@ -294,6 +390,7 @@ import { IsDefined, IsInt, IsNotEmpty, IsNumber, IsObject } from "class-val
|
||||
/**
|
||||
* Maximum number of elements returned by Elasticsearch
|
||||
*/
|
||||
@IsOptional()
|
||||
@IsDefined()
|
||||
@IsNumber()
|
||||
@IsInt()
|
||||
@ -301,7 +398,7 @@ import { IsDefined, IsInt, IsNotEmpty, IsNumber, IsObject } from "class-val
|
||||
description: 'Maximum number of elements returned by Elasticsearch',
|
||||
example: 30
|
||||
})
|
||||
size: number;
|
||||
size?: number;
|
||||
|
||||
/**
|
||||
* The search query object passed to Elasticsearch
|
||||
@ -310,19 +407,53 @@ import { IsDefined, IsInt, IsNotEmpty, IsNumber, IsObject } from "class-val
|
||||
@IsObject()
|
||||
@ApiProperty({
|
||||
description: 'Search query object passed to Elasticsearch',
|
||||
example: false,
|
||||
example: {},
|
||||
})
|
||||
query: object;
|
||||
query: EsQuery;
|
||||
|
||||
/**
|
||||
* Object, that stores Point-In-Time ID and time alive
|
||||
* Object, that stores PIT ID and time alive
|
||||
*/
|
||||
pit: object;
|
||||
@IsOptional()
|
||||
@IsObject()
|
||||
@ApiProperty({
|
||||
description: 'PIT object',
|
||||
example: {}
|
||||
})
|
||||
pit?: EsPit;
|
||||
|
||||
/**
|
||||
* Object, that stores
|
||||
* Sorting info
|
||||
*/
|
||||
sort: object;
|
||||
@IsOptional()
|
||||
@IsArray()
|
||||
@ApiProperty({
|
||||
description: '',
|
||||
example: []
|
||||
})
|
||||
sort?: unknown[];
|
||||
|
||||
/**
|
||||
* Pagination info
|
||||
*/
|
||||
@IsOptional()
|
||||
@IsArray()
|
||||
@ApiProperty({
|
||||
description: '',
|
||||
example: []
|
||||
})
|
||||
search_after?: unknown[];
|
||||
|
||||
/**
|
||||
* Constructs an empty object
|
||||
*/
|
||||
constructor() {
|
||||
this.size = 10;
|
||||
this.query = undefined;
|
||||
this.pit = undefined;
|
||||
this.sort = undefined;
|
||||
this.search_after = undefined;
|
||||
}
|
||||
}</code></pre>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -96,6 +96,10 @@
|
||||
<li>
|
||||
<a href="#hits" >hits</a>
|
||||
</li>
|
||||
<li>
|
||||
<span class="modifier">Optional</span>
|
||||
<a href="#pit_id" >pit_id</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#timed_out" >timed_out</a>
|
||||
</li>
|
||||
@ -149,7 +153,7 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-line">Defined in <a href="" data-line="54" class="link-to-prism">src/core/domain/dtos/es-response.dto.ts:54</a></div>
|
||||
<div class="io-line">Defined in <a href="" data-line="55" class="link-to-prism">src/core/domain/dtos/es-response.dto.ts:55</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@ -176,7 +180,7 @@ used for the request</p>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<i>Type : </i> <code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/object" target="_blank" >object</a></code>
|
||||
<i>Type : </i> <code><a href="../interfaces/EsResponseHits.html" target="_self" >EsResponseHits</a></code>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
@ -191,7 +195,7 @@ used for the request</p>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-line">Defined in <a href="" data-line="82" class="link-to-prism">src/core/domain/dtos/es-response.dto.ts:82</a></div>
|
||||
<div class="io-line">Defined in <a href="" data-line="83" class="link-to-prism">src/core/domain/dtos/es-response.dto.ts:83</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@ -204,6 +208,48 @@ used for the request</p>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
<table class="table table-sm table-bordered">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<a name="pit_id"></a>
|
||||
<span class="name">
|
||||
<span class="modifier">Optional</span>
|
||||
<span ><b>pit_id</b></span>
|
||||
<a href="#pit_id"><span class="icon ion-ios-link"></span></a>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<i>Type : </i> <code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/string" target="_blank" >string</a></code>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<b>Decorators : </b>
|
||||
<br />
|
||||
<code>
|
||||
@IsString()<br />@IsOptional()<br />@ApiProperty({description: 'PIT ID used to search for results', example: '46ToAwMDaWR5BXV1aWQyKwZub2RlXzMAAAAAAAAAACoBYwADaWR4BXV1aWQxAgZub2RlXzEAAAAAAAAAAAEBYQADaWR5BXV1aWQyKgZub2RlXzIAAAAAAAAAAAwBYgACBXV1aWQyAAAFdXVpZDEAAQltYXRjaF9hbGw_gAAAAA=='})<br />
|
||||
</code>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-line">Defined in <a href="" data-line="94" class="link-to-prism">src/core/domain/dtos/es-response.dto.ts:94</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-description"><p>ID of the PIT used in the search</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
<table class="table table-sm table-bordered">
|
||||
<tbody>
|
||||
<tr>
|
||||
@ -232,7 +278,7 @@ used for the request</p>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-line">Defined in <a href="" data-line="37" class="link-to-prism">src/core/domain/dtos/es-response.dto.ts:37</a></div>
|
||||
<div class="io-line">Defined in <a href="" data-line="38" class="link-to-prism">src/core/domain/dtos/es-response.dto.ts:38</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@ -274,7 +320,7 @@ If 'true' - the request timed out before completion</p>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-line">Defined in <a href="" data-line="24" class="link-to-prism">src/core/domain/dtos/es-response.dto.ts:24</a></div>
|
||||
<div class="io-line">Defined in <a href="" data-line="25" class="link-to-prism">src/core/domain/dtos/es-response.dto.ts:25</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@ -301,12 +347,13 @@ took Elasticsearch to execute the request</p>
|
||||
|
||||
<div class="tab-pane fade tab-source-code" id="c-source">
|
||||
<pre class="line-numbers compodoc-sourcecode"><code class="language-typescript">import { ApiProperty } from "@nestjs/swagger";
|
||||
import { IsBoolean, IsDefined, IsNotEmpty, IsNumber, IsObject, IsOptional } from "class-validator";
|
||||
import { IsBoolean, IsDefined, IsNotEmpty, IsNumber, IsObject, IsOptional, IsString } from "class-validator";
|
||||
import { EsResponseHits } from "../interfaces/es-response-hits.interface";
|
||||
|
||||
/**
|
||||
* List of allowed properties in this DTO
|
||||
*/
|
||||
const allowedProperties = ['took', 'timed_out', '_shards', 'hits'];
|
||||
const allowedProperties = ['took', 'timed_out', '_shards', 'hits', 'pit_id'];
|
||||
|
||||
/**
|
||||
* Elasticsearch response DTO
|
||||
@ -381,7 +428,18 @@ export class EsResponseDto {
|
||||
}],
|
||||
}
|
||||
})
|
||||
hits: object;
|
||||
hits: EsResponseHits;
|
||||
|
||||
/**
|
||||
* ID of the PIT used in the search
|
||||
*/
|
||||
@IsString()
|
||||
@IsOptional()
|
||||
@ApiProperty({
|
||||
description: 'PIT ID used to search for results',
|
||||
example: '46ToAwMDaWR5BXV1aWQyKwZub2RlXzMAAAAAAAAAACoBYwADaWR4BXV1aWQxAgZub2RlXzEAAAAAAAAAAAEBYQADaWR5BXV1aWQyKgZub2RlXzIAAAAAAAAAAAwBYgACBXV1aWQyAAAFdXVpZDEAAQltYXRjaF9hbGw_gAAAAA=='
|
||||
})
|
||||
pit_id?: string;
|
||||
}</code></pre>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -117,12 +117,12 @@
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<code>constructor(data: T[], meta: <a href="../interfaces/PageMeta.html" target="_self">PageMeta</a>)</code>
|
||||
<code>constructor(data: <a href="../classes/PaperDto.html" target="_self">PaperDto[]</a>, meta: <a href="../interfaces/PageMeta.html" target="_self">PageMeta</a>)</code>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-line">Defined in <a href="" data-line="31" class="link-to-prism">src/core/domain/dtos/page.dto.ts:31</a></div>
|
||||
<div class="io-line">Defined in <a href="" data-line="32" class="link-to-prism">src/core/domain/dtos/page.dto.ts:32</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@ -145,7 +145,7 @@
|
||||
<td>data</td>
|
||||
|
||||
<td>
|
||||
<code>T[]</code>
|
||||
<code><a href="../classes/PaperDto.html" target="_self" >PaperDto[]</a></code>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
@ -193,7 +193,7 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<i>Type : </i> <code>T[]</code>
|
||||
<i>Type : </i> <code><a href="../classes/PaperDto.html" target="_self" >PaperDto[]</a></code>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
@ -208,7 +208,7 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-line">Defined in <a href="" data-line="22" class="link-to-prism">src/core/domain/dtos/page.dto.ts:22</a></div>
|
||||
<div class="io-line">Defined in <a href="" data-line="23" class="link-to-prism">src/core/domain/dtos/page.dto.ts:23</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@ -250,7 +250,7 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-line">Defined in <a href="" data-line="31" class="link-to-prism">src/core/domain/dtos/page.dto.ts:31</a></div>
|
||||
<div class="io-line">Defined in <a href="" data-line="32" class="link-to-prism">src/core/domain/dtos/page.dto.ts:32</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@ -278,6 +278,7 @@
|
||||
<pre class="line-numbers compodoc-sourcecode"><code class="language-typescript">import { ApiProperty } from "@nestjs/swagger";
|
||||
import { IsArray } from "class-validator";
|
||||
import { PageMeta } from "../interfaces/page-meta.interface";
|
||||
import { PaperDto } from "./paper.dto";
|
||||
|
||||
/**
|
||||
* List of allowed properties in this DTO
|
||||
@ -287,7 +288,7 @@ const allowedProperties = ['data', 'meta'];
|
||||
/**
|
||||
* Page model for pagination
|
||||
*/
|
||||
export class PageDto<T> {
|
||||
export class PageDto {
|
||||
/**
|
||||
* Data block of the page
|
||||
*/
|
||||
@ -296,7 +297,7 @@ export class PageDto<T> {
|
||||
description: 'All data the page contains',
|
||||
isArray: true,
|
||||
})
|
||||
readonly data: T[];
|
||||
readonly data: PaperDto[];
|
||||
|
||||
/**
|
||||
* Metadata of the page
|
||||
@ -312,7 +313,7 @@ export class PageDto<T> {
|
||||
* @param data
|
||||
* @param meta
|
||||
*/
|
||||
constructor(data: T[], meta: PageMeta) {
|
||||
constructor(data: PaperDto[], meta: PageMeta) {
|
||||
this.data = data;
|
||||
this.meta = meta;
|
||||
}
|
||||
|
590
documentation/classes/PaperDto.html
Normal file
590
documentation/classes/PaperDto.html
Normal file
@ -0,0 +1,590 @@
|
||||
<!doctype html>
|
||||
<html class="no-js" lang="">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="x-ua-compatible" content="ie=edge">
|
||||
<title>hometask documentation</title>
|
||||
<meta name="description" content="">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
|
||||
<link rel="icon" type="image/x-icon" href="../images/favicon.ico">
|
||||
<link rel="stylesheet" href="../styles/style.css">
|
||||
<link rel="stylesheet" href="../styles/dark.css">
|
||||
<link rel="stylesheet" href="../styles/readthedocs.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="navbar navbar-default navbar-fixed-top visible-xs">
|
||||
<a href="../" class="navbar-brand">hometask documentation</a>
|
||||
<button type="button" class="btn btn-default btn-menu ion-ios-menu" id="btn-menu"></button>
|
||||
</div>
|
||||
|
||||
<div class="xs-menu menu" id="mobile-menu">
|
||||
<div id="book-search-input" role="search"><input type="text" placeholder="Type to search"></div> <compodoc-menu></compodoc-menu>
|
||||
</div>
|
||||
|
||||
<div class="container-fluid main">
|
||||
<div class="row main">
|
||||
<div class="hidden-xs menu">
|
||||
<compodoc-menu mode="normal"></compodoc-menu>
|
||||
</div>
|
||||
<!-- START CONTENT -->
|
||||
<div class="content class">
|
||||
<div class="content-data">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<ol class="breadcrumb">
|
||||
<li>Classes</li>
|
||||
<li >PaperDto</li>
|
||||
</ol>
|
||||
|
||||
<ul class="nav nav-tabs" role="tablist">
|
||||
<li class="active">
|
||||
<a href="#info" role="tab" id="info-tab" data-toggle="tab" data-link="info">Info</a>
|
||||
</li>
|
||||
<li >
|
||||
<a href="#source" role="tab" id="source-tab" data-toggle="tab" data-link="source">Source</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane fade active in" id="c-info">
|
||||
<p class="comment">
|
||||
<h3>File</h3>
|
||||
</p>
|
||||
<p class="comment">
|
||||
<code>src/core/domain/dtos/paper.dto.ts</code>
|
||||
</p>
|
||||
|
||||
|
||||
<p class="comment">
|
||||
<h3>Description</h3>
|
||||
</p>
|
||||
<p class="comment">
|
||||
<p>Structure of the document stored and retrieved from Elasticsearch</p>
|
||||
|
||||
</p>
|
||||
|
||||
|
||||
|
||||
|
||||
<section>
|
||||
<h3 id="index">Index</h3>
|
||||
<table class="table table-sm table-bordered index-table">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<h6><b>Properties</b></h6>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<ul class="index-list">
|
||||
<li>
|
||||
<a href="#authors" >authors</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#content" >content</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#id" >id</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#summary" >summary</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#tags" >tags</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#title" >title</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#topic" >topic</a>
|
||||
</li>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
|
||||
|
||||
<section>
|
||||
|
||||
<h3 id="inputs">
|
||||
Properties
|
||||
</h3>
|
||||
<table class="table table-sm table-bordered">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<a name="authors"></a>
|
||||
<span class="name">
|
||||
<span ><b>authors</b></span>
|
||||
<a href="#authors"><span class="icon ion-ios-link"></span></a>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<i>Type : </i> <code>string[]</code>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<b>Decorators : </b>
|
||||
<br />
|
||||
<code>
|
||||
@IsNotEmpty()<br />@IsArray()<br />@ApiProperty({description: 'List of authors of the paper', example: undefined})<br />
|
||||
</code>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-line">Defined in <a href="" data-line="46" class="link-to-prism">src/core/domain/dtos/paper.dto.ts:46</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-description"><p>List of authors of the paper</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
<table class="table table-sm table-bordered">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<a name="content"></a>
|
||||
<span class="name">
|
||||
<span ><b>content</b></span>
|
||||
<a href="#content"><span class="icon ion-ios-link"></span></a>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<i>Type : </i> <code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/string" target="_blank" >string</a></code>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<b>Decorators : </b>
|
||||
<br />
|
||||
<code>
|
||||
@ApiProperty({description: 'Contents of the paper presented in Markdown (.md) format', example: '...'})<br />
|
||||
</code>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-line">Defined in <a href="" data-line="88" class="link-to-prism">src/core/domain/dtos/paper.dto.ts:88</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-description"><p>Contents of the paper [Markdown]</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
<table class="table table-sm table-bordered">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<a name="id"></a>
|
||||
<span class="name">
|
||||
<span ><b>id</b></span>
|
||||
<a href="#id"><span class="icon ion-ios-link"></span></a>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<i>Type : </i> <code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/string" target="_blank" >string</a></code>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<b>Decorators : </b>
|
||||
<br />
|
||||
<code>
|
||||
@IsNotEmpty()<br />@IsString()<br />@ApiProperty({description: 'Unique ID of the paper', example: 'cc3c3cca-f763-495c-8dfa-69c45ca738ff'})<br />
|
||||
</code>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-line">Defined in <a href="" data-line="24" class="link-to-prism">src/core/domain/dtos/paper.dto.ts:24</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-description"><p>Unique ID of the paper</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
<table class="table table-sm table-bordered">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<a name="summary"></a>
|
||||
<span class="name">
|
||||
<span ><b>summary</b></span>
|
||||
<a href="#summary"><span class="icon ion-ios-link"></span></a>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<i>Type : </i> <code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/string" target="_blank" >string</a></code>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<b>Decorators : </b>
|
||||
<br />
|
||||
<code>
|
||||
@IsNotEmpty()<br />@IsString()<br />@ApiProperty({description: 'Summary of the paper. May be a short excerpt from the main text', example: 'S-algol (St Andrews Algol):vii is a computer programming language derivative of ALGOL 60 developed at the University of St Andrews in 1979 by Ron Morrison and Tony Davie'})<br />
|
||||
</code>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-line">Defined in <a href="" data-line="68" class="link-to-prism">src/core/domain/dtos/paper.dto.ts:68</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-description"><p>Summary of the paper. May be a short excerpt from the main text.</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
<table class="table table-sm table-bordered">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<a name="tags"></a>
|
||||
<span class="name">
|
||||
<span ><b>tags</b></span>
|
||||
<a href="#tags"><span class="icon ion-ios-link"></span></a>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<i>Type : </i> <code>string[]</code>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<b>Decorators : </b>
|
||||
<br />
|
||||
<code>
|
||||
@IsNotEmpty()<br />@IsArray()<br />@ApiProperty({description: 'List of tags, that show the certain topics/fields of knowledge paper is touching', example: undefined})<br />
|
||||
</code>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-line">Defined in <a href="" data-line="79" class="link-to-prism">src/core/domain/dtos/paper.dto.ts:79</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-description"><p>List of tags, that show the certain topics/fields of knowledge paper is touching</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
<table class="table table-sm table-bordered">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<a name="title"></a>
|
||||
<span class="name">
|
||||
<span ><b>title</b></span>
|
||||
<a href="#title"><span class="icon ion-ios-link"></span></a>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<i>Type : </i> <code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/string" target="_blank" >string</a></code>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<b>Decorators : </b>
|
||||
<br />
|
||||
<code>
|
||||
@IsNotEmpty()<br />@IsString()<br />@ApiProperty({description: 'Title of the paper', example: 'Mucosal associated invariant T cell'})<br />
|
||||
</code>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-line">Defined in <a href="" data-line="35" class="link-to-prism">src/core/domain/dtos/paper.dto.ts:35</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-description"><p>Title of the paper</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
<table class="table table-sm table-bordered">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<a name="topic"></a>
|
||||
<span class="name">
|
||||
<span ><b>topic</b></span>
|
||||
<a href="#topic"><span class="icon ion-ios-link"></span></a>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<i>Type : </i> <code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/string" target="_blank" >string</a></code>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<b>Decorators : </b>
|
||||
<br />
|
||||
<code>
|
||||
@IsNotEmpty()<br />@IsString()<br />@ApiProperty({description: 'Topic of the paper', example: 'Physics'})<br />
|
||||
</code>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-line">Defined in <a href="" data-line="57" class="link-to-prism">src/core/domain/dtos/paper.dto.ts:57</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-description"><p>Topic of the paper</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="tab-pane fade tab-source-code" id="c-source">
|
||||
<pre class="line-numbers compodoc-sourcecode"><code class="language-typescript">import { ApiProperty } from "@nestjs/swagger";
|
||||
import { IsArray, IsDefined, IsIn, IsInt, IsNotEmpty, IsOptional, IsString } from "class-validator";
|
||||
import { EsQueryDto } from "./es-query.dto";
|
||||
import { SearchQueryDto } from "./search-q.dto";
|
||||
|
||||
/**
|
||||
* List of allowed properties in this DTO
|
||||
*/
|
||||
const allowedProperties = ['id', 'title', 'authors', 'topic', 'summary', 'tags', 'content'];
|
||||
|
||||
/**
|
||||
* Structure of the document stored and retrieved from Elasticsearch
|
||||
*/
|
||||
export class PaperDto {
|
||||
/**
|
||||
* Unique ID of the paper
|
||||
*/
|
||||
@IsNotEmpty()
|
||||
@IsString()
|
||||
@ApiProperty({
|
||||
description: 'Unique ID of the paper',
|
||||
example: 'cc3c3cca-f763-495c-8dfa-69c45ca738ff'
|
||||
})
|
||||
id: string;
|
||||
|
||||
/**
|
||||
* Title of the paper
|
||||
*/
|
||||
@IsNotEmpty()
|
||||
@IsString()
|
||||
@ApiProperty({
|
||||
description: 'Title of the paper',
|
||||
example: 'Mucosal associated invariant T cell',
|
||||
})
|
||||
title: string;
|
||||
|
||||
/**
|
||||
* List of authors of the paper
|
||||
*/
|
||||
@IsNotEmpty()
|
||||
@IsArray()
|
||||
@ApiProperty({
|
||||
description: 'List of authors of the paper',
|
||||
example: ['Daniil Mikhaylov', 'Denis Gorbunov', 'Maxim Ten']
|
||||
})
|
||||
authors: string[];
|
||||
|
||||
/**
|
||||
* Topic of the paper
|
||||
*/
|
||||
@IsNotEmpty()
|
||||
@IsString()
|
||||
@ApiProperty({
|
||||
description: 'Topic of the paper',
|
||||
example: 'Physics'
|
||||
})
|
||||
topic: string;
|
||||
|
||||
/**
|
||||
* Summary of the paper. May be a short excerpt from the main text.
|
||||
*/
|
||||
@IsNotEmpty()
|
||||
@IsString()
|
||||
@ApiProperty({
|
||||
description: 'Summary of the paper. May be a short excerpt from the main text',
|
||||
example: 'S-algol (St Andrews Algol):vii is a computer programming language derivative of ALGOL 60 developed at the University of St Andrews in 1979 by Ron Morrison and Tony Davie'
|
||||
})
|
||||
summary: string;
|
||||
|
||||
/**
|
||||
* List of tags, that show the certain topics/fields of knowledge paper is touching
|
||||
*/
|
||||
@IsNotEmpty()
|
||||
@IsArray()
|
||||
@ApiProperty({
|
||||
description: 'List of tags, that show the certain topics/fields of knowledge paper is touching',
|
||||
example: ['Neurobiology', 'Neuron structure', 'Neuroimaging']
|
||||
})
|
||||
tags: string[];
|
||||
|
||||
/**
|
||||
* Contents of the paper [Markdown]
|
||||
*/
|
||||
@ApiProperty({
|
||||
description: 'Contents of the paper presented in Markdown (.md) format',
|
||||
example: '...'
|
||||
})
|
||||
content: string;
|
||||
}</code></pre>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div><div class="search-results">
|
||||
<div class="has-results">
|
||||
<h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
|
||||
<ul class="search-results-list"></ul>
|
||||
</div>
|
||||
<div class="no-results">
|
||||
<h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- END CONTENT -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<label class="dark-mode-switch">
|
||||
<input type="checkbox">
|
||||
<span class="slider">
|
||||
<svg class="slider-icon" viewBox="0 0 24 24" fill="none" height="20" stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" width="20" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M21 12.79A9 9 0 1111.21 3 7 7 0 0021 12.79z"></path>
|
||||
</svg>
|
||||
</span>
|
||||
</label>
|
||||
|
||||
<script>
|
||||
var COMPODOC_CURRENT_PAGE_DEPTH = 1;
|
||||
var COMPODOC_CURRENT_PAGE_CONTEXT = 'class';
|
||||
var COMPODOC_CURRENT_PAGE_URL = 'PaperDto.html';
|
||||
var MAX_SEARCH_RESULTS = 15;
|
||||
</script>
|
||||
|
||||
<script src="../js/libs/custom-elements.min.js"></script>
|
||||
<script src="../js/libs/lit-html.js"></script>
|
||||
|
||||
<script src="../js/menu-wc.js" defer></script>
|
||||
<script nomodule src="../js/menu-wc_es5.js" defer></script>
|
||||
|
||||
<script src="../js/libs/bootstrap-native.js"></script>
|
||||
|
||||
<script src="../js/libs/es6-shim.min.js"></script>
|
||||
<script src="../js/libs/EventDispatcher.js"></script>
|
||||
<script src="../js/libs/promise.min.js"></script>
|
||||
<script src="../js/libs/zepto.min.js"></script>
|
||||
|
||||
<script src="../js/compodoc.js"></script>
|
||||
|
||||
<script src="../js/tabs.js"></script>
|
||||
<script src="../js/menu.js"></script>
|
||||
<script src="../js/libs/clipboard.min.js"></script>
|
||||
<script src="../js/libs/prism.js"></script>
|
||||
<script src="../js/sourceCode.js"></script>
|
||||
<script src="../js/search/search.js"></script>
|
||||
<script src="../js/search/lunr.min.js"></script>
|
||||
<script src="../js/search/search-lunr.js"></script>
|
||||
<script src="../js/search/search_index.js"></script>
|
||||
<script src="../js/lazy-load-graphs.js"></script>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
656
documentation/classes/PrevSearch.html
Normal file
656
documentation/classes/PrevSearch.html
Normal file
@ -0,0 +1,656 @@
|
||||
<!doctype html>
|
||||
<html class="no-js" lang="">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="x-ua-compatible" content="ie=edge">
|
||||
<title>hometask documentation</title>
|
||||
<meta name="description" content="">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
|
||||
<link rel="icon" type="image/x-icon" href="../images/favicon.ico">
|
||||
<link rel="stylesheet" href="../styles/style.css">
|
||||
<link rel="stylesheet" href="../styles/dark.css">
|
||||
<link rel="stylesheet" href="../styles/readthedocs.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="navbar navbar-default navbar-fixed-top visible-xs">
|
||||
<a href="../" class="navbar-brand">hometask documentation</a>
|
||||
<button type="button" class="btn btn-default btn-menu ion-ios-menu" id="btn-menu"></button>
|
||||
</div>
|
||||
|
||||
<div class="xs-menu menu" id="mobile-menu">
|
||||
<div id="book-search-input" role="search"><input type="text" placeholder="Type to search"></div> <compodoc-menu></compodoc-menu>
|
||||
</div>
|
||||
|
||||
<div class="container-fluid main">
|
||||
<div class="row main">
|
||||
<div class="hidden-xs menu">
|
||||
<compodoc-menu mode="normal"></compodoc-menu>
|
||||
</div>
|
||||
<!-- START CONTENT -->
|
||||
<div class="content class">
|
||||
<div class="content-data">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<ol class="breadcrumb">
|
||||
<li>Classes</li>
|
||||
<li >PrevSearch</li>
|
||||
</ol>
|
||||
|
||||
<ul class="nav nav-tabs" role="tablist">
|
||||
<li class="active">
|
||||
<a href="#info" role="tab" id="info-tab" data-toggle="tab" data-link="info">Info</a>
|
||||
</li>
|
||||
<li >
|
||||
<a href="#source" role="tab" id="source-tab" data-toggle="tab" data-link="source">Source</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane fade active in" id="c-info">
|
||||
<p class="comment">
|
||||
<h3>File</h3>
|
||||
</p>
|
||||
<p class="comment">
|
||||
<code>src/core/interceptors/page.interceptor.ts</code>
|
||||
</p>
|
||||
|
||||
|
||||
<p class="comment">
|
||||
<h3>Description</h3>
|
||||
</p>
|
||||
<p class="comment">
|
||||
<p>Previous search data storage</p>
|
||||
|
||||
</p>
|
||||
|
||||
|
||||
<p class="comment">
|
||||
<h3>Implements</h3>
|
||||
</p>
|
||||
<p class="comment">
|
||||
<code><a href="../interfaces/SearchInfo.html" target="_self" >SearchInfo</a></code>
|
||||
</p>
|
||||
|
||||
|
||||
<section>
|
||||
<h3 id="index">Index</h3>
|
||||
<table class="table table-sm table-bordered index-table">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<h6><b>Properties</b></h6>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<ul class="index-list">
|
||||
<li>
|
||||
<a href="#pit" >pit</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#prevPage" >prevPage</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#tiebreaker" >tiebreaker</a>
|
||||
</li>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<h6><b>Methods</b></h6>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<ul class="index-list">
|
||||
<li>
|
||||
<span class="modifier">Public</span>
|
||||
<a href="#isSet" >isSet</a>
|
||||
</li>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<h3 id="constructor">Constructor</h3>
|
||||
<table class="table table-sm table-bordered">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<code>constructor()</code>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-line">Defined in <a href="" data-line="20" class="link-to-prism">src/core/interceptors/page.interceptor.ts:20</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-description"><p>Constructs an uninitialized object</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
|
||||
<h3 id="inputs">
|
||||
Properties
|
||||
</h3>
|
||||
<table class="table table-sm table-bordered">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<a name="pit"></a>
|
||||
<span class="name">
|
||||
<span ><b>pit</b></span>
|
||||
<a href="#pit"><span class="icon ion-ios-link"></span></a>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<i>Type : </i> <code><a href="../interfaces/EsPit.html" target="_self" >EsPit</a></code>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-line">Defined in <a href="" data-line="33" class="link-to-prism">src/core/interceptors/page.interceptor.ts:33</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-description"><p>PIT object of the previous search</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
<table class="table table-sm table-bordered">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<a name="prevPage"></a>
|
||||
<span class="name">
|
||||
<span ><b>prevPage</b></span>
|
||||
<a href="#prevPage"><span class="icon ion-ios-link"></span></a>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<i>Type : </i> <code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/number" target="_blank" >number</a></code>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-line">Defined in <a href="" data-line="43" class="link-to-prism">src/core/interceptors/page.interceptor.ts:43</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-description"><p>Number of the previous page</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
<table class="table table-sm table-bordered">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<a name="tiebreaker"></a>
|
||||
<span class="name">
|
||||
<span ><b>tiebreaker</b></span>
|
||||
<a href="#tiebreaker"><span class="icon ion-ios-link"></span></a>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<i>Type : </i> <code>[]</code>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-line">Defined in <a href="" data-line="38" class="link-to-prism">src/core/interceptors/page.interceptor.ts:38</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-description"><p>Tiebreaker and sort parameters</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
|
||||
<h3 id="methods">
|
||||
Methods
|
||||
</h3>
|
||||
<table class="table table-sm table-bordered">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<a name="isSet"></a>
|
||||
<span class="name">
|
||||
<span class="modifier">Public</span>
|
||||
<span ><b>isSet</b></span>
|
||||
<a href="#isSet"><span class="icon ion-ios-link"></span></a>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<span class="modifier-icon icon ion-ios-reset"></span>
|
||||
<code>isSet()</code>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-line">Defined in <a href="" data-line="49"
|
||||
class="link-to-prism">src/core/interceptors/page.interceptor.ts:49</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-description"><p>Checks if there was the search before current one</p>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
</div>
|
||||
<div class="io-description">
|
||||
<b>Returns : </b> <code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/boolean" target="_blank" >boolean</a></code>
|
||||
|
||||
</div>
|
||||
<div class="io-description">
|
||||
<p>true/false, showing whether or not there was another search before</p>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="tab-pane fade tab-source-code" id="c-source">
|
||||
<pre class="line-numbers compodoc-sourcecode"><code class="language-typescript">import { HttpService } from "@nestjs/axios";
|
||||
import { CallHandler, ExecutionContext, Injectable, NestInterceptor } from "@nestjs/common";
|
||||
import { reverse } from "dns";
|
||||
import { Observable, map, take } from "rxjs";
|
||||
import { EsResponseDto, PageDto } from "../domain/dtos";
|
||||
import { EsQueryDto } from "../domain/dtos/es-query.dto";
|
||||
import { RequestDto } from "../domain/dtos/request.dto";
|
||||
import { SearchQueryDto } from "../domain/dtos/search-q.dto";
|
||||
import { SearchResultDto } from "../domain/dtos/search-result.dto";
|
||||
import { EsTime } from "../domain/enums/es-time.enum";
|
||||
import { Order } from "../domain/enums/page-order.enum";
|
||||
import { PageMeta } from "../domain/interfaces";
|
||||
import { EsPit } from "../domain/interfaces/es-pit.interface";
|
||||
import { SearchInfo } from "../domain/interfaces/search-info.interface";
|
||||
import { SearchService } from "../services/common/search.service";
|
||||
|
||||
/**
|
||||
* Previous search data storage
|
||||
*/
|
||||
class PrevSearch implements SearchInfo {
|
||||
/**
|
||||
* Constructs an uninitialized object
|
||||
*/
|
||||
constructor() {
|
||||
this.pit = undefined;
|
||||
this.tiebreaker = undefined;
|
||||
this.prevPage = -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* PIT object of the previous search
|
||||
*/
|
||||
pit: EsPit;
|
||||
|
||||
/**
|
||||
* Tiebreaker and sort parameters
|
||||
*/
|
||||
tiebreaker: unknown[];
|
||||
|
||||
/**
|
||||
* Number of the previous page
|
||||
*/
|
||||
prevPage: number;
|
||||
|
||||
/**
|
||||
* Checks if there was the search before current one
|
||||
* @returns true/false, showing whether or not there was another search before
|
||||
*/
|
||||
public isSet(): boolean {
|
||||
if (this.pit && this.tiebreaker && this.prevPage !== -1) return true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Pagination-implementing interceptor
|
||||
*/
|
||||
@Injectable()
|
||||
export class PageInterceptor implements NestInterceptor {
|
||||
/**
|
||||
* Injects needed dependencies and instantiates the storage object
|
||||
* @param httpService
|
||||
* @param searchService
|
||||
*/
|
||||
constructor(private readonly httpService: HttpService) {
|
||||
this.prevSearch = new PrevSearch;
|
||||
}
|
||||
|
||||
/**
|
||||
* Override of intercept() method, specified in NestInterceptor interface
|
||||
* @param context
|
||||
* @param next
|
||||
* @returns Page with content and metadata
|
||||
*/
|
||||
async intercept(context: ExecutionContext, next: CallHandler<any>): Promise<Observable<PageDto>> {
|
||||
let request: RequestDto = context.switchToHttp().getRequest<RequestDto>();
|
||||
const query: SearchQueryDto = request.query;
|
||||
let reverse: boolean = false;
|
||||
|
||||
request.es_query = new EsQueryDto();
|
||||
|
||||
request.es_query.query = {
|
||||
query_string: {
|
||||
query: query.query,
|
||||
default_field: 'content',
|
||||
}
|
||||
};
|
||||
request.es_query.sort = [
|
||||
{ _score: { order: !query?.order ? Order.DESC : query.order } },
|
||||
{ _shard_doc: 'desc' }
|
||||
];
|
||||
|
||||
if (this.prevSearch.isSet()) {
|
||||
request.es_query.pit = this.prevSearch.pit;
|
||||
request.es_query.search_after = this.prevSearch.tiebreaker;
|
||||
|
||||
let limit = !query?.limit ? 10 : query.limit;
|
||||
request.es_query.size = limit * Math.abs(query.page - this.prevSearch.prevPage);
|
||||
|
||||
if (query.page < this.prevSearch.prevPage) {
|
||||
request.es_query.sort = [{ _score: { order: 'asc' } }];
|
||||
request.es_query.size += limit - 1;
|
||||
reverse = true;
|
||||
} else if (query.page == this.prevSearch.prevPage) {
|
||||
//...
|
||||
}
|
||||
} else {
|
||||
this.prevSearch.pit = request.es_query.pit = await this.getPIT(1);
|
||||
request.es_query.size = !query?.limit ? 10 : query.limit;
|
||||
}
|
||||
|
||||
return next.handle().pipe(
|
||||
map((res) => {
|
||||
// Setting the page meta-data
|
||||
let meta: PageMeta = {
|
||||
total: res.hits.total.value,
|
||||
pagenum: !query?.page ? 1 : query.page,
|
||||
order: query?.order?.toUpperCase() === Order.ASC ? Order.ASC : Order.DESC,
|
||||
hasNext: false,
|
||||
hasPrev: false,
|
||||
pagesize: !query?.limit ? 10 : query.limit,
|
||||
};
|
||||
// meta.hasNext = res.hits.hits[meta.pagenum * meta.pagesize] ? true : false;
|
||||
// meta.hasPrev = res.hits.hits[(meta.pagenum - 1) * meta.pagesize - 1] ? true: false;
|
||||
|
||||
// Saving the search info
|
||||
this.prevSearch.pit.id = res.pit_id;
|
||||
this.prevSearch.tiebreaker = res.hits.hits[res.hits.hits.length - 1].sort;
|
||||
this.prevSearch.prevPage = query.page;
|
||||
|
||||
let data = res.hits.hits.slice(-meta.pagesize);
|
||||
if (reverse) {
|
||||
console.log('REVERSE');
|
||||
this.prevSearch.tiebreaker = data[0].sort;
|
||||
data.reverse();
|
||||
reverse = false;
|
||||
}
|
||||
|
||||
// Return the page
|
||||
return new PageDto(data, meta);
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Elastichsearch server port-number
|
||||
*/
|
||||
private readonly ES_PORT = process.env.ES_PORT;
|
||||
|
||||
/**
|
||||
* Info about previously completed search
|
||||
*/
|
||||
private prevSearch: PrevSearch;
|
||||
|
||||
/**
|
||||
* Acquires a PIT ID from Elasticsearch, needed for a request
|
||||
* @param alive, amount of time in minutes (defaults to 1). If time unit is not specified - defaults to minutes.
|
||||
* @returns PIT object <EsPit> containing PIT ID and keep_alive value
|
||||
*/
|
||||
public async getPIT(alive: number, unit: EsTime = EsTime.min): Promise<EsPit> {
|
||||
return new Promise((resolve, reject) => {
|
||||
try {
|
||||
(this.httpService.post<EsPit>(`http://localhost:${this.ES_PORT}/papers/_pit?keep_alive=${alive+unit}`)
|
||||
.pipe(take(1), map(axiosRes => axiosRes.data))
|
||||
.subscribe((res) => {
|
||||
res.keep_alive = alive + unit;
|
||||
resolve(res);
|
||||
}));
|
||||
} catch (error) {
|
||||
reject(error);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes the PIT specified by provided ID
|
||||
* @param pitID, ID of the PIT, that would be deleted
|
||||
* @returns true/false, depending on the result of deletion of the PIT
|
||||
*/
|
||||
async deletePIT(pitID: string): Promise<boolean> {
|
||||
return new Promise((resolve, reject) => {
|
||||
try {
|
||||
this.httpService.delete(`http://localhost:${this.ES_PORT}/_pit`, {
|
||||
data: { id: pitID },
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
})
|
||||
.pipe(take(1), map(axiosRes => axiosRes.data))
|
||||
.subscribe((res) => {
|
||||
resolve(res.succeeded);
|
||||
});
|
||||
} catch (error) {
|
||||
reject(error);
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
/*
|
||||
public saveInfo(pit: EsPit, tiebreaker: unknown[], page: number) {
|
||||
this.pit.id = pit.id;
|
||||
this.pit.keep_alive = pit.keep_alive;
|
||||
|
||||
this.tiebreaker = tiebreaker.slice();
|
||||
|
||||
this.prevPage = page;
|
||||
}
|
||||
|
||||
public clearInfo() {
|
||||
this.pit = undefined;
|
||||
this.tiebreaker = undefined;
|
||||
this.prevPage = -1;
|
||||
}*/
|
||||
|
||||
// getQueryParams(str: string): any {
|
||||
// let parameters: object = {};
|
||||
// let pairs: string[] = str.split(',');
|
||||
// parameters['main'] = pairs[0];
|
||||
// pairs.shift();
|
||||
|
||||
// if(!pairs || pairs[0] === '') return parameters;
|
||||
|
||||
// for (const pair of pairs) {
|
||||
// const key: string = pair.substring(0, pair.indexOf('='));
|
||||
// const value: string = pair.substring(pair.indexOf('=') + 1);
|
||||
// parameters[key] = value;
|
||||
// }
|
||||
|
||||
// return parameters;
|
||||
// }
|
||||
|
||||
|
||||
/**
|
||||
* OLD WAY PAGINATION
|
||||
* // Setting the page data
|
||||
// const data = res.hits.slice((meta.pagenum - 1) * meta.pagesize, meta.pagenum * meta.pagesize);
|
||||
*/
|
||||
|
||||
|
||||
// if (query.page == 1) {
|
||||
// this.prevSearch.pit = request.es_query.pit = await this.getPIT(1);
|
||||
// } else {
|
||||
// if (!this.prevSearch.isSet()) {
|
||||
// this.prevSearch.pit = request.es_query.pit = await this.getPIT(1);
|
||||
|
||||
// request.es_query.size = query.limit * (query.page - 1);
|
||||
// this.searchService.findByContext(request.es_query).then((res: SearchResultDto) => {
|
||||
// request.es_query.search_after = res.data.hits.hits[res.data.hits.hits.length - 1].sort;
|
||||
// });
|
||||
// } else {
|
||||
// if (query.page == this.prevSearch.prevPage) {
|
||||
// return;
|
||||
// } else {
|
||||
// request.es_query.pit = this.prevSearch.pit;
|
||||
// request.es_query.search_after = this.prevSearch.tiebreaker;
|
||||
// request.es_query.size = (query.page - this.prevSearch.prevPage);
|
||||
// }
|
||||
|
||||
// // request.es_query.pit = this.prevSearch.pit;
|
||||
// // request.es_query.search_after = this.prevSearch.tiebreaker;
|
||||
// }
|
||||
// }
|
||||
</code></pre>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div><div class="search-results">
|
||||
<div class="has-results">
|
||||
<h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
|
||||
<ul class="search-results-list"></ul>
|
||||
</div>
|
||||
<div class="no-results">
|
||||
<h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- END CONTENT -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<label class="dark-mode-switch">
|
||||
<input type="checkbox">
|
||||
<span class="slider">
|
||||
<svg class="slider-icon" viewBox="0 0 24 24" fill="none" height="20" stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" width="20" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M21 12.79A9 9 0 1111.21 3 7 7 0 0021 12.79z"></path>
|
||||
</svg>
|
||||
</span>
|
||||
</label>
|
||||
|
||||
<script>
|
||||
var COMPODOC_CURRENT_PAGE_DEPTH = 1;
|
||||
var COMPODOC_CURRENT_PAGE_CONTEXT = 'class';
|
||||
var COMPODOC_CURRENT_PAGE_URL = 'PrevSearch.html';
|
||||
var MAX_SEARCH_RESULTS = 15;
|
||||
</script>
|
||||
|
||||
<script src="../js/libs/custom-elements.min.js"></script>
|
||||
<script src="../js/libs/lit-html.js"></script>
|
||||
|
||||
<script src="../js/menu-wc.js" defer></script>
|
||||
<script nomodule src="../js/menu-wc_es5.js" defer></script>
|
||||
|
||||
<script src="../js/libs/bootstrap-native.js"></script>
|
||||
|
||||
<script src="../js/libs/es6-shim.min.js"></script>
|
||||
<script src="../js/libs/EventDispatcher.js"></script>
|
||||
<script src="../js/libs/promise.min.js"></script>
|
||||
<script src="../js/libs/zepto.min.js"></script>
|
||||
|
||||
<script src="../js/compodoc.js"></script>
|
||||
|
||||
<script src="../js/tabs.js"></script>
|
||||
<script src="../js/menu.js"></script>
|
||||
<script src="../js/libs/clipboard.min.js"></script>
|
||||
<script src="../js/libs/prism.js"></script>
|
||||
<script src="../js/sourceCode.js"></script>
|
||||
<script src="../js/search/search.js"></script>
|
||||
<script src="../js/search/lunr.min.js"></script>
|
||||
<script src="../js/search/search-lunr.js"></script>
|
||||
<script src="../js/search/search_index.js"></script>
|
||||
<script src="../js/lazy-load-graphs.js"></script>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
390
documentation/classes/RequestDto.html
Normal file
390
documentation/classes/RequestDto.html
Normal file
@ -0,0 +1,390 @@
|
||||
<!doctype html>
|
||||
<html class="no-js" lang="">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="x-ua-compatible" content="ie=edge">
|
||||
<title>hometask documentation</title>
|
||||
<meta name="description" content="">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
|
||||
<link rel="icon" type="image/x-icon" href="../images/favicon.ico">
|
||||
<link rel="stylesheet" href="../styles/style.css">
|
||||
<link rel="stylesheet" href="../styles/dark.css">
|
||||
<link rel="stylesheet" href="../styles/readthedocs.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="navbar navbar-default navbar-fixed-top visible-xs">
|
||||
<a href="../" class="navbar-brand">hometask documentation</a>
|
||||
<button type="button" class="btn btn-default btn-menu ion-ios-menu" id="btn-menu"></button>
|
||||
</div>
|
||||
|
||||
<div class="xs-menu menu" id="mobile-menu">
|
||||
<div id="book-search-input" role="search"><input type="text" placeholder="Type to search"></div> <compodoc-menu></compodoc-menu>
|
||||
</div>
|
||||
|
||||
<div class="container-fluid main">
|
||||
<div class="row main">
|
||||
<div class="hidden-xs menu">
|
||||
<compodoc-menu mode="normal"></compodoc-menu>
|
||||
</div>
|
||||
<!-- START CONTENT -->
|
||||
<div class="content class">
|
||||
<div class="content-data">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<ol class="breadcrumb">
|
||||
<li>Classes</li>
|
||||
<li >RequestDto</li>
|
||||
</ol>
|
||||
|
||||
<ul class="nav nav-tabs" role="tablist">
|
||||
<li class="active">
|
||||
<a href="#info" role="tab" id="info-tab" data-toggle="tab" data-link="info">Info</a>
|
||||
</li>
|
||||
<li >
|
||||
<a href="#source" role="tab" id="source-tab" data-toggle="tab" data-link="source">Source</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane fade active in" id="c-info">
|
||||
<p class="comment">
|
||||
<h3>File</h3>
|
||||
</p>
|
||||
<p class="comment">
|
||||
<code>src/core/domain/dtos/request.dto.ts</code>
|
||||
</p>
|
||||
|
||||
|
||||
<p class="comment">
|
||||
<h3>Description</h3>
|
||||
</p>
|
||||
<p class="comment">
|
||||
<p>Request object, which contains query parameters and Elasticsearch query object</p>
|
||||
|
||||
</p>
|
||||
|
||||
|
||||
|
||||
|
||||
<section>
|
||||
<h3 id="index">Index</h3>
|
||||
<table class="table table-sm table-bordered index-table">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<h6><b>Properties</b></h6>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<ul class="index-list">
|
||||
<li>
|
||||
<span class="modifier">Optional</span>
|
||||
<a href="#es_query" >es_query</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#query" >query</a>
|
||||
</li>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<h3 id="constructor">Constructor</h3>
|
||||
<table class="table table-sm table-bordered">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<code>constructor(query: <a href="../classes/SearchQueryDto.html" target="_self">SearchQueryDto</a>, es_query: <a href="../interfaces/EsQuery.html" target="_self">EsQueryDto</a>)</code>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-line">Defined in <a href="" data-line="34" class="link-to-prism">src/core/domain/dtos/request.dto.ts:34</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-description"><p>Constructs an object with provided parameters</p>
|
||||
</div>
|
||||
<div>
|
||||
<b>Parameters :</b>
|
||||
<table class="params">
|
||||
<thead>
|
||||
<tr>
|
||||
<td>Name</td>
|
||||
<td>Type</td>
|
||||
<td>Optional</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>query</td>
|
||||
|
||||
<td>
|
||||
<code><a href="../classes/SearchQueryDto.html" target="_self" >SearchQueryDto</a></code>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
No
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
<tr>
|
||||
<td>es_query</td>
|
||||
|
||||
<td>
|
||||
<code><a href="../interfaces/EsQuery.html" target="_self" >EsQueryDto</a></code>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
No
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
|
||||
<h3 id="inputs">
|
||||
Properties
|
||||
</h3>
|
||||
<table class="table table-sm table-bordered">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<a name="es_query"></a>
|
||||
<span class="name">
|
||||
<span class="modifier">Optional</span>
|
||||
<span ><b>es_query</b></span>
|
||||
<a href="#es_query"><span class="icon ion-ios-link"></span></a>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<i>Type : </i> <code><a href="../interfaces/EsQuery.html" target="_self" >EsQueryDto</a></code>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<b>Decorators : </b>
|
||||
<br />
|
||||
<code>
|
||||
@IsOptional()<br />@ApiProperty({description: '', example: undefined})<br />
|
||||
</code>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-line">Defined in <a href="" data-line="34" class="link-to-prism">src/core/domain/dtos/request.dto.ts:34</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-description"><p>Elasticsearch query object</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
<table class="table table-sm table-bordered">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<a name="query"></a>
|
||||
<span class="name">
|
||||
<span ><b>query</b></span>
|
||||
<a href="#query"><span class="icon ion-ios-link"></span></a>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<i>Type : </i> <code><a href="../classes/SearchQueryDto.html" target="_self" >SearchQueryDto</a></code>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<b>Decorators : </b>
|
||||
<br />
|
||||
<code>
|
||||
@IsDefined()<br />@IsNotEmpty()<br />@ApiProperty({description: '', example: undefined})<br />
|
||||
</code>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-line">Defined in <a href="" data-line="24" class="link-to-prism">src/core/domain/dtos/request.dto.ts:24</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-description"><p>Query parameters object</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="tab-pane fade tab-source-code" id="c-source">
|
||||
<pre class="line-numbers compodoc-sourcecode"><code class="language-typescript">import { ApiProperty } from "@nestjs/swagger";
|
||||
import { IsDefined, IsIn, IsInt, IsNotEmpty, IsOptional, IsString } from "class-validator";
|
||||
import { EsQueryDto } from "./es-query.dto";
|
||||
import { SearchQueryDto } from "./search-q.dto";
|
||||
|
||||
/**
|
||||
* List of allowed properties in this DTO
|
||||
*/
|
||||
const allowedProperties = ['query', 'es_query'];
|
||||
|
||||
/**
|
||||
* Request object, which contains query parameters and Elasticsearch query object
|
||||
*/
|
||||
export class RequestDto {
|
||||
/**
|
||||
* Query parameters object
|
||||
*/
|
||||
@IsDefined()
|
||||
@IsNotEmpty()
|
||||
@ApiProperty({
|
||||
description: '',
|
||||
example: {}
|
||||
})
|
||||
query: SearchQueryDto;
|
||||
|
||||
/**
|
||||
* Elasticsearch query object
|
||||
*/
|
||||
@IsOptional()
|
||||
@ApiProperty({
|
||||
description: '',
|
||||
example: {},
|
||||
})
|
||||
es_query?: EsQueryDto;
|
||||
|
||||
/**
|
||||
* Constructs an object with provided parameters
|
||||
* @param query
|
||||
* @param es_query
|
||||
*/
|
||||
constructor(query: SearchQueryDto, es_query: EsQueryDto) {
|
||||
this.query = query;
|
||||
this.es_query = es_query;
|
||||
}
|
||||
}</code></pre>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div><div class="search-results">
|
||||
<div class="has-results">
|
||||
<h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
|
||||
<ul class="search-results-list"></ul>
|
||||
</div>
|
||||
<div class="no-results">
|
||||
<h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- END CONTENT -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<label class="dark-mode-switch">
|
||||
<input type="checkbox">
|
||||
<span class="slider">
|
||||
<svg class="slider-icon" viewBox="0 0 24 24" fill="none" height="20" stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" width="20" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M21 12.79A9 9 0 1111.21 3 7 7 0 0021 12.79z"></path>
|
||||
</svg>
|
||||
</span>
|
||||
</label>
|
||||
|
||||
<script>
|
||||
var COMPODOC_CURRENT_PAGE_DEPTH = 1;
|
||||
var COMPODOC_CURRENT_PAGE_CONTEXT = 'class';
|
||||
var COMPODOC_CURRENT_PAGE_URL = 'RequestDto.html';
|
||||
var MAX_SEARCH_RESULTS = 15;
|
||||
</script>
|
||||
|
||||
<script src="../js/libs/custom-elements.min.js"></script>
|
||||
<script src="../js/libs/lit-html.js"></script>
|
||||
|
||||
<script src="../js/menu-wc.js" defer></script>
|
||||
<script nomodule src="../js/menu-wc_es5.js" defer></script>
|
||||
|
||||
<script src="../js/libs/bootstrap-native.js"></script>
|
||||
|
||||
<script src="../js/libs/es6-shim.min.js"></script>
|
||||
<script src="../js/libs/EventDispatcher.js"></script>
|
||||
<script src="../js/libs/promise.min.js"></script>
|
||||
<script src="../js/libs/zepto.min.js"></script>
|
||||
|
||||
<script src="../js/compodoc.js"></script>
|
||||
|
||||
<script src="../js/tabs.js"></script>
|
||||
<script src="../js/menu.js"></script>
|
||||
<script src="../js/libs/clipboard.min.js"></script>
|
||||
<script src="../js/libs/prism.js"></script>
|
||||
<script src="../js/sourceCode.js"></script>
|
||||
<script src="../js/search/search.js"></script>
|
||||
<script src="../js/search/lunr.min.js"></script>
|
||||
<script src="../js/search/search-lunr.js"></script>
|
||||
<script src="../js/search/search_index.js"></script>
|
||||
<script src="../js/lazy-load-graphs.js"></script>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
@ -115,12 +115,12 @@
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<code>constructor(code: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/number" target="_blank">number</a>, data: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/object" target="_blank">object</a>)</code>
|
||||
<code>constructor(code: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/number" target="_blank">number</a>, data: <a href="../classes/EsResponseDto.html" target="_self">EsResponseDto</a>)</code>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-line">Defined in <a href="" data-line="37" class="link-to-prism">src/core/domain/dtos/search-result.dto.ts:37</a></div>
|
||||
<div class="io-line">Defined in <a href="" data-line="38" class="link-to-prism">src/core/domain/dtos/search-result.dto.ts:38</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@ -155,7 +155,7 @@
|
||||
<td>data</td>
|
||||
|
||||
<td>
|
||||
<code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/object" target="_blank" >object</a></code>
|
||||
<code><a href="../classes/EsResponseDto.html" target="_self" >EsResponseDto</a></code>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
@ -190,7 +190,7 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<i>Type : </i> <code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/object" target="_blank" >object</a></code>
|
||||
<i>Type : </i> <code><a href="../classes/EsResponseDto.html" target="_self" >EsResponseDto</a></code>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
@ -205,7 +205,7 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-line">Defined in <a href="" data-line="37" class="link-to-prism">src/core/domain/dtos/search-result.dto.ts:37</a></div>
|
||||
<div class="io-line">Defined in <a href="" data-line="38" class="link-to-prism">src/core/domain/dtos/search-result.dto.ts:38</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@ -246,7 +246,7 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-line">Defined in <a href="" data-line="23" class="link-to-prism">src/core/domain/dtos/search-result.dto.ts:23</a></div>
|
||||
<div class="io-line">Defined in <a href="" data-line="24" class="link-to-prism">src/core/domain/dtos/search-result.dto.ts:24</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@ -273,6 +273,7 @@
|
||||
<div class="tab-pane fade tab-source-code" id="c-source">
|
||||
<pre class="line-numbers compodoc-sourcecode"><code class="language-typescript">import { ApiProperty } from "@nestjs/swagger";
|
||||
import { IsArray, IsDefined, IsInt, IsNotEmpty, IsOptional, IsString } from "class-validator";
|
||||
import { EsResponseDto } from "./es-response.dto";
|
||||
|
||||
/**
|
||||
* List of allowed properties in this DTO
|
||||
@ -307,14 +308,14 @@ export class SearchResultDto {
|
||||
|
||||
},
|
||||
})
|
||||
data: object;
|
||||
data: EsResponseDto;
|
||||
|
||||
/**
|
||||
* Constructs an object with provided parameters
|
||||
* @param code
|
||||
* @param data
|
||||
*/
|
||||
constructor(code: number, data: object) {
|
||||
constructor(code: number, data: EsResponseDto) {
|
||||
this.statusCode = code;
|
||||
this.data = data;
|
||||
}
|
||||
|
@ -127,7 +127,7 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<code>getByContext(query)</code>
|
||||
<code>getByContext(query: <a href="../classes/RequestDto.html" target="_self">RequestDto</a>)</code>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@ -141,8 +141,8 @@
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-line">Defined in <a href="" data-line="32"
|
||||
class="link-to-prism">src/application/controller/papers.controller.ts:32</a></div>
|
||||
<div class="io-line">Defined in <a href="" data-line="30"
|
||||
class="link-to-prism">src/application/controller/papers.controller.ts:30</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@ -159,12 +159,16 @@
|
||||
<thead>
|
||||
<tr>
|
||||
<td>Name</td>
|
||||
<td>Type</td>
|
||||
<td>Optional</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>query</td>
|
||||
<td>
|
||||
<code><a href="../classes/RequestDto.html" target="_self" >RequestDto</a></code>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
No
|
||||
@ -216,8 +220,8 @@
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-line">Defined in <a href="" data-line="58"
|
||||
class="link-to-prism">src/application/controller/papers.controller.ts:58</a></div>
|
||||
<div class="io-line">Defined in <a href="" data-line="56"
|
||||
class="link-to-prism">src/application/controller/papers.controller.ts:56</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@ -274,12 +278,10 @@
|
||||
<div class="tab-pane fade tab-source-code" id="c-source">
|
||||
<pre class="line-numbers compodoc-sourcecode"><code class="language-typescript">import { Controller, Get, HttpCode, HttpException, Next, Param, ParseUUIDPipe, Put, Query, Req, Res, UseInterceptors } from "@nestjs/common";
|
||||
import { SearchService } from "../../core/services/common/search.service";
|
||||
import { Response } from "express";
|
||||
import { PageInterceptor } from "src/core/interceptors/page.interceptor";
|
||||
import { LoggerInterceptor } from "src/core/interceptors";
|
||||
import { SearchResultDto } from "src/core/domain/dtos/search-result.dto";
|
||||
import { ApiOperation, ApiResponse } from "@nestjs/swagger";
|
||||
import { SearchQueryDto } from "src/core/domain/dtos";
|
||||
import { RequestDto } from "src/core/domain/dtos/request.dto";
|
||||
|
||||
/**
|
||||
* /papers/ route controller
|
||||
@ -303,8 +305,8 @@ export class PapersController {
|
||||
@Get('search')
|
||||
@UseInterceptors(PageInterceptor)
|
||||
@HttpCode(200)
|
||||
getByContext(@Query() query): object {
|
||||
return this.searchService.findByContext(query.query).then(
|
||||
getByContext(@Req() query: RequestDto): object {
|
||||
return this.searchService.findByContext(query.es_query).then(
|
||||
(response: SearchResultDto) => {
|
||||
return response.data;
|
||||
},
|
||||
|
@ -140,6 +140,30 @@
|
||||
<span class="coverage-count">(1/1)</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="very-good">
|
||||
<td>
|
||||
<!-- miscellaneous -->
|
||||
<a href="./classes/EsHitDto.html">src/core/domain/dtos/es-hit.dto.ts</a>
|
||||
</td>
|
||||
<td>class</td>
|
||||
<td>EsHitDto</td>
|
||||
<td align="right" data-sort="100">
|
||||
<span class="coverage-percent">100 %</span>
|
||||
<span class="coverage-count">(4/4)</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="very-good">
|
||||
<td>
|
||||
<!-- miscellaneous -->
|
||||
<a href="./miscellaneous/variables.html#allowedProperties">src/core/domain/dtos/es-hit.dto.ts</a>
|
||||
</td>
|
||||
<td>variable</td>
|
||||
<td>allowedProperties</td>
|
||||
<td align="right" data-sort="100">
|
||||
<span class="coverage-percent">100 %</span>
|
||||
<span class="coverage-count">(1/1)</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="very-good">
|
||||
<td>
|
||||
<!-- miscellaneous -->
|
||||
@ -149,7 +173,7 @@
|
||||
<td>EsQueryDto</td>
|
||||
<td align="right" data-sort="100">
|
||||
<span class="coverage-percent">100 %</span>
|
||||
<span class="coverage-count">(5/5)</span>
|
||||
<span class="coverage-count">(7/7)</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="very-good">
|
||||
@ -173,7 +197,7 @@
|
||||
<td>EsResponseDto</td>
|
||||
<td align="right" data-sort="100">
|
||||
<span class="coverage-percent">100 %</span>
|
||||
<span class="coverage-count">(5/5)</span>
|
||||
<span class="coverage-count">(6/6)</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="very-good">
|
||||
@ -212,6 +236,54 @@
|
||||
<span class="coverage-count">(1/1)</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="very-good">
|
||||
<td>
|
||||
<!-- miscellaneous -->
|
||||
<a href="./classes/PaperDto.html">src/core/domain/dtos/paper.dto.ts</a>
|
||||
</td>
|
||||
<td>class</td>
|
||||
<td>PaperDto</td>
|
||||
<td align="right" data-sort="100">
|
||||
<span class="coverage-percent">100 %</span>
|
||||
<span class="coverage-count">(8/8)</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="very-good">
|
||||
<td>
|
||||
<!-- miscellaneous -->
|
||||
<a href="./miscellaneous/variables.html#allowedProperties">src/core/domain/dtos/paper.dto.ts</a>
|
||||
</td>
|
||||
<td>variable</td>
|
||||
<td>allowedProperties</td>
|
||||
<td align="right" data-sort="100">
|
||||
<span class="coverage-percent">100 %</span>
|
||||
<span class="coverage-count">(1/1)</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="very-good">
|
||||
<td>
|
||||
<!-- miscellaneous -->
|
||||
<a href="./classes/RequestDto.html">src/core/domain/dtos/request.dto.ts</a>
|
||||
</td>
|
||||
<td>class</td>
|
||||
<td>RequestDto</td>
|
||||
<td align="right" data-sort="100">
|
||||
<span class="coverage-percent">100 %</span>
|
||||
<span class="coverage-count">(4/4)</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="very-good">
|
||||
<td>
|
||||
<!-- miscellaneous -->
|
||||
<a href="./miscellaneous/variables.html#allowedProperties">src/core/domain/dtos/request.dto.ts</a>
|
||||
</td>
|
||||
<td>variable</td>
|
||||
<td>allowedProperties</td>
|
||||
<td align="right" data-sort="100">
|
||||
<span class="coverage-percent">100 %</span>
|
||||
<span class="coverage-count">(1/1)</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="very-good">
|
||||
<td>
|
||||
<!-- miscellaneous -->
|
||||
@ -260,6 +332,54 @@
|
||||
<span class="coverage-count">(1/1)</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="very-good">
|
||||
<td>
|
||||
<!-- miscellaneous -->
|
||||
<a href="./interfaces/EsPit.html">src/core/domain/interfaces/es-pit.interface.ts</a>
|
||||
</td>
|
||||
<td>interface</td>
|
||||
<td>EsPit</td>
|
||||
<td align="right" data-sort="100">
|
||||
<span class="coverage-percent">100 %</span>
|
||||
<span class="coverage-count">(3/3)</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="very-good">
|
||||
<td>
|
||||
<!-- miscellaneous -->
|
||||
<a href="./interfaces/EqQueryString.html">src/core/domain/interfaces/es-query-string.interface.ts</a>
|
||||
</td>
|
||||
<td>interface</td>
|
||||
<td>EqQueryString</td>
|
||||
<td align="right" data-sort="100">
|
||||
<span class="coverage-percent">100 %</span>
|
||||
<span class="coverage-count">(4/4)</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="very-good">
|
||||
<td>
|
||||
<!-- miscellaneous -->
|
||||
<a href="./interfaces/EsQuery.html">src/core/domain/interfaces/es-query.interface.ts</a>
|
||||
</td>
|
||||
<td>interface</td>
|
||||
<td>EsQuery</td>
|
||||
<td align="right" data-sort="100">
|
||||
<span class="coverage-percent">100 %</span>
|
||||
<span class="coverage-count">(2/2)</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="very-good">
|
||||
<td>
|
||||
<!-- miscellaneous -->
|
||||
<a href="./interfaces/EsResponseHits.html">src/core/domain/interfaces/es-response-hits.interface.ts</a>
|
||||
</td>
|
||||
<td>interface</td>
|
||||
<td>EsResponseHits</td>
|
||||
<td align="right" data-sort="100">
|
||||
<span class="coverage-percent">100 %</span>
|
||||
<span class="coverage-count">(4/4)</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="very-good">
|
||||
<td>
|
||||
<!-- miscellaneous -->
|
||||
@ -284,6 +404,18 @@
|
||||
<span class="coverage-count">(7/7)</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="very-good">
|
||||
<td>
|
||||
<!-- miscellaneous -->
|
||||
<a href="./interfaces/SearchInfo.html">src/core/domain/interfaces/search-info.interface.ts</a>
|
||||
</td>
|
||||
<td>interface</td>
|
||||
<td>SearchInfo</td>
|
||||
<td align="right" data-sort="100">
|
||||
<span class="coverage-percent">100 %</span>
|
||||
<span class="coverage-count">(3/3)</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="very-good">
|
||||
<td>
|
||||
<!-- miscellaneous -->
|
||||
@ -392,6 +524,18 @@
|
||||
<span class="coverage-count">(4/4)</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="very-good">
|
||||
<td>
|
||||
<!-- miscellaneous -->
|
||||
<a href="./classes/PrevSearch.html">src/core/interceptors/page.interceptor.ts</a>
|
||||
</td>
|
||||
<td>class</td>
|
||||
<td>PrevSearch</td>
|
||||
<td align="right" data-sort="100">
|
||||
<span class="coverage-percent">100 %</span>
|
||||
<span class="coverage-count">(6/6)</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="very-good">
|
||||
<td>
|
||||
<!-- miscellaneous -->
|
||||
@ -401,7 +545,7 @@
|
||||
<td>PageInterceptor</td>
|
||||
<td align="right" data-sort="100">
|
||||
<span class="coverage-percent">100 %</span>
|
||||
<span class="coverage-count">(2/2)</span>
|
||||
<span class="coverage-count">(7/7)</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="very-good">
|
||||
@ -449,7 +593,7 @@
|
||||
<td>SearchService</td>
|
||||
<td align="right" data-sort="100">
|
||||
<span class="coverage-percent">100 %</span>
|
||||
<span class="coverage-count">(7/7)</span>
|
||||
<span class="coverage-count">(5/5)</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="very-good">
|
||||
|
@ -4,217 +4,217 @@
|
||||
<!-- Generated by graphviz version 5.0.0 (20220707.1540)
|
||||
-->
|
||||
<!-- Title: dependencies Pages: 1 -->
|
||||
<svg width="876pt" height="413pt"
|
||||
viewBox="0.00 0.00 876.00 412.80" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 408.8)">
|
||||
<svg width="1164pt" height="261pt"
|
||||
viewBox="0.00 0.00 1164.00 260.80" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 256.8)">
|
||||
<title>dependencies</title>
|
||||
<polygon fill="white" stroke="transparent" points="-4,4 -4,-408.8 872,-408.8 872,4 -4,4"/>
|
||||
<text text-anchor="middle" x="434" y="-8.2" font-family="sans-serif" font-size="14.00">dependencies</text>
|
||||
<polygon fill="white" stroke="transparent" points="-4,4 -4,-256.8 1160,-256.8 1160,4 -4,4"/>
|
||||
<text text-anchor="middle" x="578" y="-8.2" font-family="sans-serif" font-size="14.00">dependencies</text>
|
||||
<g id="clust1" class="cluster">
|
||||
<title>cluster_AppModule</title>
|
||||
<polygon fill="none" stroke="black" stroke-dasharray="1,5" points="100,-176.8 100,-312.8 360,-312.8 360,-176.8 100,-176.8"/>
|
||||
<polygon fill="none" stroke="black" stroke-dasharray="1,5" points="8,-32.8 8,-160.8 268,-160.8 268,-32.8 8,-32.8"/>
|
||||
</g>
|
||||
<g id="clust3" class="cluster">
|
||||
<title>cluster_AppModule_imports</title>
|
||||
<polygon fill="none" stroke="black" points="108,-184.8 108,-236.8 352,-236.8 352,-184.8 108,-184.8"/>
|
||||
</g>
|
||||
<g id="clust19" class="cluster">
|
||||
<title>cluster_HttpResponseModule</title>
|
||||
<polygon fill="none" stroke="black" stroke-dasharray="1,5" points="368,-32.8 368,-244.8 588,-244.8 588,-32.8 368,-32.8"/>
|
||||
</g>
|
||||
<g id="clust22" class="cluster">
|
||||
<title>cluster_HttpResponseModule_exports</title>
|
||||
<polygon fill="none" stroke="black" points="388,-184.8 388,-236.8 544,-236.8 544,-184.8 388,-184.8"/>
|
||||
</g>
|
||||
<g id="clust24" class="cluster">
|
||||
<title>cluster_HttpResponseModule_providers</title>
|
||||
<polygon fill="none" stroke="black" points="376,-40.8 376,-92.8 580,-92.8 580,-40.8 376,-40.8"/>
|
||||
<polygon fill="none" stroke="black" points="16,-40.8 16,-92.8 260,-92.8 260,-40.8 16,-40.8"/>
|
||||
</g>
|
||||
<g id="clust7" class="cluster">
|
||||
<title>cluster_CommonModule</title>
|
||||
<polygon fill="none" stroke="black" stroke-dasharray="1,5" points="368,-252.8 368,-320.8 788,-320.8 788,-252.8 368,-252.8"/>
|
||||
<polygon fill="none" stroke="black" stroke-dasharray="1,5" points="276,-100.8 276,-168.8 852,-168.8 852,-100.8 276,-100.8"/>
|
||||
</g>
|
||||
<g id="clust9" class="cluster">
|
||||
<title>cluster_CommonModule_imports</title>
|
||||
<polygon fill="none" stroke="black" points="664,-260.8 664,-312.8 780,-312.8 780,-260.8 664,-260.8"/>
|
||||
<polygon fill="none" stroke="black" points="572,-108.8 572,-160.8 844,-160.8 844,-108.8 572,-108.8"/>
|
||||
</g>
|
||||
<g id="clust10" class="cluster">
|
||||
<title>cluster_CommonModule_exports</title>
|
||||
<polygon fill="none" stroke="black" points="376,-260.8 376,-312.8 656,-312.8 656,-260.8 376,-260.8"/>
|
||||
<polygon fill="none" stroke="black" points="284,-108.8 284,-160.8 564,-160.8 564,-108.8 284,-108.8"/>
|
||||
</g>
|
||||
<g id="clust19" class="cluster">
|
||||
<title>cluster_HttpResponseModule</title>
|
||||
<polygon fill="none" stroke="black" stroke-dasharray="1,5" points="330,-176.8 330,-244.8 714,-244.8 714,-176.8 330,-176.8"/>
|
||||
</g>
|
||||
<g id="clust22" class="cluster">
|
||||
<title>cluster_HttpResponseModule_exports</title>
|
||||
<polygon fill="none" stroke="black" points="550,-184.8 550,-236.8 706,-236.8 706,-184.8 550,-184.8"/>
|
||||
</g>
|
||||
<g id="clust24" class="cluster">
|
||||
<title>cluster_HttpResponseModule_providers</title>
|
||||
<polygon fill="none" stroke="black" points="338,-184.8 338,-236.8 542,-236.8 542,-184.8 338,-184.8"/>
|
||||
</g>
|
||||
<g id="clust25" class="cluster">
|
||||
<title>cluster_LoggerModule</title>
|
||||
<polygon fill="none" stroke="black" stroke-dasharray="1,5" points="566,-328.8 566,-396.8 860,-396.8 860,-328.8 566,-328.8"/>
|
||||
<polygon fill="none" stroke="black" stroke-dasharray="1,5" points="722,-176.8 722,-244.8 1016,-244.8 1016,-176.8 722,-176.8"/>
|
||||
</g>
|
||||
<g id="clust28" class="cluster">
|
||||
<title>cluster_LoggerModule_exports</title>
|
||||
<polygon fill="none" stroke="black" points="734,-336.8 734,-388.8 852,-388.8 852,-336.8 734,-336.8"/>
|
||||
<polygon fill="none" stroke="black" points="890,-184.8 890,-236.8 1008,-236.8 1008,-184.8 890,-184.8"/>
|
||||
</g>
|
||||
<g id="clust30" class="cluster">
|
||||
<title>cluster_LoggerModule_providers</title>
|
||||
<polygon fill="none" stroke="black" points="574,-336.8 574,-388.8 726,-388.8 726,-336.8 574,-336.8"/>
|
||||
<polygon fill="none" stroke="black" points="730,-184.8 730,-236.8 882,-236.8 882,-184.8 730,-184.8"/>
|
||||
</g>
|
||||
<g id="clust31" class="cluster">
|
||||
<title>cluster_SearchModule</title>
|
||||
<polygon fill="none" stroke="black" stroke-dasharray="1,5" points="8,-100.8 8,-168.8 296,-168.8 296,-100.8 8,-100.8"/>
|
||||
<polygon fill="none" stroke="black" stroke-dasharray="1,5" points="860,-100.8 860,-168.8 1148,-168.8 1148,-100.8 860,-100.8"/>
|
||||
</g>
|
||||
<g id="clust34" class="cluster">
|
||||
<title>cluster_SearchModule_exports</title>
|
||||
<polygon fill="none" stroke="black" points="172,-108.8 172,-160.8 288,-160.8 288,-108.8 172,-108.8"/>
|
||||
<polygon fill="none" stroke="black" points="1024,-108.8 1024,-160.8 1140,-160.8 1140,-108.8 1024,-108.8"/>
|
||||
</g>
|
||||
<g id="clust36" class="cluster">
|
||||
<title>cluster_SearchModule_providers</title>
|
||||
<polygon fill="none" stroke="black" points="16,-108.8 16,-160.8 164,-160.8 164,-108.8 16,-108.8"/>
|
||||
<polygon fill="none" stroke="black" points="868,-108.8 868,-160.8 1016,-160.8 1016,-108.8 868,-108.8"/>
|
||||
</g>
|
||||
<!-- CommonModule -->
|
||||
<g id="node1" class="node">
|
||||
<title>CommonModule</title>
|
||||
<polygon fill="#8dd3c7" stroke="black" points="343.67,-228.8 340.67,-232.8 319.67,-232.8 316.67,-228.8 232.33,-228.8 232.33,-192.8 343.67,-192.8 343.67,-228.8"/>
|
||||
<text text-anchor="middle" x="288" y="-206.6" font-family="Times,serif" font-size="14.00">CommonModule</text>
|
||||
<polygon fill="#8dd3c7" stroke="black" points="135.67,-84.8 132.67,-88.8 111.67,-88.8 108.67,-84.8 24.33,-84.8 24.33,-48.8 135.67,-48.8 135.67,-84.8"/>
|
||||
<text text-anchor="middle" x="80" y="-62.6" font-family="Times,serif" font-size="14.00">CommonModule</text>
|
||||
</g>
|
||||
<!-- AppModule -->
|
||||
<g id="node3" class="node">
|
||||
<title>AppModule</title>
|
||||
<polygon fill="#8dd3c7" stroke="black" points="267.66,-304.8 264.66,-308.8 243.66,-308.8 240.66,-304.8 184.34,-304.8 184.34,-268.8 267.66,-268.8 267.66,-304.8"/>
|
||||
<text text-anchor="middle" x="226" y="-282.6" font-family="Times,serif" font-size="14.00">AppModule</text>
|
||||
<polygon fill="#8dd3c7" stroke="black" points="182.66,-152.8 179.66,-156.8 158.66,-156.8 155.66,-152.8 99.34,-152.8 99.34,-116.8 182.66,-116.8 182.66,-152.8"/>
|
||||
<text text-anchor="middle" x="141" y="-130.6" font-family="Times,serif" font-size="14.00">AppModule</text>
|
||||
</g>
|
||||
<!-- CommonModule->AppModule -->
|
||||
<g id="edge1" class="edge">
|
||||
<title>CommonModule->AppModule</title>
|
||||
<path fill="none" stroke="black" d="M250,-228.81C250,-228.81 250,-258.65 250,-258.65"/>
|
||||
<polygon fill="black" stroke="black" points="246.5,-258.65 250,-268.65 253.5,-258.65 246.5,-258.65"/>
|
||||
<path fill="none" stroke="black" d="M105.28,-85.02C105.28,-85.02 105.28,-106.53 105.28,-106.53"/>
|
||||
<polygon fill="black" stroke="black" points="101.78,-106.53 105.28,-116.53 108.78,-106.53 101.78,-106.53"/>
|
||||
</g>
|
||||
<!-- HttpResponseModule -->
|
||||
<g id="node6" class="node">
|
||||
<title>HttpResponseModule </title>
|
||||
<polygon fill="#fb8072" stroke="black" points="647.6,-304.8 506.4,-304.8 506.4,-268.8 647.6,-268.8 647.6,-304.8"/>
|
||||
<text text-anchor="middle" x="577" y="-282.6" font-family="Times,serif" font-size="14.00">HttpResponseModule </text>
|
||||
<polygon fill="#fb8072" stroke="black" points="555.6,-152.8 414.4,-152.8 414.4,-116.8 555.6,-116.8 555.6,-152.8"/>
|
||||
<text text-anchor="middle" x="485" y="-130.6" font-family="Times,serif" font-size="14.00">HttpResponseModule </text>
|
||||
</g>
|
||||
<!-- CommonModule->HttpResponseModule -->
|
||||
<g id="edge5" class="edge">
|
||||
<title>CommonModule->HttpResponseModule </title>
|
||||
<path fill="none" stroke="black" stroke-dasharray="5,2" d="M318.5,-228.84C318.5,-241.36 318.5,-255.8 318.5,-255.8 318.5,-255.8 521.11,-255.8 521.11,-255.8 521.11,-255.8 521.11,-258.77 521.11,-258.77"/>
|
||||
<polygon fill="black" stroke="black" points="517.61,-258.77 521.11,-268.77 524.61,-258.77 517.61,-258.77"/>
|
||||
<path fill="none" stroke="black" stroke-dasharray="5,2" d="M129.72,-84.91C129.72,-94.7 129.72,-104.8 129.72,-104.8 129.72,-104.8 485,-104.8 485,-104.8 485,-104.8 485,-106.66 485,-106.66"/>
|
||||
<polygon fill="black" stroke="black" points="481.5,-106.66 485,-116.66 488.5,-106.66 481.5,-106.66"/>
|
||||
</g>
|
||||
<!-- LoggerModule -->
|
||||
<g id="node7" class="node">
|
||||
<title>LoggerModule </title>
|
||||
<polygon fill="#fb8072" stroke="black" points="487.98,-304.8 384.02,-304.8 384.02,-268.8 487.98,-268.8 487.98,-304.8"/>
|
||||
<text text-anchor="middle" x="436" y="-282.6" font-family="Times,serif" font-size="14.00">LoggerModule </text>
|
||||
<polygon fill="#fb8072" stroke="black" points="395.98,-152.8 292.02,-152.8 292.02,-116.8 395.98,-116.8 395.98,-152.8"/>
|
||||
<text text-anchor="middle" x="344" y="-130.6" font-family="Times,serif" font-size="14.00">LoggerModule </text>
|
||||
</g>
|
||||
<!-- CommonModule->LoggerModule -->
|
||||
<g id="edge6" class="edge">
|
||||
<title>CommonModule->LoggerModule </title>
|
||||
<path fill="none" stroke="black" stroke-dasharray="5,2" d="M343.84,-210.8C367.68,-210.8 390.12,-210.8 390.12,-210.8 390.12,-210.8 390.12,-258.79 390.12,-258.79"/>
|
||||
<polygon fill="black" stroke="black" points="386.62,-258.79 390.12,-268.79 393.62,-258.79 386.62,-258.79"/>
|
||||
<path fill="none" stroke="black" stroke-dasharray="5,2" d="M123.61,-84.95C123.61,-97.07 123.61,-110.8 123.61,-110.8 123.61,-110.8 344,-110.8 344,-110.8 344,-110.8 344,-111.38 344,-111.38"/>
|
||||
<polygon fill="black" stroke="black" points="340.5,-106.61 344,-116.61 347.5,-106.61 340.5,-106.61"/>
|
||||
</g>
|
||||
<!-- SearchModule -->
|
||||
<g id="node2" class="node">
|
||||
<title>SearchModule</title>
|
||||
<polygon fill="#8dd3c7" stroke="black" points="213.64,-228.8 210.64,-232.8 189.64,-232.8 186.64,-228.8 116.36,-228.8 116.36,-192.8 213.64,-192.8 213.64,-228.8"/>
|
||||
<text text-anchor="middle" x="165" y="-206.6" font-family="Times,serif" font-size="14.00">SearchModule</text>
|
||||
<polygon fill="#8dd3c7" stroke="black" points="251.64,-84.8 248.64,-88.8 227.64,-88.8 224.64,-84.8 154.36,-84.8 154.36,-48.8 251.64,-48.8 251.64,-84.8"/>
|
||||
<text text-anchor="middle" x="203" y="-62.6" font-family="Times,serif" font-size="14.00">SearchModule</text>
|
||||
</g>
|
||||
<!-- SearchModule->AppModule -->
|
||||
<g id="edge2" class="edge">
|
||||
<title>SearchModule->AppModule</title>
|
||||
<path fill="none" stroke="black" d="M198.99,-228.81C198.99,-228.81 198.99,-258.65 198.99,-258.65"/>
|
||||
<polygon fill="black" stroke="black" points="195.49,-258.65 198.99,-268.65 202.49,-258.65 195.49,-258.65"/>
|
||||
<path fill="none" stroke="black" d="M168.51,-85.02C168.51,-85.02 168.51,-106.53 168.51,-106.53"/>
|
||||
<polygon fill="black" stroke="black" points="165.01,-106.53 168.51,-116.53 172.01,-106.53 165.01,-106.53"/>
|
||||
</g>
|
||||
<!-- SearchService -->
|
||||
<g id="node12" class="node">
|
||||
<title>SearchService </title>
|
||||
<polygon fill="#fb8072" stroke="black" points="279.57,-152.8 180.43,-152.8 180.43,-116.8 279.57,-116.8 279.57,-152.8"/>
|
||||
<text text-anchor="middle" x="230" y="-130.6" font-family="Times,serif" font-size="14.00">SearchService </text>
|
||||
<polygon fill="#fb8072" stroke="black" points="1131.57,-152.8 1032.43,-152.8 1032.43,-116.8 1131.57,-116.8 1131.57,-152.8"/>
|
||||
<text text-anchor="middle" x="1082" y="-130.6" font-family="Times,serif" font-size="14.00">SearchService </text>
|
||||
</g>
|
||||
<!-- SearchModule->SearchService -->
|
||||
<g id="edge11" class="edge">
|
||||
<title>SearchModule->SearchService </title>
|
||||
<path fill="none" stroke="black" stroke-dasharray="5,2" d="M197.02,-192.79C197.02,-192.79 197.02,-162.95 197.02,-162.95"/>
|
||||
<polygon fill="black" stroke="black" points="200.52,-162.95 197.02,-152.95 193.52,-162.95 200.52,-162.95"/>
|
||||
<path fill="none" stroke="black" stroke-dasharray="5,2" d="M251.83,-60.8C436.52,-60.8 1082,-60.8 1082,-60.8 1082,-60.8 1082,-106.51 1082,-106.51"/>
|
||||
<polygon fill="black" stroke="black" points="1078.5,-106.51 1082,-116.51 1085.5,-106.51 1078.5,-106.51"/>
|
||||
</g>
|
||||
<!-- HttpResponseModule -->
|
||||
<g id="node4" class="node">
|
||||
<title>HttpResponseModule</title>
|
||||
<polygon fill="#8dd3c7" stroke="black" points="535.1,-152.8 532.1,-156.8 511.1,-156.8 508.1,-152.8 396.9,-152.8 396.9,-116.8 535.1,-116.8 535.1,-152.8"/>
|
||||
<text text-anchor="middle" x="466" y="-130.6" font-family="Times,serif" font-size="14.00">HttpResponseModule</text>
|
||||
<polygon fill="#8dd3c7" stroke="black" points="718.1,-152.8 715.1,-156.8 694.1,-156.8 691.1,-152.8 579.9,-152.8 579.9,-116.8 718.1,-116.8 718.1,-152.8"/>
|
||||
<text text-anchor="middle" x="649" y="-130.6" font-family="Times,serif" font-size="14.00">HttpResponseModule</text>
|
||||
</g>
|
||||
<!-- HttpResponseModule->CommonModule -->
|
||||
<g id="edge3" class="edge">
|
||||
<title>HttpResponseModule->CommonModule</title>
|
||||
<path fill="none" stroke="black" d="M396.57,-134.8C355.65,-134.8 311.81,-134.8 311.81,-134.8 311.81,-134.8 311.81,-182.79 311.81,-182.79"/>
|
||||
<polygon fill="black" stroke="black" points="308.31,-182.79 311.81,-192.79 315.31,-182.79 308.31,-182.79"/>
|
||||
<path fill="none" stroke="black" d="M649,-116.73C649,-107.34 649,-97.8 649,-97.8 649,-97.8 111.39,-97.8 111.39,-97.8 111.39,-97.8 111.39,-94.83 111.39,-94.83"/>
|
||||
<polygon fill="black" stroke="black" points="114.89,-94.83 111.39,-84.83 107.89,-94.83 114.89,-94.83"/>
|
||||
</g>
|
||||
<!-- HttpResponseService -->
|
||||
<g id="node8" class="node">
|
||||
<title>HttpResponseService </title>
|
||||
<polygon fill="#fb8072" stroke="black" points="536.03,-228.8 395.97,-228.8 395.97,-192.8 536.03,-192.8 536.03,-228.8"/>
|
||||
<text text-anchor="middle" x="466" y="-206.6" font-family="Times,serif" font-size="14.00">HttpResponseService </text>
|
||||
<polygon fill="#fb8072" stroke="black" points="698.03,-228.8 557.97,-228.8 557.97,-192.8 698.03,-192.8 698.03,-228.8"/>
|
||||
<text text-anchor="middle" x="628" y="-206.6" font-family="Times,serif" font-size="14.00">HttpResponseService </text>
|
||||
</g>
|
||||
<!-- HttpResponseModule->HttpResponseService -->
|
||||
<g id="edge7" class="edge">
|
||||
<title>HttpResponseModule->HttpResponseService </title>
|
||||
<path fill="none" stroke="black" stroke-dasharray="5,2" d="M466,-152.81C466,-152.81 466,-182.65 466,-182.65"/>
|
||||
<polygon fill="black" stroke="black" points="462.5,-182.65 466,-192.65 469.5,-182.65 462.5,-182.65"/>
|
||||
<path fill="none" stroke="black" stroke-dasharray="5,2" d="M658.66,-152.81C658.66,-152.81 658.66,-182.65 658.66,-182.65"/>
|
||||
<polygon fill="black" stroke="black" points="655.16,-182.65 658.66,-192.65 662.16,-182.65 655.16,-182.65"/>
|
||||
</g>
|
||||
<!-- LoggerModule -->
|
||||
<g id="node5" class="node">
|
||||
<title>LoggerModule</title>
|
||||
<polygon fill="#8dd3c7" stroke="black" points="771.98,-304.8 768.98,-308.8 747.98,-308.8 744.98,-304.8 672.02,-304.8 672.02,-268.8 771.98,-268.8 771.98,-304.8"/>
|
||||
<text text-anchor="middle" x="722" y="-282.6" font-family="Times,serif" font-size="14.00">LoggerModule</text>
|
||||
<polygon fill="#8dd3c7" stroke="black" points="835.98,-152.8 832.98,-156.8 811.98,-156.8 808.98,-152.8 736.02,-152.8 736.02,-116.8 835.98,-116.8 835.98,-152.8"/>
|
||||
<text text-anchor="middle" x="786" y="-130.6" font-family="Times,serif" font-size="14.00">LoggerModule</text>
|
||||
</g>
|
||||
<!-- LoggerModule->CommonModule -->
|
||||
<g id="edge4" class="edge">
|
||||
<title>LoggerModule->CommonModule</title>
|
||||
<path fill="none" stroke="black" d="M722,-268.65C722,-256.53 722,-242.8 722,-242.8 722,-242.8 293.17,-242.8 293.17,-242.8 293.17,-242.8 293.17,-239.04 293.17,-239.04"/>
|
||||
<polygon fill="black" stroke="black" points="296.67,-239.04 293.17,-229.04 289.67,-239.04 296.67,-239.04"/>
|
||||
<path fill="none" stroke="black" d="M786,-116.31C786,-104.66 786,-91.8 786,-91.8 786,-91.8 117.5,-91.8 117.5,-91.8 117.5,-91.8 117.5,-91.12 117.5,-91.12"/>
|
||||
<polygon fill="black" stroke="black" points="121,-94.97 117.5,-84.97 114,-94.97 121,-94.97"/>
|
||||
</g>
|
||||
<!-- LoggerService -->
|
||||
<g id="node10" class="node">
|
||||
<title>LoggerService </title>
|
||||
<polygon fill="#fb8072" stroke="black" points="843.91,-380.8 742.09,-380.8 742.09,-344.8 843.91,-344.8 843.91,-380.8"/>
|
||||
<text text-anchor="middle" x="793" y="-358.6" font-family="Times,serif" font-size="14.00">LoggerService </text>
|
||||
<polygon fill="#fb8072" stroke="black" points="999.91,-228.8 898.09,-228.8 898.09,-192.8 999.91,-192.8 999.91,-228.8"/>
|
||||
<text text-anchor="middle" x="949" y="-206.6" font-family="Times,serif" font-size="14.00">LoggerService </text>
|
||||
</g>
|
||||
<!-- LoggerModule->LoggerService -->
|
||||
<g id="edge9" class="edge">
|
||||
<title>LoggerModule->LoggerService </title>
|
||||
<path fill="none" stroke="black" stroke-dasharray="5,2" d="M757.02,-304.81C757.02,-304.81 757.02,-334.65 757.02,-334.65"/>
|
||||
<polygon fill="black" stroke="black" points="753.52,-334.65 757.02,-344.65 760.52,-334.65 753.52,-334.65"/>
|
||||
<path fill="none" stroke="black" stroke-dasharray="5,2" d="M803.37,-152.84C803.37,-165.36 803.37,-179.8 803.37,-179.8 803.37,-179.8 949,-179.8 949,-179.8 949,-179.8 949,-182.77 949,-182.77"/>
|
||||
<polygon fill="black" stroke="black" points="945.5,-182.77 949,-192.77 952.5,-182.77 945.5,-182.77"/>
|
||||
</g>
|
||||
<!-- HttpResponseService -->
|
||||
<g id="node9" class="node">
|
||||
<title>HttpResponseService</title>
|
||||
<ellipse fill="#fdb462" stroke="black" cx="478" cy="-66.8" rx="94.35" ry="18"/>
|
||||
<text text-anchor="middle" x="478" y="-62.6" font-family="Times,serif" font-size="14.00">HttpResponseService</text>
|
||||
<ellipse fill="#fdb462" stroke="black" cx="440" cy="-210.8" rx="94.35" ry="18"/>
|
||||
<text text-anchor="middle" x="440" y="-206.6" font-family="Times,serif" font-size="14.00">HttpResponseService</text>
|
||||
</g>
|
||||
<!-- HttpResponseService->HttpResponseModule -->
|
||||
<g id="edge8" class="edge">
|
||||
<title>HttpResponseService->HttpResponseModule</title>
|
||||
<path fill="none" stroke="black" d="M466,-84.67C466,-84.67 466,-106.34 466,-106.34"/>
|
||||
<polygon fill="black" stroke="black" points="462.5,-106.34 466,-116.34 469.5,-106.34 462.5,-106.34"/>
|
||||
<path fill="none" stroke="black" d="M474.19,-193.91C474.19,-181.51 474.19,-166.8 474.19,-166.8 474.19,-166.8 619.3,-166.8 619.3,-166.8 619.3,-166.8 619.3,-163.04 619.3,-163.04"/>
|
||||
<polygon fill="black" stroke="black" points="622.8,-163.04 619.3,-153.04 615.8,-163.04 622.8,-163.04"/>
|
||||
</g>
|
||||
<!-- LoggerService -->
|
||||
<g id="node11" class="node">
|
||||
<title>LoggerService</title>
|
||||
<ellipse fill="#fdb462" stroke="black" cx="650" cy="-362.8" rx="67.76" ry="18"/>
|
||||
<text text-anchor="middle" x="650" y="-358.6" font-family="Times,serif" font-size="14.00">LoggerService</text>
|
||||
<ellipse fill="#fdb462" stroke="black" cx="806" cy="-210.8" rx="67.76" ry="18"/>
|
||||
<text text-anchor="middle" x="806" y="-206.6" font-family="Times,serif" font-size="14.00">LoggerService</text>
|
||||
</g>
|
||||
<!-- LoggerService->LoggerModule -->
|
||||
<g id="edge10" class="edge">
|
||||
<title>LoggerService->LoggerModule</title>
|
||||
<path fill="none" stroke="black" d="M694.94,-349.21C694.94,-349.21 694.94,-314.84 694.94,-314.84"/>
|
||||
<polygon fill="black" stroke="black" points="698.44,-314.84 694.94,-304.84 691.44,-314.84 698.44,-314.84"/>
|
||||
<path fill="none" stroke="black" d="M770.74,-195.05C770.74,-195.05 770.74,-162.93 770.74,-162.93"/>
|
||||
<polygon fill="black" stroke="black" points="774.24,-162.93 770.74,-152.93 767.24,-162.93 774.24,-162.93"/>
|
||||
</g>
|
||||
<!-- SearchService -->
|
||||
<g id="node13" class="node">
|
||||
<title>SearchService</title>
|
||||
<ellipse fill="#fdb462" stroke="black" cx="90" cy="-134.8" rx="66.03" ry="18"/>
|
||||
<text text-anchor="middle" x="90" y="-130.6" font-family="Times,serif" font-size="14.00">SearchService</text>
|
||||
<ellipse fill="#fdb462" stroke="black" cx="942" cy="-134.8" rx="66.03" ry="18"/>
|
||||
<text text-anchor="middle" x="942" y="-130.6" font-family="Times,serif" font-size="14.00">SearchService</text>
|
||||
</g>
|
||||
<!-- SearchService->SearchModule -->
|
||||
<g id="edge12" class="edge">
|
||||
<title>SearchService->SearchModule</title>
|
||||
<path fill="none" stroke="black" d="M136.22,-148.04C136.22,-148.04 136.22,-182.59 136.22,-182.59"/>
|
||||
<polygon fill="black" stroke="black" points="132.72,-182.59 136.22,-192.59 139.72,-182.59 132.72,-182.59"/>
|
||||
<path fill="none" stroke="black" d="M942,-116.53C942,-98.24 942,-72.8 942,-72.8 942,-72.8 261.77,-72.8 261.77,-72.8"/>
|
||||
<polygon fill="black" stroke="black" points="261.77,-69.3 251.77,-72.8 261.77,-76.3 261.77,-69.3"/>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
@ -77,6 +77,26 @@
|
||||
<h3 id="index">Index</h3>
|
||||
<table class="table table-sm table-bordered index-table">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<h6><b>Properties</b></h6>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<ul class="index-list">
|
||||
<li>
|
||||
<span class="modifier">Private</span>
|
||||
<span class="modifier">Readonly</span>
|
||||
<a href="#ES_PORT" >ES_PORT</a>
|
||||
</li>
|
||||
<li>
|
||||
<span class="modifier">Private</span>
|
||||
<a href="#prevSearch" >prevSearch</a>
|
||||
</li>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
@ -87,6 +107,16 @@
|
||||
<td class="col-md-4">
|
||||
<ul class="index-list">
|
||||
<li>
|
||||
<span class="modifier">Async</span>
|
||||
<a href="#deletePIT" >deletePIT</a>
|
||||
</li>
|
||||
<li>
|
||||
<span class="modifier">Public</span>
|
||||
<span class="modifier">Async</span>
|
||||
<a href="#getPIT" >getPIT</a>
|
||||
</li>
|
||||
<li>
|
||||
<span class="modifier">Async</span>
|
||||
<a href="#intercept" >intercept</a>
|
||||
</li>
|
||||
</ul>
|
||||
@ -101,18 +131,248 @@
|
||||
</table>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<h3 id="constructor">Constructor</h3>
|
||||
<table class="table table-sm table-bordered">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<code>constructor(httpService: HttpService)</code>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-line">Defined in <a href="" data-line="59" class="link-to-prism">src/core/interceptors/page.interceptor.ts:59</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-description"><p>Injects needed dependencies and instantiates the storage object</p>
|
||||
</div>
|
||||
<div>
|
||||
<b>Parameters :</b>
|
||||
<table class="params">
|
||||
<thead>
|
||||
<tr>
|
||||
<td>Name</td>
|
||||
<td>Type</td>
|
||||
<td>Optional</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>httpService</td>
|
||||
|
||||
<td>
|
||||
<code>HttpService</code>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
No
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
|
||||
<h3 id="methods">
|
||||
Methods
|
||||
</h3>
|
||||
<table class="table table-sm table-bordered">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<a name="deletePIT"></a>
|
||||
<span class="name">
|
||||
<span class="modifier">Async</span>
|
||||
<span ><b>deletePIT</b></span>
|
||||
<a href="#deletePIT"><span class="icon ion-ios-link"></span></a>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<span class="modifier-icon icon ion-ios-reset"></span>
|
||||
<code>deletePIT(pitID: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/string" target="_blank">string</a>)</code>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-line">Defined in <a href="" data-line="180"
|
||||
class="link-to-prism">src/core/interceptors/page.interceptor.ts:180</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-description"><p>Deletes the PIT specified by provided ID</p>
|
||||
</div>
|
||||
|
||||
<div class="io-description">
|
||||
<b>Parameters :</b>
|
||||
|
||||
<table class="params">
|
||||
<thead>
|
||||
<tr>
|
||||
<td>Name</td>
|
||||
<td>Type</td>
|
||||
<td>Optional</td>
|
||||
<td>Description</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>pitID</td>
|
||||
<td>
|
||||
<code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/string" target="_blank" >string</a></code>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
No
|
||||
</td>
|
||||
|
||||
|
||||
<td>
|
||||
<p>, ID of the PIT, that would be deleted</p>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div>
|
||||
</div>
|
||||
<div class="io-description">
|
||||
<b>Returns : </b> <code>Promise<boolean></code>
|
||||
|
||||
</div>
|
||||
<div class="io-description">
|
||||
<p>true/false, depending on the result of deletion of the PIT</p>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<table class="table table-sm table-bordered">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<a name="getPIT"></a>
|
||||
<span class="name">
|
||||
<span class="modifier">Public</span>
|
||||
<span class="modifier">Async</span>
|
||||
<span ><b>getPIT</b></span>
|
||||
<a href="#getPIT"><span class="icon ion-ios-link"></span></a>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<span class="modifier-icon icon ion-ios-reset"></span>
|
||||
<code>getPIT(alive: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/number" target="_blank">number</a>, unit: <a href="../undefineds/EsTime.html" target="_self">EsTime</a>)</code>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-line">Defined in <a href="" data-line="160"
|
||||
class="link-to-prism">src/core/interceptors/page.interceptor.ts:160</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-description"><p>Acquires a PIT ID from Elasticsearch, needed for a request</p>
|
||||
</div>
|
||||
|
||||
<div class="io-description">
|
||||
<b>Parameters :</b>
|
||||
|
||||
<table class="params">
|
||||
<thead>
|
||||
<tr>
|
||||
<td>Name</td>
|
||||
<td>Type</td>
|
||||
<td>Optional</td>
|
||||
<td>Default value</td>
|
||||
<td>Description</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>alive</td>
|
||||
<td>
|
||||
<code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/number" target="_blank" >number</a></code>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
No
|
||||
</td>
|
||||
|
||||
<td>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<p>, amount of time in minutes (defaults to 1). If time unit is not specified - defaults to minutes.</p>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>unit</td>
|
||||
<td>
|
||||
<code><a href="../miscellaneous/enumerations.html#EsTime" target="_self" >EsTime</a></code>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
No
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<code>EsTime.min</code>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div>
|
||||
</div>
|
||||
<div class="io-description">
|
||||
<b>Returns : </b> <code><a href="../interfaces/EsPit.html" target="_self" >Promise<EsPit></a></code>
|
||||
|
||||
</div>
|
||||
<div class="io-description">
|
||||
<p>PIT object <EsPit> containing PIT ID and keep_alive value</p>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<table class="table table-sm table-bordered">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<a name="intercept"></a>
|
||||
<span class="name">
|
||||
<span class="modifier">Async</span>
|
||||
<span ><b>intercept</b></span>
|
||||
<a href="#intercept"><span class="icon ion-ios-link"></span></a>
|
||||
</span>
|
||||
@ -120,15 +380,16 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<code>intercept(context: ExecutionContext, next: CallHandler<any>)</code>
|
||||
<span class="modifier-icon icon ion-ios-reset"></span>
|
||||
<code>intercept(context: ExecutionContext, next: CallHandler<any>)</code>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-line">Defined in <a href="" data-line="21"
|
||||
class="link-to-prism">src/core/interceptors/page.interceptor.ts:21</a></div>
|
||||
<div class="io-line">Defined in <a href="" data-line="75"
|
||||
class="link-to-prism">src/core/interceptors/page.interceptor.ts:75</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@ -180,7 +441,7 @@
|
||||
<div>
|
||||
</div>
|
||||
<div class="io-description">
|
||||
<b>Returns : </b> <code><a href="../classes/PageDto.html" target="_self" >Observable<PageDto<object>></a></code>
|
||||
<b>Returns : </b> <code><a href="../classes/PageDto.html" target="_self" >Promise<Observable<PageDto>></a></code>
|
||||
|
||||
</div>
|
||||
<div class="io-description">
|
||||
@ -192,56 +453,295 @@
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
<section>
|
||||
|
||||
<h3 id="inputs">
|
||||
Properties
|
||||
</h3>
|
||||
<table class="table table-sm table-bordered">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<a name="ES_PORT"></a>
|
||||
<span class="name">
|
||||
<span class="modifier">Private</span>
|
||||
<span class="modifier">Readonly</span>
|
||||
<span ><b>ES_PORT</b></span>
|
||||
<a href="#ES_PORT"><span class="icon ion-ios-link"></span></a>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<i>Default value : </i><code>process.env.ES_PORT</code>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-line">Defined in <a href="" data-line="148" class="link-to-prism">src/core/interceptors/page.interceptor.ts:148</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-description"><p>Elastichsearch server port-number</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
<table class="table table-sm table-bordered">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<a name="prevSearch"></a>
|
||||
<span class="name">
|
||||
<span class="modifier">Private</span>
|
||||
<span ><b>prevSearch</b></span>
|
||||
<a href="#prevSearch"><span class="icon ion-ios-link"></span></a>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<i>Type : </i> <code><a href="../classes/PrevSearch.html" target="_self" >PrevSearch</a></code>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-line">Defined in <a href="" data-line="153" class="link-to-prism">src/core/interceptors/page.interceptor.ts:153</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-description"><p>Info about previously completed search</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="tab-pane fade tab-source-code" id="c-source">
|
||||
<pre class="line-numbers compodoc-sourcecode"><code class="language-typescript">import { CallHandler, ExecutionContext, Injectable, NestInterceptor } from "@nestjs/common";
|
||||
import { MetadataScanner } from "@nestjs/core";
|
||||
import { Observable, map } from "rxjs";
|
||||
import { PageDto } from "../domain/dtos";
|
||||
<pre class="line-numbers compodoc-sourcecode"><code class="language-typescript">import { HttpService } from "@nestjs/axios";
|
||||
import { CallHandler, ExecutionContext, Injectable, NestInterceptor } from "@nestjs/common";
|
||||
import { reverse } from "dns";
|
||||
import { Observable, map, take } from "rxjs";
|
||||
import { EsResponseDto, PageDto } from "../domain/dtos";
|
||||
import { EsQueryDto } from "../domain/dtos/es-query.dto";
|
||||
import { RequestDto } from "../domain/dtos/request.dto";
|
||||
import { SearchQueryDto } from "../domain/dtos/search-q.dto";
|
||||
import { SearchResultDto } from "../domain/dtos/search-result.dto";
|
||||
import { EsTime } from "../domain/enums/es-time.enum";
|
||||
import { Order } from "../domain/enums/page-order.enum";
|
||||
import { PageMeta } from "../domain/interfaces";
|
||||
import { EsPit } from "../domain/interfaces/es-pit.interface";
|
||||
import { SearchInfo } from "../domain/interfaces/search-info.interface";
|
||||
import { SearchService } from "../services/common/search.service";
|
||||
|
||||
/**
|
||||
* Previous search data storage
|
||||
*/
|
||||
class PrevSearch implements SearchInfo {
|
||||
/**
|
||||
* Constructs an uninitialized object
|
||||
*/
|
||||
constructor() {
|
||||
this.pit = undefined;
|
||||
this.tiebreaker = undefined;
|
||||
this.prevPage = -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* PIT object of the previous search
|
||||
*/
|
||||
pit: EsPit;
|
||||
|
||||
/**
|
||||
* Tiebreaker and sort parameters
|
||||
*/
|
||||
tiebreaker: unknown[];
|
||||
|
||||
/**
|
||||
* Number of the previous page
|
||||
*/
|
||||
prevPage: number;
|
||||
|
||||
/**
|
||||
* Checks if there was the search before current one
|
||||
* @returns true/false, showing whether or not there was another search before
|
||||
*/
|
||||
public isSet(): boolean {
|
||||
if (this.pit && this.tiebreaker && this.prevPage !== -1) return true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Pagination-implementing interceptor
|
||||
*/
|
||||
@Injectable()
|
||||
export class PageInterceptor implements NestInterceptor {
|
||||
/**
|
||||
* Injects needed dependencies and instantiates the storage object
|
||||
* @param httpService
|
||||
* @param searchService
|
||||
*/
|
||||
constructor(private readonly httpService: HttpService) {
|
||||
this.prevSearch = new PrevSearch;
|
||||
}
|
||||
|
||||
/**
|
||||
* Override of intercept() method, specified in NestInterceptor interface
|
||||
* @param context
|
||||
* @param next
|
||||
* @returns Page with content and metadata
|
||||
*/
|
||||
intercept(context: ExecutionContext, next: CallHandler<any>): Observable<PageDto<object>> {
|
||||
const request = context.switchToHttp().getRequest();
|
||||
async intercept(context: ExecutionContext, next: CallHandler<any>): Promise<Observable<PageDto>> {
|
||||
let request: RequestDto = context.switchToHttp().getRequest<RequestDto>();
|
||||
const query: SearchQueryDto = request.query;
|
||||
let reverse: boolean = false;
|
||||
|
||||
request.es_query = new EsQueryDto();
|
||||
|
||||
request.es_query.query = {
|
||||
query_string: {
|
||||
query: query.query,
|
||||
default_field: 'content',
|
||||
}
|
||||
};
|
||||
request.es_query.sort = [
|
||||
{ _score: { order: !query?.order ? Order.DESC : query.order } },
|
||||
{ _shard_doc: 'desc' }
|
||||
];
|
||||
|
||||
if (this.prevSearch.isSet()) {
|
||||
request.es_query.pit = this.prevSearch.pit;
|
||||
request.es_query.search_after = this.prevSearch.tiebreaker;
|
||||
|
||||
let limit = !query?.limit ? 10 : query.limit;
|
||||
request.es_query.size = limit * Math.abs(query.page - this.prevSearch.prevPage);
|
||||
|
||||
if (query.page < this.prevSearch.prevPage) {
|
||||
request.es_query.sort = [{ _score: { order: 'asc' } }];
|
||||
request.es_query.size += limit - 1;
|
||||
reverse = true;
|
||||
} else if (query.page == this.prevSearch.prevPage) {
|
||||
//...
|
||||
}
|
||||
} else {
|
||||
this.prevSearch.pit = request.es_query.pit = await this.getPIT(1);
|
||||
request.es_query.size = !query?.limit ? 10 : query.limit;
|
||||
}
|
||||
|
||||
return next.handle().pipe(
|
||||
map((res) => {
|
||||
// Setting the page meta-data
|
||||
let meta: PageMeta = {
|
||||
total: res.total.value,
|
||||
total: res.hits.total.value,
|
||||
pagenum: !query?.page ? 1 : query.page,
|
||||
order: query?.order?.toUpperCase() === Order.ASC ? Order.ASC : Order.DESC,
|
||||
hasNext: false,
|
||||
hasPrev: false,
|
||||
pagesize: !query?.limit ? 10 : query.limit,
|
||||
};
|
||||
};
|
||||
// meta.hasNext = res.hits.hits[meta.pagenum * meta.pagesize] ? true : false;
|
||||
// meta.hasPrev = res.hits.hits[(meta.pagenum - 1) * meta.pagesize - 1] ? true: false;
|
||||
|
||||
meta.hasNext = res.hits[meta.pagenum * meta.pagesize] ? true : false;
|
||||
meta.hasPrev = res.hits[(meta.pagenum - 1) * meta.pagesize - 1] ? true: false;
|
||||
// Saving the search info
|
||||
this.prevSearch.pit.id = res.pit_id;
|
||||
this.prevSearch.tiebreaker = res.hits.hits[res.hits.hits.length - 1].sort;
|
||||
this.prevSearch.prevPage = query.page;
|
||||
|
||||
const data = res.hits.slice((meta.pagenum - 1) * meta.pagesize, meta.pagenum * meta.pagesize);
|
||||
let data = res.hits.hits.slice(-meta.pagesize);
|
||||
if (reverse) {
|
||||
console.log('REVERSE');
|
||||
this.prevSearch.tiebreaker = data[0].sort;
|
||||
data.reverse();
|
||||
reverse = false;
|
||||
}
|
||||
|
||||
// Return the page
|
||||
return new PageDto(data, meta);
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Elastichsearch server port-number
|
||||
*/
|
||||
private readonly ES_PORT = process.env.ES_PORT;
|
||||
|
||||
/**
|
||||
* Info about previously completed search
|
||||
*/
|
||||
private prevSearch: PrevSearch;
|
||||
|
||||
/**
|
||||
* Acquires a PIT ID from Elasticsearch, needed for a request
|
||||
* @param alive, amount of time in minutes (defaults to 1). If time unit is not specified - defaults to minutes.
|
||||
* @returns PIT object <EsPit> containing PIT ID and keep_alive value
|
||||
*/
|
||||
public async getPIT(alive: number, unit: EsTime = EsTime.min): Promise<EsPit> {
|
||||
return new Promise((resolve, reject) => {
|
||||
try {
|
||||
(this.httpService.post<EsPit>(`http://localhost:${this.ES_PORT}/papers/_pit?keep_alive=${alive+unit}`)
|
||||
.pipe(take(1), map(axiosRes => axiosRes.data))
|
||||
.subscribe((res) => {
|
||||
res.keep_alive = alive + unit;
|
||||
resolve(res);
|
||||
}));
|
||||
} catch (error) {
|
||||
reject(error);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes the PIT specified by provided ID
|
||||
* @param pitID, ID of the PIT, that would be deleted
|
||||
* @returns true/false, depending on the result of deletion of the PIT
|
||||
*/
|
||||
async deletePIT(pitID: string): Promise<boolean> {
|
||||
return new Promise((resolve, reject) => {
|
||||
try {
|
||||
this.httpService.delete(`http://localhost:${this.ES_PORT}/_pit`, {
|
||||
data: { id: pitID },
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
})
|
||||
.pipe(take(1), map(axiosRes => axiosRes.data))
|
||||
.subscribe((res) => {
|
||||
resolve(res.succeeded);
|
||||
});
|
||||
} catch (error) {
|
||||
reject(error);
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
/*
|
||||
public saveInfo(pit: EsPit, tiebreaker: unknown[], page: number) {
|
||||
this.pit.id = pit.id;
|
||||
this.pit.keep_alive = pit.keep_alive;
|
||||
|
||||
this.tiebreaker = tiebreaker.slice();
|
||||
|
||||
this.prevPage = page;
|
||||
}
|
||||
|
||||
public clearInfo() {
|
||||
this.pit = undefined;
|
||||
this.tiebreaker = undefined;
|
||||
this.prevPage = -1;
|
||||
}*/
|
||||
|
||||
// getQueryParams(str: string): any {
|
||||
// let parameters: object = {};
|
||||
// let pairs: string[] = str.split(',');
|
||||
@ -258,7 +758,39 @@ export class PageInterceptor implements NestInterceptor {
|
||||
|
||||
// return parameters;
|
||||
// }
|
||||
}</code></pre>
|
||||
|
||||
|
||||
/**
|
||||
* OLD WAY PAGINATION
|
||||
* // Setting the page data
|
||||
// const data = res.hits.slice((meta.pagenum - 1) * meta.pagesize, meta.pagenum * meta.pagesize);
|
||||
*/
|
||||
|
||||
|
||||
// if (query.page == 1) {
|
||||
// this.prevSearch.pit = request.es_query.pit = await this.getPIT(1);
|
||||
// } else {
|
||||
// if (!this.prevSearch.isSet()) {
|
||||
// this.prevSearch.pit = request.es_query.pit = await this.getPIT(1);
|
||||
|
||||
// request.es_query.size = query.limit * (query.page - 1);
|
||||
// this.searchService.findByContext(request.es_query).then((res: SearchResultDto) => {
|
||||
// request.es_query.search_after = res.data.hits.hits[res.data.hits.hits.length - 1].sort;
|
||||
// });
|
||||
// } else {
|
||||
// if (query.page == this.prevSearch.prevPage) {
|
||||
// return;
|
||||
// } else {
|
||||
// request.es_query.pit = this.prevSearch.pit;
|
||||
// request.es_query.search_after = this.prevSearch.tiebreaker;
|
||||
// request.es_query.size = (query.page - this.prevSearch.prevPage);
|
||||
// }
|
||||
|
||||
// // request.es_query.pit = this.prevSearch.pit;
|
||||
// // request.es_query.search_after = this.prevSearch.tiebreaker;
|
||||
// }
|
||||
// }
|
||||
</code></pre>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
@ -102,10 +102,6 @@
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<ul class="index-list">
|
||||
<li>
|
||||
<span class="modifier">Async</span>
|
||||
<a href="#deletePIT" >deletePIT</a>
|
||||
</li>
|
||||
<li>
|
||||
<span class="modifier">Async</span>
|
||||
<a href="#findByContext" >findByContext</a>
|
||||
@ -114,10 +110,6 @@
|
||||
<span class="modifier">Async</span>
|
||||
<a href="#findByID" >findByID</a>
|
||||
</li>
|
||||
<li>
|
||||
<span class="modifier">Async</span>
|
||||
<a href="#getPIT" >getPIT</a>
|
||||
</li>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
@ -141,7 +133,7 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-line">Defined in <a href="" data-line="11" class="link-to-prism">src/core/services/common/search.service.ts:11</a></div>
|
||||
<div class="io-line">Defined in <a href="" data-line="14" class="link-to-prism">src/core/services/common/search.service.ts:14</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@ -187,85 +179,6 @@ HTTPService instance</p>
|
||||
<h3 id="methods">
|
||||
Methods
|
||||
</h3>
|
||||
<table class="table table-sm table-bordered">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<a name="deletePIT"></a>
|
||||
<span class="name">
|
||||
<span class="modifier">Async</span>
|
||||
<span ><b>deletePIT</b></span>
|
||||
<a href="#deletePIT"><span class="icon ion-ios-link"></span></a>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<span class="modifier-icon icon ion-ios-reset"></span>
|
||||
<code>deletePIT(pitID: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/string" target="_blank">string</a>)</code>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-line">Defined in <a href="" data-line="119"
|
||||
class="link-to-prism">src/core/services/common/search.service.ts:119</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-description"><p>Deletes the PIT specified by provided ID</p>
|
||||
</div>
|
||||
|
||||
<div class="io-description">
|
||||
<b>Parameters :</b>
|
||||
|
||||
<table class="params">
|
||||
<thead>
|
||||
<tr>
|
||||
<td>Name</td>
|
||||
<td>Type</td>
|
||||
<td>Optional</td>
|
||||
<td>Description</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>pitID</td>
|
||||
<td>
|
||||
<code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/string" target="_blank" >string</a></code>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
No
|
||||
</td>
|
||||
|
||||
|
||||
<td>
|
||||
<p>, ID of the PIT, that would be deleted</p>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div>
|
||||
</div>
|
||||
<div class="io-description">
|
||||
<b>Returns : </b> <code>Promise<boolean></code>
|
||||
|
||||
</div>
|
||||
<div class="io-description">
|
||||
<p>true/false, depending on the result of deletion of the PIT</p>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<table class="table table-sm table-bordered">
|
||||
<tbody>
|
||||
<tr>
|
||||
@ -281,15 +194,15 @@ HTTPService instance</p>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<span class="modifier-icon icon ion-ios-reset"></span>
|
||||
<code>findByContext(query_str: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/string" target="_blank">string</a>)</code>
|
||||
<code>findByContext(es_query: <a href="../interfaces/EsQuery.html" target="_self">EsQueryDto</a>)</code>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-line">Defined in <a href="" data-line="63"
|
||||
class="link-to-prism">src/core/services/common/search.service.ts:63</a></div>
|
||||
<div class="io-line">Defined in <a href="" data-line="68"
|
||||
class="link-to-prism">src/core/services/common/search.service.ts:68</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@ -312,9 +225,9 @@ HTTPService instance</p>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>query_str</td>
|
||||
<td>es_query</td>
|
||||
<td>
|
||||
<code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/string" target="_blank" >string</a></code>
|
||||
<code><a href="../interfaces/EsQuery.html" target="_self" >EsQueryDto</a></code>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
@ -362,8 +275,8 @@ HTTPService instance</p>
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-line">Defined in <a href="" data-line="29"
|
||||
class="link-to-prism">src/core/services/common/search.service.ts:29</a></div>
|
||||
<div class="io-line">Defined in <a href="" data-line="32"
|
||||
class="link-to-prism">src/core/services/common/search.service.ts:32</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@ -414,89 +327,6 @@ HTTPService instance</p>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<table class="table table-sm table-bordered">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<a name="getPIT"></a>
|
||||
<span class="name">
|
||||
<span class="modifier">Async</span>
|
||||
<span ><b>getPIT</b></span>
|
||||
<a href="#getPIT"><span class="icon ion-ios-link"></span></a>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<span class="modifier-icon icon ion-ios-reset"></span>
|
||||
<code>getPIT(alive: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/number" target="_blank">number</a>)</code>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-line">Defined in <a href="" data-line="100"
|
||||
class="link-to-prism">src/core/services/common/search.service.ts:100</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-description"><p>Acquires a PIT ID from Elasticsearch, needed for a request</p>
|
||||
</div>
|
||||
|
||||
<div class="io-description">
|
||||
<b>Parameters :</b>
|
||||
|
||||
<table class="params">
|
||||
<thead>
|
||||
<tr>
|
||||
<td>Name</td>
|
||||
<td>Type</td>
|
||||
<td>Optional</td>
|
||||
<td>Default value</td>
|
||||
<td>Description</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>alive</td>
|
||||
<td>
|
||||
<code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/number" target="_blank" >number</a></code>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
No
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<code>1</code>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<p>, amount of time in minutes (defaults to 1)</p>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div>
|
||||
</div>
|
||||
<div class="io-description">
|
||||
<b>Returns : </b> <code>Promise<string></code>
|
||||
|
||||
</div>
|
||||
<div class="io-description">
|
||||
<p>Point-In-Time ID</p>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
<section>
|
||||
|
||||
@ -523,7 +353,7 @@ HTTPService instance</p>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-line">Defined in <a href="" data-line="22" class="link-to-prism">src/core/services/common/search.service.ts:22</a></div>
|
||||
<div class="io-line">Defined in <a href="" data-line="25" class="link-to-prism">src/core/services/common/search.service.ts:25</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@ -543,10 +373,13 @@ HTTPService instance</p>
|
||||
|
||||
<div class="tab-pane fade tab-source-code" id="c-source">
|
||||
<pre class="line-numbers compodoc-sourcecode"><code class="language-typescript">import { HttpService } from "@nestjs/axios";
|
||||
import { Injectable } from "@nestjs/common";
|
||||
import { GatewayTimeoutException, Injectable } from "@nestjs/common";
|
||||
import { map, take } from "rxjs";
|
||||
import { EsResponseDto } from "src/core/domain/dtos";
|
||||
import { EsQueryDto } from "src/core/domain/dtos/es-query.dto";
|
||||
import { SearchResultDto } from "src/core/domain/dtos/search-result.dto";
|
||||
import { EsTime } from "src/core/domain/enums/es-time.enum";
|
||||
import { EsPit } from "src/core/domain/interfaces/es-pit.interface";
|
||||
|
||||
/**
|
||||
* Search service provider
|
||||
@ -571,27 +404,29 @@ export class SearchService {
|
||||
* @returns Elasticsearch hits or an error object
|
||||
*/
|
||||
async findByID(uuid: string): Promise<SearchResultDto> { // Should I change 'object' to specific DTO?
|
||||
let es_query = {
|
||||
query: {
|
||||
query_string: {
|
||||
query: 'id:' + uuid
|
||||
}
|
||||
},
|
||||
let ESQ: EsQueryDto = new EsQueryDto;
|
||||
|
||||
ESQ.size = 1;
|
||||
ESQ.query = {
|
||||
query_string: {
|
||||
query: ('id:' + uuid),
|
||||
}
|
||||
}
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
try {
|
||||
(this.httpService.get<EsResponseDto>(`http://localhost:${this.ES_PORT}/_search`, {
|
||||
data: es_query,
|
||||
data: ESQ,
|
||||
headers: {'Content-Type': 'application/json'},
|
||||
}))
|
||||
.pipe(take(1), map(axiosRes => axiosRes.data))
|
||||
.subscribe((res: EsResponseDto) => {
|
||||
if (res.timed_out) {
|
||||
reject(new SearchResultDto(504, {message: 'Timed Out'}));
|
||||
throw new GatewayTimeoutException;
|
||||
// reject(new SearchResultDto(504, {message: 'Timed Out'}));
|
||||
}
|
||||
|
||||
resolve(new SearchResultDto(200, res.hits));
|
||||
resolve(new SearchResultDto(200, res));
|
||||
});
|
||||
} catch (error) {
|
||||
reject(new SearchResultDto(700, error));
|
||||
@ -601,21 +436,11 @@ export class SearchService {
|
||||
|
||||
/**
|
||||
* Finds relevant documents by context using the given query string
|
||||
* @param query_str
|
||||
* @param query, <EsQueryDto>
|
||||
* @returns Elasticsearch hits or an error object
|
||||
*/
|
||||
async findByContext(query_str: string): Promise<SearchResultDto> {
|
||||
let es_query = {
|
||||
query: {
|
||||
query_string: {
|
||||
query: query_str,
|
||||
default_field: "content"
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
let pitID = this.getPIT(1);
|
||||
|
||||
async findByContext(es_query: EsQueryDto): Promise<SearchResultDto> {
|
||||
console.log(`SEARCH|SERVICE: ${JSON.stringify(es_query, null, 2)}`);
|
||||
return new Promise((resolve, reject) => {
|
||||
try {
|
||||
(this.httpService.get<EsResponseDto>(`http://localhost:${this.ES_PORT}/_search`, {
|
||||
@ -625,58 +450,54 @@ export class SearchService {
|
||||
.pipe(take(1), map(axiosRes => axiosRes.data))
|
||||
.subscribe((res: EsResponseDto) => {
|
||||
if (res.timed_out) {
|
||||
reject(new SearchResultDto(504, {status: 504, message: 'Timed Out'}));
|
||||
}
|
||||
|
||||
resolve(new SearchResultDto(200, res.hits));
|
||||
throw new GatewayTimeoutException;
|
||||
// reject(new SearchResultDto(504, {status: 504, message: 'Timed Out'}));
|
||||
}
|
||||
|
||||
resolve(new SearchResultDto(200, res));
|
||||
});
|
||||
} catch (error) {
|
||||
reject(new SearchResultDto(700, error));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Acquires a PIT ID from Elasticsearch, needed for a request
|
||||
* @param alive, amount of time in minutes (defaults to 1)
|
||||
* @returns Point-In-Time ID
|
||||
*/
|
||||
async getPIT(alive: number = 1): Promise<string> {
|
||||
return new Promise((resolve, reject) => {
|
||||
try {
|
||||
(this.httpService.post(`http://localhost:${this.ES_PORT}/papers/_pit?keep_alive=${alive}m`)
|
||||
.pipe(take(1), map(axiosRes => axiosRes.data))
|
||||
.subscribe((res) => {
|
||||
resolve(res.id);
|
||||
}));
|
||||
} catch (error) {
|
||||
reject(error);
|
||||
}
|
||||
});
|
||||
}
|
||||
// let ESQ: EsQueryDto = new EsQueryDto;
|
||||
|
||||
/**
|
||||
* Deletes the PIT specified by provided ID
|
||||
* @param pitID, ID of the PIT, that would be deleted
|
||||
* @returns true/false, depending on the result of deletion of the PIT
|
||||
*/
|
||||
async deletePIT(pitID: string): Promise<boolean> {
|
||||
return new Promise((resolve, reject) => {
|
||||
try {
|
||||
this.httpService.delete(`http://localhost:${this.ES_PORT}/papers/_pit`, {
|
||||
data: { id: pitID },
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
})
|
||||
.pipe(take(1), map(axiosRes => axiosRes.data))
|
||||
.subscribe((res) => {
|
||||
resolve(res.succeeded);
|
||||
});
|
||||
} catch (error) {
|
||||
reject(error);
|
||||
}
|
||||
})
|
||||
}
|
||||
}</code></pre>
|
||||
// if (limit) ESQ.size = limit;
|
||||
// ESQ.query = {
|
||||
// query_string: {
|
||||
// query: query_str,
|
||||
// default_field: 'content',
|
||||
// }
|
||||
// }
|
||||
// this.getPIT(1).then((pit) => {
|
||||
// ESQ.pit = pit;
|
||||
// });
|
||||
|
||||
/**
|
||||
* Context
|
||||
* // let es_query = { // DTO
|
||||
// query: { // Interface
|
||||
// query_string: { // Interface
|
||||
// query: query_str,
|
||||
// default_field: "content"
|
||||
// }
|
||||
// },
|
||||
// }
|
||||
*/
|
||||
|
||||
/**
|
||||
* Single
|
||||
* // let es_query = {
|
||||
// query: {
|
||||
// query_string: {
|
||||
// query: 'id:' + uuid
|
||||
// }
|
||||
// },
|
||||
// }
|
||||
*/</code></pre>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
350
documentation/interfaces/EqQueryString.html
Normal file
350
documentation/interfaces/EqQueryString.html
Normal file
@ -0,0 +1,350 @@
|
||||
<!doctype html>
|
||||
<html class="no-js" lang="">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="x-ua-compatible" content="ie=edge">
|
||||
<title>hometask documentation</title>
|
||||
<meta name="description" content="">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
|
||||
<link rel="icon" type="image/x-icon" href="../images/favicon.ico">
|
||||
<link rel="stylesheet" href="../styles/style.css">
|
||||
<link rel="stylesheet" href="../styles/dark.css">
|
||||
<link rel="stylesheet" href="../styles/readthedocs.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="navbar navbar-default navbar-fixed-top visible-xs">
|
||||
<a href="../" class="navbar-brand">hometask documentation</a>
|
||||
<button type="button" class="btn btn-default btn-menu ion-ios-menu" id="btn-menu"></button>
|
||||
</div>
|
||||
|
||||
<div class="xs-menu menu" id="mobile-menu">
|
||||
<div id="book-search-input" role="search"><input type="text" placeholder="Type to search"></div> <compodoc-menu></compodoc-menu>
|
||||
</div>
|
||||
|
||||
<div class="container-fluid main">
|
||||
<div class="row main">
|
||||
<div class="hidden-xs menu">
|
||||
<compodoc-menu mode="normal"></compodoc-menu>
|
||||
</div>
|
||||
<!-- START CONTENT -->
|
||||
<div class="content interface">
|
||||
<div class="content-data">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<ol class="breadcrumb">
|
||||
<li>Interfaces</li>
|
||||
<li
|
||||
>
|
||||
EqQueryString</li>
|
||||
</ol>
|
||||
|
||||
<ul class="nav nav-tabs" role="tablist">
|
||||
<li class="active">
|
||||
<a href="#info" role="tab" id="info-tab" data-toggle="tab" data-link="info">Info</a>
|
||||
</li>
|
||||
<li >
|
||||
<a href="#source" role="tab" id="source-tab" data-toggle="tab" data-link="source">Source</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane fade active in" id="c-info">
|
||||
<p class="comment">
|
||||
<h3>File</h3>
|
||||
</p>
|
||||
<p class="comment">
|
||||
<code>src/core/domain/interfaces/es-query-string.interface.ts</code>
|
||||
</p>
|
||||
|
||||
|
||||
<p class="comment">
|
||||
<h3>Description</h3>
|
||||
</p>
|
||||
<p class="comment">
|
||||
<p>Structure of page metadata</p>
|
||||
|
||||
</p>
|
||||
|
||||
|
||||
<section>
|
||||
<h3 id="index">Index</h3>
|
||||
<table class="table table-sm table-bordered index-table">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<h6><b>Properties</b></h6>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<ul class="index-list">
|
||||
<li>
|
||||
<span class="modifier">Optional</span>
|
||||
<a href="#default_field"
|
||||
>
|
||||
default_field
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<span class="modifier">Optional</span>
|
||||
<a href="#fields"
|
||||
>
|
||||
fields
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#query"
|
||||
>
|
||||
query
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
|
||||
|
||||
|
||||
<section>
|
||||
<h3 id="inputs">Properties</h3>
|
||||
<table class="table table-sm table-bordered">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<a name="default_field"></a>
|
||||
<span class="name "><b>default_field</b>
|
||||
<a href="#default_field">
|
||||
<span class="icon ion-ios-link"></span>
|
||||
</a>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<code>default_field: <code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/string" target="_blank" >string</a></code>
|
||||
</code>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<i>Type : </i> <code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/string" target="_blank" >string</a></code>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<i>Optional</i>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-description"><p>Default field to perform a search on, when
|
||||
no field is specified for the query</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<table class="table table-sm table-bordered">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<a name="fields"></a>
|
||||
<span class="name "><b>fields</b>
|
||||
<a href="#fields">
|
||||
<span class="icon ion-ios-link"></span>
|
||||
</a>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<code>fields: <code>string[]</code>
|
||||
</code>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<i>Type : </i> <code>string[]</code>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<i>Optional</i>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-description"><p>Specific fields, to perform a search on
|
||||
Can't be specified with 'default_field'</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<table class="table table-sm table-bordered">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<a name="query"></a>
|
||||
<span class="name "><b>query</b>
|
||||
<a href="#query">
|
||||
<span class="icon ion-ios-link"></span>
|
||||
</a>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<code>query: <code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/string" target="_blank" >string</a></code>
|
||||
</code>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<i>Type : </i> <code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/string" target="_blank" >string</a></code>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-description"><p>Query string, that provides the data, to perform a search on</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="tab-pane fade tab-source-code" id="c-source">
|
||||
<pre class="line-numbers compodoc-sourcecode"><code class="language-typescript">export interface EqQueryString {
|
||||
/**
|
||||
* Query string, that provides the data, to perform a search on
|
||||
*/
|
||||
query: string;
|
||||
|
||||
/**
|
||||
* Default field to perform a search on, when
|
||||
* no field is specified for the query
|
||||
*/
|
||||
default_field?: string;
|
||||
|
||||
/**
|
||||
* Specific fields, to perform a search on
|
||||
* Can't be specified with 'default_field'
|
||||
*/
|
||||
fields?: string[];
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
}</code></pre>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div><div class="search-results">
|
||||
<div class="has-results">
|
||||
<h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
|
||||
<ul class="search-results-list"></ul>
|
||||
</div>
|
||||
<div class="no-results">
|
||||
<h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- END CONTENT -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<label class="dark-mode-switch">
|
||||
<input type="checkbox">
|
||||
<span class="slider">
|
||||
<svg class="slider-icon" viewBox="0 0 24 24" fill="none" height="20" stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" width="20" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M21 12.79A9 9 0 1111.21 3 7 7 0 0021 12.79z"></path>
|
||||
</svg>
|
||||
</span>
|
||||
</label>
|
||||
|
||||
<script>
|
||||
var COMPODOC_CURRENT_PAGE_DEPTH = 1;
|
||||
var COMPODOC_CURRENT_PAGE_CONTEXT = 'interface';
|
||||
var COMPODOC_CURRENT_PAGE_URL = 'EqQueryString.html';
|
||||
var MAX_SEARCH_RESULTS = 15;
|
||||
</script>
|
||||
|
||||
<script src="../js/libs/custom-elements.min.js"></script>
|
||||
<script src="../js/libs/lit-html.js"></script>
|
||||
|
||||
<script src="../js/menu-wc.js" defer></script>
|
||||
<script nomodule src="../js/menu-wc_es5.js" defer></script>
|
||||
|
||||
<script src="../js/libs/bootstrap-native.js"></script>
|
||||
|
||||
<script src="../js/libs/es6-shim.min.js"></script>
|
||||
<script src="../js/libs/EventDispatcher.js"></script>
|
||||
<script src="../js/libs/promise.min.js"></script>
|
||||
<script src="../js/libs/zepto.min.js"></script>
|
||||
|
||||
<script src="../js/compodoc.js"></script>
|
||||
|
||||
<script src="../js/tabs.js"></script>
|
||||
<script src="../js/menu.js"></script>
|
||||
<script src="../js/libs/clipboard.min.js"></script>
|
||||
<script src="../js/libs/prism.js"></script>
|
||||
<script src="../js/sourceCode.js"></script>
|
||||
<script src="../js/search/search.js"></script>
|
||||
<script src="../js/search/lunr.min.js"></script>
|
||||
<script src="../js/search/search-lunr.js"></script>
|
||||
<script src="../js/search/search_index.js"></script>
|
||||
<script src="../js/lazy-load-graphs.js"></script>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
279
documentation/interfaces/EsPit.html
Normal file
279
documentation/interfaces/EsPit.html
Normal file
@ -0,0 +1,279 @@
|
||||
<!doctype html>
|
||||
<html class="no-js" lang="">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="x-ua-compatible" content="ie=edge">
|
||||
<title>hometask documentation</title>
|
||||
<meta name="description" content="">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
|
||||
<link rel="icon" type="image/x-icon" href="../images/favicon.ico">
|
||||
<link rel="stylesheet" href="../styles/style.css">
|
||||
<link rel="stylesheet" href="../styles/dark.css">
|
||||
<link rel="stylesheet" href="../styles/readthedocs.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="navbar navbar-default navbar-fixed-top visible-xs">
|
||||
<a href="../" class="navbar-brand">hometask documentation</a>
|
||||
<button type="button" class="btn btn-default btn-menu ion-ios-menu" id="btn-menu"></button>
|
||||
</div>
|
||||
|
||||
<div class="xs-menu menu" id="mobile-menu">
|
||||
<div id="book-search-input" role="search"><input type="text" placeholder="Type to search"></div> <compodoc-menu></compodoc-menu>
|
||||
</div>
|
||||
|
||||
<div class="container-fluid main">
|
||||
<div class="row main">
|
||||
<div class="hidden-xs menu">
|
||||
<compodoc-menu mode="normal"></compodoc-menu>
|
||||
</div>
|
||||
<!-- START CONTENT -->
|
||||
<div class="content interface">
|
||||
<div class="content-data">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<ol class="breadcrumb">
|
||||
<li>Interfaces</li>
|
||||
<li
|
||||
>
|
||||
EsPit</li>
|
||||
</ol>
|
||||
|
||||
<ul class="nav nav-tabs" role="tablist">
|
||||
<li class="active">
|
||||
<a href="#info" role="tab" id="info-tab" data-toggle="tab" data-link="info">Info</a>
|
||||
</li>
|
||||
<li >
|
||||
<a href="#source" role="tab" id="source-tab" data-toggle="tab" data-link="source">Source</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane fade active in" id="c-info">
|
||||
<p class="comment">
|
||||
<h3>File</h3>
|
||||
</p>
|
||||
<p class="comment">
|
||||
<code>src/core/domain/interfaces/es-pit.interface.ts</code>
|
||||
</p>
|
||||
|
||||
|
||||
<p class="comment">
|
||||
<h3>Description</h3>
|
||||
</p>
|
||||
<p class="comment">
|
||||
<p>Structure of PIT (Point-In-Time) object</p>
|
||||
|
||||
</p>
|
||||
|
||||
|
||||
<section>
|
||||
<h3 id="index">Index</h3>
|
||||
<table class="table table-sm table-bordered index-table">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<h6><b>Properties</b></h6>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<ul class="index-list">
|
||||
<li>
|
||||
<a href="#id"
|
||||
>
|
||||
id
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#keep_alive"
|
||||
>
|
||||
keep_alive
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
|
||||
|
||||
|
||||
<section>
|
||||
<h3 id="inputs">Properties</h3>
|
||||
<table class="table table-sm table-bordered">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<a name="id"></a>
|
||||
<span class="name "><b>id</b>
|
||||
<a href="#id">
|
||||
<span class="icon ion-ios-link"></span>
|
||||
</a>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<code>id: <code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/string" target="_blank" >string</a></code>
|
||||
</code>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<i>Type : </i> <code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/string" target="_blank" >string</a></code>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-description"><p>PIT ID</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<table class="table table-sm table-bordered">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<a name="keep_alive"></a>
|
||||
<span class="name "><b>keep_alive</b>
|
||||
<a href="#keep_alive">
|
||||
<span class="icon ion-ios-link"></span>
|
||||
</a>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<code>keep_alive: <code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/string" target="_blank" >string</a></code>
|
||||
</code>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<i>Type : </i> <code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/string" target="_blank" >string</a></code>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-description"><p>Time to live of the PIT</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="tab-pane fade tab-source-code" id="c-source">
|
||||
<pre class="line-numbers compodoc-sourcecode"><code class="language-typescript">export interface EsPit {
|
||||
/**
|
||||
* PIT ID
|
||||
*/
|
||||
id: string;
|
||||
|
||||
/**
|
||||
* Time to live of the PIT
|
||||
*/
|
||||
keep_alive: string;
|
||||
}</code></pre>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div><div class="search-results">
|
||||
<div class="has-results">
|
||||
<h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
|
||||
<ul class="search-results-list"></ul>
|
||||
</div>
|
||||
<div class="no-results">
|
||||
<h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- END CONTENT -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<label class="dark-mode-switch">
|
||||
<input type="checkbox">
|
||||
<span class="slider">
|
||||
<svg class="slider-icon" viewBox="0 0 24 24" fill="none" height="20" stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" width="20" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M21 12.79A9 9 0 1111.21 3 7 7 0 0021 12.79z"></path>
|
||||
</svg>
|
||||
</span>
|
||||
</label>
|
||||
|
||||
<script>
|
||||
var COMPODOC_CURRENT_PAGE_DEPTH = 1;
|
||||
var COMPODOC_CURRENT_PAGE_CONTEXT = 'interface';
|
||||
var COMPODOC_CURRENT_PAGE_URL = 'EsPit.html';
|
||||
var MAX_SEARCH_RESULTS = 15;
|
||||
</script>
|
||||
|
||||
<script src="../js/libs/custom-elements.min.js"></script>
|
||||
<script src="../js/libs/lit-html.js"></script>
|
||||
|
||||
<script src="../js/menu-wc.js" defer></script>
|
||||
<script nomodule src="../js/menu-wc_es5.js" defer></script>
|
||||
|
||||
<script src="../js/libs/bootstrap-native.js"></script>
|
||||
|
||||
<script src="../js/libs/es6-shim.min.js"></script>
|
||||
<script src="../js/libs/EventDispatcher.js"></script>
|
||||
<script src="../js/libs/promise.min.js"></script>
|
||||
<script src="../js/libs/zepto.min.js"></script>
|
||||
|
||||
<script src="../js/compodoc.js"></script>
|
||||
|
||||
<script src="../js/tabs.js"></script>
|
||||
<script src="../js/menu.js"></script>
|
||||
<script src="../js/libs/clipboard.min.js"></script>
|
||||
<script src="../js/libs/prism.js"></script>
|
||||
<script src="../js/sourceCode.js"></script>
|
||||
<script src="../js/search/search.js"></script>
|
||||
<script src="../js/search/lunr.min.js"></script>
|
||||
<script src="../js/search/search-lunr.js"></script>
|
||||
<script src="../js/search/search_index.js"></script>
|
||||
<script src="../js/lazy-load-graphs.js"></script>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
234
documentation/interfaces/EsQuery.html
Normal file
234
documentation/interfaces/EsQuery.html
Normal file
@ -0,0 +1,234 @@
|
||||
<!doctype html>
|
||||
<html class="no-js" lang="">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="x-ua-compatible" content="ie=edge">
|
||||
<title>hometask documentation</title>
|
||||
<meta name="description" content="">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
|
||||
<link rel="icon" type="image/x-icon" href="../images/favicon.ico">
|
||||
<link rel="stylesheet" href="../styles/style.css">
|
||||
<link rel="stylesheet" href="../styles/dark.css">
|
||||
<link rel="stylesheet" href="../styles/readthedocs.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="navbar navbar-default navbar-fixed-top visible-xs">
|
||||
<a href="../" class="navbar-brand">hometask documentation</a>
|
||||
<button type="button" class="btn btn-default btn-menu ion-ios-menu" id="btn-menu"></button>
|
||||
</div>
|
||||
|
||||
<div class="xs-menu menu" id="mobile-menu">
|
||||
<div id="book-search-input" role="search"><input type="text" placeholder="Type to search"></div> <compodoc-menu></compodoc-menu>
|
||||
</div>
|
||||
|
||||
<div class="container-fluid main">
|
||||
<div class="row main">
|
||||
<div class="hidden-xs menu">
|
||||
<compodoc-menu mode="normal"></compodoc-menu>
|
||||
</div>
|
||||
<!-- START CONTENT -->
|
||||
<div class="content interface">
|
||||
<div class="content-data">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<ol class="breadcrumb">
|
||||
<li>Interfaces</li>
|
||||
<li
|
||||
>
|
||||
EsQuery</li>
|
||||
</ol>
|
||||
|
||||
<ul class="nav nav-tabs" role="tablist">
|
||||
<li class="active">
|
||||
<a href="#info" role="tab" id="info-tab" data-toggle="tab" data-link="info">Info</a>
|
||||
</li>
|
||||
<li >
|
||||
<a href="#source" role="tab" id="source-tab" data-toggle="tab" data-link="source">Source</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane fade active in" id="c-info">
|
||||
<p class="comment">
|
||||
<h3>File</h3>
|
||||
</p>
|
||||
<p class="comment">
|
||||
<code>src/core/domain/interfaces/es-query.interface.ts</code>
|
||||
</p>
|
||||
|
||||
|
||||
<p class="comment">
|
||||
<h3>Description</h3>
|
||||
</p>
|
||||
<p class="comment">
|
||||
<p>Structure of page metadata</p>
|
||||
|
||||
</p>
|
||||
|
||||
|
||||
<section>
|
||||
<h3 id="index">Index</h3>
|
||||
<table class="table table-sm table-bordered index-table">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<h6><b>Properties</b></h6>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<ul class="index-list">
|
||||
<li>
|
||||
<a href="#query_string"
|
||||
>
|
||||
query_string
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
|
||||
|
||||
|
||||
<section>
|
||||
<h3 id="inputs">Properties</h3>
|
||||
<table class="table table-sm table-bordered">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<a name="query_string"></a>
|
||||
<span class="name "><b>query_string</b>
|
||||
<a href="#query_string">
|
||||
<span class="icon ion-ios-link"></span>
|
||||
</a>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<code>query_string: <code><a href="../interfaces/EqQueryString.html" target="_self" >EqQueryString</a></code>
|
||||
</code>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<i>Type : </i> <code><a href="../interfaces/EqQueryString.html" target="_self" >EqQueryString</a></code>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-description"><p>Query string object, that specifies certain search conditions</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="tab-pane fade tab-source-code" id="c-source">
|
||||
<pre class="line-numbers compodoc-sourcecode"><code class="language-typescript">import { EqQueryString } from "./es-query-string.interface";
|
||||
|
||||
/**
|
||||
* Structure of page metadata
|
||||
*/
|
||||
export interface EsQuery {
|
||||
/**
|
||||
* Query string object, that specifies certain search conditions
|
||||
*/
|
||||
query_string: EqQueryString;
|
||||
}</code></pre>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div><div class="search-results">
|
||||
<div class="has-results">
|
||||
<h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
|
||||
<ul class="search-results-list"></ul>
|
||||
</div>
|
||||
<div class="no-results">
|
||||
<h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- END CONTENT -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<label class="dark-mode-switch">
|
||||
<input type="checkbox">
|
||||
<span class="slider">
|
||||
<svg class="slider-icon" viewBox="0 0 24 24" fill="none" height="20" stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" width="20" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M21 12.79A9 9 0 1111.21 3 7 7 0 0021 12.79z"></path>
|
||||
</svg>
|
||||
</span>
|
||||
</label>
|
||||
|
||||
<script>
|
||||
var COMPODOC_CURRENT_PAGE_DEPTH = 1;
|
||||
var COMPODOC_CURRENT_PAGE_CONTEXT = 'interface';
|
||||
var COMPODOC_CURRENT_PAGE_URL = 'EsQuery.html';
|
||||
var MAX_SEARCH_RESULTS = 15;
|
||||
</script>
|
||||
|
||||
<script src="../js/libs/custom-elements.min.js"></script>
|
||||
<script src="../js/libs/lit-html.js"></script>
|
||||
|
||||
<script src="../js/menu-wc.js" defer></script>
|
||||
<script nomodule src="../js/menu-wc_es5.js" defer></script>
|
||||
|
||||
<script src="../js/libs/bootstrap-native.js"></script>
|
||||
|
||||
<script src="../js/libs/es6-shim.min.js"></script>
|
||||
<script src="../js/libs/EventDispatcher.js"></script>
|
||||
<script src="../js/libs/promise.min.js"></script>
|
||||
<script src="../js/libs/zepto.min.js"></script>
|
||||
|
||||
<script src="../js/compodoc.js"></script>
|
||||
|
||||
<script src="../js/tabs.js"></script>
|
||||
<script src="../js/menu.js"></script>
|
||||
<script src="../js/libs/clipboard.min.js"></script>
|
||||
<script src="../js/libs/prism.js"></script>
|
||||
<script src="../js/sourceCode.js"></script>
|
||||
<script src="../js/search/search.js"></script>
|
||||
<script src="../js/search/lunr.min.js"></script>
|
||||
<script src="../js/search/search-lunr.js"></script>
|
||||
<script src="../js/search/search_index.js"></script>
|
||||
<script src="../js/lazy-load-graphs.js"></script>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
340
documentation/interfaces/EsResponseHits.html
Normal file
340
documentation/interfaces/EsResponseHits.html
Normal file
@ -0,0 +1,340 @@
|
||||
<!doctype html>
|
||||
<html class="no-js" lang="">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="x-ua-compatible" content="ie=edge">
|
||||
<title>hometask documentation</title>
|
||||
<meta name="description" content="">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
|
||||
<link rel="icon" type="image/x-icon" href="../images/favicon.ico">
|
||||
<link rel="stylesheet" href="../styles/style.css">
|
||||
<link rel="stylesheet" href="../styles/dark.css">
|
||||
<link rel="stylesheet" href="../styles/readthedocs.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="navbar navbar-default navbar-fixed-top visible-xs">
|
||||
<a href="../" class="navbar-brand">hometask documentation</a>
|
||||
<button type="button" class="btn btn-default btn-menu ion-ios-menu" id="btn-menu"></button>
|
||||
</div>
|
||||
|
||||
<div class="xs-menu menu" id="mobile-menu">
|
||||
<div id="book-search-input" role="search"><input type="text" placeholder="Type to search"></div> <compodoc-menu></compodoc-menu>
|
||||
</div>
|
||||
|
||||
<div class="container-fluid main">
|
||||
<div class="row main">
|
||||
<div class="hidden-xs menu">
|
||||
<compodoc-menu mode="normal"></compodoc-menu>
|
||||
</div>
|
||||
<!-- START CONTENT -->
|
||||
<div class="content interface">
|
||||
<div class="content-data">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<ol class="breadcrumb">
|
||||
<li>Interfaces</li>
|
||||
<li
|
||||
>
|
||||
EsResponseHits</li>
|
||||
</ol>
|
||||
|
||||
<ul class="nav nav-tabs" role="tablist">
|
||||
<li class="active">
|
||||
<a href="#info" role="tab" id="info-tab" data-toggle="tab" data-link="info">Info</a>
|
||||
</li>
|
||||
<li >
|
||||
<a href="#source" role="tab" id="source-tab" data-toggle="tab" data-link="source">Source</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane fade active in" id="c-info">
|
||||
<p class="comment">
|
||||
<h3>File</h3>
|
||||
</p>
|
||||
<p class="comment">
|
||||
<code>src/core/domain/interfaces/es-response-hits.interface.ts</code>
|
||||
</p>
|
||||
|
||||
|
||||
<p class="comment">
|
||||
<h3>Description</h3>
|
||||
</p>
|
||||
<p class="comment">
|
||||
<p>Structure of 'hits' object of Elasticsearch response</p>
|
||||
|
||||
</p>
|
||||
|
||||
|
||||
<section>
|
||||
<h3 id="index">Index</h3>
|
||||
<table class="table table-sm table-bordered index-table">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<h6><b>Properties</b></h6>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<ul class="index-list">
|
||||
<li>
|
||||
<a href="#hits"
|
||||
>
|
||||
hits
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<span class="modifier">Optional</span>
|
||||
<a href="#max_score"
|
||||
>
|
||||
max_score
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#total"
|
||||
>
|
||||
total
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
|
||||
|
||||
|
||||
<section>
|
||||
<h3 id="inputs">Properties</h3>
|
||||
<table class="table table-sm table-bordered">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<a name="hits"></a>
|
||||
<span class="name "><b>hits</b>
|
||||
<a href="#hits">
|
||||
<span class="icon ion-ios-link"></span>
|
||||
</a>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<code>hits: <code><a href="../classes/EsHitDto.html" target="_self" >EsHitDto[]</a></code>
|
||||
</code>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<i>Type : </i> <code><a href="../classes/EsHitDto.html" target="_self" >EsHitDto[]</a></code>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-description"><p>Array of search results</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<table class="table table-sm table-bordered">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<a name="max_score"></a>
|
||||
<span class="name "><b>max_score</b>
|
||||
<a href="#max_score">
|
||||
<span class="icon ion-ios-link"></span>
|
||||
</a>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<code>max_score: <code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/number" target="_blank" >number</a></code>
|
||||
</code>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<i>Type : </i> <code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/number" target="_blank" >number</a></code>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<i>Optional</i>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-description"><p>Maximum score amongst all search results</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<table class="table table-sm table-bordered">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<a name="total"></a>
|
||||
<span class="name "><b>total</b>
|
||||
<a href="#total">
|
||||
<span class="icon ion-ios-link"></span>
|
||||
</a>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<code>total: <code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/object" target="_blank" >object</a></code>
|
||||
</code>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<i>Type : </i> <code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/object" target="_blank" >object</a></code>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-description"><p>Object containing info about hits</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="tab-pane fade tab-source-code" id="c-source">
|
||||
<pre class="line-numbers compodoc-sourcecode"><code class="language-typescript">import { EsHitDto } from "../dtos/es-hit.dto";
|
||||
|
||||
/**
|
||||
* Structure of 'hits' object of Elasticsearch response
|
||||
*/
|
||||
export interface EsResponseHits {
|
||||
/**
|
||||
* Object containing info about hits
|
||||
*/
|
||||
total: object;
|
||||
|
||||
/**
|
||||
* Maximum score amongst all search results
|
||||
*/
|
||||
max_score?: number;
|
||||
|
||||
/**
|
||||
* Array of search results
|
||||
*/
|
||||
hits: EsHitDto[];
|
||||
}</code></pre>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div><div class="search-results">
|
||||
<div class="has-results">
|
||||
<h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
|
||||
<ul class="search-results-list"></ul>
|
||||
</div>
|
||||
<div class="no-results">
|
||||
<h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- END CONTENT -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<label class="dark-mode-switch">
|
||||
<input type="checkbox">
|
||||
<span class="slider">
|
||||
<svg class="slider-icon" viewBox="0 0 24 24" fill="none" height="20" stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" width="20" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M21 12.79A9 9 0 1111.21 3 7 7 0 0021 12.79z"></path>
|
||||
</svg>
|
||||
</span>
|
||||
</label>
|
||||
|
||||
<script>
|
||||
var COMPODOC_CURRENT_PAGE_DEPTH = 1;
|
||||
var COMPODOC_CURRENT_PAGE_CONTEXT = 'interface';
|
||||
var COMPODOC_CURRENT_PAGE_URL = 'EsResponseHits.html';
|
||||
var MAX_SEARCH_RESULTS = 15;
|
||||
</script>
|
||||
|
||||
<script src="../js/libs/custom-elements.min.js"></script>
|
||||
<script src="../js/libs/lit-html.js"></script>
|
||||
|
||||
<script src="../js/menu-wc.js" defer></script>
|
||||
<script nomodule src="../js/menu-wc_es5.js" defer></script>
|
||||
|
||||
<script src="../js/libs/bootstrap-native.js"></script>
|
||||
|
||||
<script src="../js/libs/es6-shim.min.js"></script>
|
||||
<script src="../js/libs/EventDispatcher.js"></script>
|
||||
<script src="../js/libs/promise.min.js"></script>
|
||||
<script src="../js/libs/zepto.min.js"></script>
|
||||
|
||||
<script src="../js/compodoc.js"></script>
|
||||
|
||||
<script src="../js/tabs.js"></script>
|
||||
<script src="../js/menu.js"></script>
|
||||
<script src="../js/libs/clipboard.min.js"></script>
|
||||
<script src="../js/libs/prism.js"></script>
|
||||
<script src="../js/sourceCode.js"></script>
|
||||
<script src="../js/search/search.js"></script>
|
||||
<script src="../js/search/lunr.min.js"></script>
|
||||
<script src="../js/search/search-lunr.js"></script>
|
||||
<script src="../js/search/search_index.js"></script>
|
||||
<script src="../js/lazy-load-graphs.js"></script>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
286
documentation/interfaces/SearchInfo.html
Normal file
286
documentation/interfaces/SearchInfo.html
Normal file
@ -0,0 +1,286 @@
|
||||
<!doctype html>
|
||||
<html class="no-js" lang="">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="x-ua-compatible" content="ie=edge">
|
||||
<title>hometask documentation</title>
|
||||
<meta name="description" content="">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
|
||||
<link rel="icon" type="image/x-icon" href="../images/favicon.ico">
|
||||
<link rel="stylesheet" href="../styles/style.css">
|
||||
<link rel="stylesheet" href="../styles/dark.css">
|
||||
<link rel="stylesheet" href="../styles/readthedocs.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="navbar navbar-default navbar-fixed-top visible-xs">
|
||||
<a href="../" class="navbar-brand">hometask documentation</a>
|
||||
<button type="button" class="btn btn-default btn-menu ion-ios-menu" id="btn-menu"></button>
|
||||
</div>
|
||||
|
||||
<div class="xs-menu menu" id="mobile-menu">
|
||||
<div id="book-search-input" role="search"><input type="text" placeholder="Type to search"></div> <compodoc-menu></compodoc-menu>
|
||||
</div>
|
||||
|
||||
<div class="container-fluid main">
|
||||
<div class="row main">
|
||||
<div class="hidden-xs menu">
|
||||
<compodoc-menu mode="normal"></compodoc-menu>
|
||||
</div>
|
||||
<!-- START CONTENT -->
|
||||
<div class="content interface">
|
||||
<div class="content-data">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<ol class="breadcrumb">
|
||||
<li>Interfaces</li>
|
||||
<li
|
||||
>
|
||||
SearchInfo</li>
|
||||
</ol>
|
||||
|
||||
<ul class="nav nav-tabs" role="tablist">
|
||||
<li class="active">
|
||||
<a href="#info" role="tab" id="info-tab" data-toggle="tab" data-link="info">Info</a>
|
||||
</li>
|
||||
<li >
|
||||
<a href="#source" role="tab" id="source-tab" data-toggle="tab" data-link="source">Source</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane fade active in" id="c-info">
|
||||
<p class="comment">
|
||||
<h3>File</h3>
|
||||
</p>
|
||||
<p class="comment">
|
||||
<code>src/core/domain/interfaces/search-info.interface.ts</code>
|
||||
</p>
|
||||
|
||||
|
||||
<p class="comment">
|
||||
<h3>Description</h3>
|
||||
</p>
|
||||
<p class="comment">
|
||||
<p>Structure of search metadata</p>
|
||||
|
||||
</p>
|
||||
|
||||
|
||||
<section>
|
||||
<h3 id="index">Index</h3>
|
||||
<table class="table table-sm table-bordered index-table">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<h6><b>Properties</b></h6>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<ul class="index-list">
|
||||
<li>
|
||||
<a href="#pit"
|
||||
>
|
||||
pit
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#tiebreaker"
|
||||
>
|
||||
tiebreaker
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
|
||||
|
||||
|
||||
<section>
|
||||
<h3 id="inputs">Properties</h3>
|
||||
<table class="table table-sm table-bordered">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<a name="pit"></a>
|
||||
<span class="name "><b>pit</b>
|
||||
<a href="#pit">
|
||||
<span class="icon ion-ios-link"></span>
|
||||
</a>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<code>pit: <code><a href="../interfaces/EsPit.html" target="_self" >EsPit</a></code>
|
||||
</code>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<i>Type : </i> <code><a href="../interfaces/EsPit.html" target="_self" >EsPit</a></code>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-description"><p>Previous search saved PIT</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<table class="table table-sm table-bordered">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<a name="tiebreaker"></a>
|
||||
<span class="name "><b>tiebreaker</b>
|
||||
<a href="#tiebreaker">
|
||||
<span class="icon ion-ios-link"></span>
|
||||
</a>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<code>tiebreaker: <code>[]</code>
|
||||
</code>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<i>Type : </i> <code>[]</code>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-description"><p>Special tiebreaker used by Elasticsearch.
|
||||
Indicates the starting point of next search</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="tab-pane fade tab-source-code" id="c-source">
|
||||
<pre class="line-numbers compodoc-sourcecode"><code class="language-typescript">import { EsPit } from "./es-pit.interface";
|
||||
|
||||
/**
|
||||
* Structure of search metadata
|
||||
*/
|
||||
export interface SearchInfo {
|
||||
/**
|
||||
* Previous search saved PIT
|
||||
*/
|
||||
pit: EsPit;
|
||||
|
||||
/**
|
||||
* Special tiebreaker used by Elasticsearch.
|
||||
* Indicates the starting point of next search
|
||||
*/
|
||||
tiebreaker: unknown[];
|
||||
}</code></pre>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div><div class="search-results">
|
||||
<div class="has-results">
|
||||
<h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
|
||||
<ul class="search-results-list"></ul>
|
||||
</div>
|
||||
<div class="no-results">
|
||||
<h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- END CONTENT -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<label class="dark-mode-switch">
|
||||
<input type="checkbox">
|
||||
<span class="slider">
|
||||
<svg class="slider-icon" viewBox="0 0 24 24" fill="none" height="20" stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" width="20" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M21 12.79A9 9 0 1111.21 3 7 7 0 0021 12.79z"></path>
|
||||
</svg>
|
||||
</span>
|
||||
</label>
|
||||
|
||||
<script>
|
||||
var COMPODOC_CURRENT_PAGE_DEPTH = 1;
|
||||
var COMPODOC_CURRENT_PAGE_CONTEXT = 'interface';
|
||||
var COMPODOC_CURRENT_PAGE_URL = 'SearchInfo.html';
|
||||
var MAX_SEARCH_RESULTS = 15;
|
||||
</script>
|
||||
|
||||
<script src="../js/libs/custom-elements.min.js"></script>
|
||||
<script src="../js/libs/lit-html.js"></script>
|
||||
|
||||
<script src="../js/menu-wc.js" defer></script>
|
||||
<script nomodule src="../js/menu-wc_es5.js" defer></script>
|
||||
|
||||
<script src="../js/libs/bootstrap-native.js"></script>
|
||||
|
||||
<script src="../js/libs/es6-shim.min.js"></script>
|
||||
<script src="../js/libs/EventDispatcher.js"></script>
|
||||
<script src="../js/libs/promise.min.js"></script>
|
||||
<script src="../js/libs/zepto.min.js"></script>
|
||||
|
||||
<script src="../js/compodoc.js"></script>
|
||||
|
||||
<script src="../js/tabs.js"></script>
|
||||
<script src="../js/menu.js"></script>
|
||||
<script src="../js/libs/clipboard.min.js"></script>
|
||||
<script src="../js/libs/prism.js"></script>
|
||||
<script src="../js/sourceCode.js"></script>
|
||||
<script src="../js/search/search.js"></script>
|
||||
<script src="../js/search/lunr.min.js"></script>
|
||||
<script src="../js/search/search-lunr.js"></script>
|
||||
<script src="../js/search/search_index.js"></script>
|
||||
<script src="../js/lazy-load-graphs.js"></script>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
@ -121,13 +121,13 @@ customElements.define('compodoc-menu', class extends HTMLElement {
|
||||
<a href="modules/SearchModule.html" data-type="entity-link" >SearchModule</a>
|
||||
<li class="chapter inner">
|
||||
<div class="simple menu-toggler" data-toggle="collapse" ${ isNormalMode ?
|
||||
'data-target="#controllers-links-module-SearchModule-4d6b5def969a39269d635bca6413568deaac5fdf860905918f45ad6efd54f8bcc196e457466f4e81c1575bf525bc7c6017cb905f4c7d3b6290150dee92624578"' : 'data-target="#xs-controllers-links-module-SearchModule-4d6b5def969a39269d635bca6413568deaac5fdf860905918f45ad6efd54f8bcc196e457466f4e81c1575bf525bc7c6017cb905f4c7d3b6290150dee92624578"' }>
|
||||
'data-target="#controllers-links-module-SearchModule-97f6a3d41d8e000415549f58c31c09480db302f0be4dafb5300e2053a33b502290eaae74ae320340b5ed216dd9bb43790d919f5e4525ffd833604b101442c475"' : 'data-target="#xs-controllers-links-module-SearchModule-97f6a3d41d8e000415549f58c31c09480db302f0be4dafb5300e2053a33b502290eaae74ae320340b5ed216dd9bb43790d919f5e4525ffd833604b101442c475"' }>
|
||||
<span class="icon ion-md-swap"></span>
|
||||
<span>Controllers</span>
|
||||
<span class="icon ion-ios-arrow-down"></span>
|
||||
</div>
|
||||
<ul class="links collapse" ${ isNormalMode ? 'id="controllers-links-module-SearchModule-4d6b5def969a39269d635bca6413568deaac5fdf860905918f45ad6efd54f8bcc196e457466f4e81c1575bf525bc7c6017cb905f4c7d3b6290150dee92624578"' :
|
||||
'id="xs-controllers-links-module-SearchModule-4d6b5def969a39269d635bca6413568deaac5fdf860905918f45ad6efd54f8bcc196e457466f4e81c1575bf525bc7c6017cb905f4c7d3b6290150dee92624578"' }>
|
||||
<ul class="links collapse" ${ isNormalMode ? 'id="controllers-links-module-SearchModule-97f6a3d41d8e000415549f58c31c09480db302f0be4dafb5300e2053a33b502290eaae74ae320340b5ed216dd9bb43790d919f5e4525ffd833604b101442c475"' :
|
||||
'id="xs-controllers-links-module-SearchModule-97f6a3d41d8e000415549f58c31c09480db302f0be4dafb5300e2053a33b502290eaae74ae320340b5ed216dd9bb43790d919f5e4525ffd833604b101442c475"' }>
|
||||
<li class="link">
|
||||
<a href="controllers/PapersController.html" data-type="entity-link" data-context="sub-entity" data-context-id="modules" >PapersController</a>
|
||||
</li>
|
||||
@ -135,13 +135,13 @@ customElements.define('compodoc-menu', class extends HTMLElement {
|
||||
</li>
|
||||
<li class="chapter inner">
|
||||
<div class="simple menu-toggler" data-toggle="collapse" ${ isNormalMode ?
|
||||
'data-target="#injectables-links-module-SearchModule-4d6b5def969a39269d635bca6413568deaac5fdf860905918f45ad6efd54f8bcc196e457466f4e81c1575bf525bc7c6017cb905f4c7d3b6290150dee92624578"' : 'data-target="#xs-injectables-links-module-SearchModule-4d6b5def969a39269d635bca6413568deaac5fdf860905918f45ad6efd54f8bcc196e457466f4e81c1575bf525bc7c6017cb905f4c7d3b6290150dee92624578"' }>
|
||||
'data-target="#injectables-links-module-SearchModule-97f6a3d41d8e000415549f58c31c09480db302f0be4dafb5300e2053a33b502290eaae74ae320340b5ed216dd9bb43790d919f5e4525ffd833604b101442c475"' : 'data-target="#xs-injectables-links-module-SearchModule-97f6a3d41d8e000415549f58c31c09480db302f0be4dafb5300e2053a33b502290eaae74ae320340b5ed216dd9bb43790d919f5e4525ffd833604b101442c475"' }>
|
||||
<span class="icon ion-md-arrow-round-down"></span>
|
||||
<span>Injectables</span>
|
||||
<span class="icon ion-ios-arrow-down"></span>
|
||||
</div>
|
||||
<ul class="links collapse" ${ isNormalMode ? 'id="injectables-links-module-SearchModule-4d6b5def969a39269d635bca6413568deaac5fdf860905918f45ad6efd54f8bcc196e457466f4e81c1575bf525bc7c6017cb905f4c7d3b6290150dee92624578"' :
|
||||
'id="xs-injectables-links-module-SearchModule-4d6b5def969a39269d635bca6413568deaac5fdf860905918f45ad6efd54f8bcc196e457466f4e81c1575bf525bc7c6017cb905f4c7d3b6290150dee92624578"' }>
|
||||
<ul class="links collapse" ${ isNormalMode ? 'id="injectables-links-module-SearchModule-97f6a3d41d8e000415549f58c31c09480db302f0be4dafb5300e2053a33b502290eaae74ae320340b5ed216dd9bb43790d919f5e4525ffd833604b101442c475"' :
|
||||
'id="xs-injectables-links-module-SearchModule-97f6a3d41d8e000415549f58c31c09480db302f0be4dafb5300e2053a33b502290eaae74ae320340b5ed216dd9bb43790d919f5e4525ffd833604b101442c475"' }>
|
||||
<li class="link">
|
||||
<a href="injectables/SearchService.html" data-type="entity-link" data-context="sub-entity" data-context-id="modules" >SearchService</a>
|
||||
</li>
|
||||
@ -174,6 +174,9 @@ customElements.define('compodoc-menu', class extends HTMLElement {
|
||||
<li class="link">
|
||||
<a href="classes/EnvironmentVariables.html" data-type="entity-link" >EnvironmentVariables</a>
|
||||
</li>
|
||||
<li class="link">
|
||||
<a href="classes/EsHitDto.html" data-type="entity-link" >EsHitDto</a>
|
||||
</li>
|
||||
<li class="link">
|
||||
<a href="classes/EsQueryDto.html" data-type="entity-link" >EsQueryDto</a>
|
||||
</li>
|
||||
@ -186,6 +189,15 @@ customElements.define('compodoc-menu', class extends HTMLElement {
|
||||
<li class="link">
|
||||
<a href="classes/PageDto.html" data-type="entity-link" >PageDto</a>
|
||||
</li>
|
||||
<li class="link">
|
||||
<a href="classes/PaperDto.html" data-type="entity-link" >PaperDto</a>
|
||||
</li>
|
||||
<li class="link">
|
||||
<a href="classes/PrevSearch.html" data-type="entity-link" >PrevSearch</a>
|
||||
</li>
|
||||
<li class="link">
|
||||
<a href="classes/RequestDto.html" data-type="entity-link" >RequestDto</a>
|
||||
</li>
|
||||
<li class="link">
|
||||
<a href="classes/SearchQueryDto.html" data-type="entity-link" >SearchQueryDto</a>
|
||||
</li>
|
||||
@ -237,12 +249,27 @@ customElements.define('compodoc-menu', class extends HTMLElement {
|
||||
<span class="icon ion-ios-arrow-down"></span>
|
||||
</div>
|
||||
<ul class="links collapse " ${ isNormalMode ? ' id="interfaces-links"' : 'id="xs-interfaces-links"' }>
|
||||
<li class="link">
|
||||
<a href="interfaces/EqQueryString.html" data-type="entity-link" >EqQueryString</a>
|
||||
</li>
|
||||
<li class="link">
|
||||
<a href="interfaces/EsPit.html" data-type="entity-link" >EsPit</a>
|
||||
</li>
|
||||
<li class="link">
|
||||
<a href="interfaces/EsQuery.html" data-type="entity-link" >EsQuery</a>
|
||||
</li>
|
||||
<li class="link">
|
||||
<a href="interfaces/EsResponseHits.html" data-type="entity-link" >EsResponseHits</a>
|
||||
</li>
|
||||
<li class="link">
|
||||
<a href="interfaces/HttpResponse.html" data-type="entity-link" >HttpResponse</a>
|
||||
</li>
|
||||
<li class="link">
|
||||
<a href="interfaces/PageMeta.html" data-type="entity-link" >PageMeta</a>
|
||||
</li>
|
||||
<li class="link">
|
||||
<a href="interfaces/SearchInfo.html" data-type="entity-link" >SearchInfo</a>
|
||||
</li>
|
||||
<li class="link">
|
||||
<a href="interfaces/ValidationPipeOptions.html" data-type="entity-link" >ValidationPipeOptions</a>
|
||||
</li>
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -64,6 +64,9 @@
|
||||
<li>
|
||||
<a href="#EnvObjects" title="src/infrastructure/config/env.objects.ts" ><b>EnvObjects</b> (src/.../env.objects.ts)</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#EsTime" title="src/core/domain/enums/es-time.enum.ts" ><b>EsTime</b> (src/.../es-time.enum.ts)</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#HttpResponseDescriptions" title="src/core/domain/enums/httpResponse/httpResponseDescriptions.enum.ts" ><b>HttpResponseDescriptions</b> (src/.../httpResponseDescriptions.enum.ts)</a>
|
||||
</li>
|
||||
@ -137,6 +140,95 @@
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
<h3>src/core/domain/enums/es-time.enum.ts</h3>
|
||||
<section>
|
||||
<table class="table table-sm table-bordered">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<a name="EsTime"></a>
|
||||
<span class="name "><b>EsTime</b><a href="#EsTime"><span class="icon ion-ios-link"></span></a></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-description"><p>Elasticsearch time-units</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
days
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<i>Value : </i><code>d</code>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
hours
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<i>Value : </i><code>h</code>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
min
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<i>Value : </i><code>m</code>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
sec
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<i>Value : </i><code>s</code>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
ms
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<i>Value : </i><code>ms</code>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
us
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<i>Value : </i><code>micros</code>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
ns
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<i>Value : </i><code>nanos</code>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
<h3>src/core/domain/enums/httpResponse/httpResponseDescriptions.enum.ts</h3>
|
||||
<section>
|
||||
@ -1200,6 +1292,12 @@
|
||||
<span class="name "><b>Order</b><a href="#Order"><span class="icon ion-ios-link"></span></a></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-description"><p>Page display order</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
ASC
|
||||
@ -1207,7 +1305,7 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<i>Value : </i><code>ASC</code>
|
||||
<i>Value : </i><code>asc</code>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@ -1217,7 +1315,7 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<i>Value : </i><code>DESC</code>
|
||||
<i>Value : </i><code>desc</code>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
@ -61,6 +61,9 @@
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<ul class="index-list">
|
||||
<li>
|
||||
<a href="#allowedProperties" title="src/core/domain/dtos/es-hit.dto.ts" ><b>allowedProperties</b> (src/.../es-hit.dto.ts)</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#allowedProperties" title="src/core/domain/dtos/es-query.dto.ts" ><b>allowedProperties</b> (src/.../es-query.dto.ts)</a>
|
||||
</li>
|
||||
@ -70,6 +73,12 @@
|
||||
<li>
|
||||
<a href="#allowedProperties" title="src/core/domain/dtos/page.dto.ts" ><b>allowedProperties</b> (src/.../page.dto.ts)</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#allowedProperties" title="src/core/domain/dtos/paper.dto.ts" ><b>allowedProperties</b> (src/.../paper.dto.ts)</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#allowedProperties" title="src/core/domain/dtos/request.dto.ts" ><b>allowedProperties</b> (src/.../request.dto.ts)</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#allowedProperties" title="src/core/domain/dtos/search-q.dto.ts" ><b>allowedProperties</b> (src/.../search-q.dto.ts)</a>
|
||||
</li>
|
||||
@ -101,6 +110,41 @@
|
||||
</table>
|
||||
</section>
|
||||
|
||||
<h3>src/core/domain/dtos/es-hit.dto.ts</h3>
|
||||
<section>
|
||||
<h3></h3> <table class="table table-sm table-bordered">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<a name="allowedProperties"></a>
|
||||
<span class="name">
|
||||
<span ><b>allowedProperties</b></span>
|
||||
<a href="#allowedProperties"><span class="icon ion-ios-link"></span></a>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<i>Type : </i> <code>[]</code>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<i>Default value : </i><code>['sort', '_source', '_score']</code>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-description"><p>List of allowed properties in this DTO</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
<h3>src/core/domain/dtos/es-query.dto.ts</h3>
|
||||
<section>
|
||||
<h3></h3> <table class="table table-sm table-bordered">
|
||||
@ -157,7 +201,7 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<i>Default value : </i><code>['took', 'timed_out', '_shards', 'hits']</code>
|
||||
<i>Default value : </i><code>['took', 'timed_out', '_shards', 'hits', 'pit_id']</code>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@ -206,6 +250,76 @@
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
<h3>src/core/domain/dtos/paper.dto.ts</h3>
|
||||
<section>
|
||||
<h3></h3> <table class="table table-sm table-bordered">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<a name="allowedProperties"></a>
|
||||
<span class="name">
|
||||
<span ><b>allowedProperties</b></span>
|
||||
<a href="#allowedProperties"><span class="icon ion-ios-link"></span></a>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<i>Type : </i> <code>[]</code>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<i>Default value : </i><code>['id', 'title', 'authors', 'topic', 'summary', 'tags', 'content']</code>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-description"><p>List of allowed properties in this DTO</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
<h3>src/core/domain/dtos/request.dto.ts</h3>
|
||||
<section>
|
||||
<h3></h3> <table class="table table-sm table-bordered">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<a name="allowedProperties"></a>
|
||||
<span class="name">
|
||||
<span ><b>allowedProperties</b></span>
|
||||
<a href="#allowedProperties"><span class="icon ion-ios-link"></span></a>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<i>Type : </i> <code>[]</code>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<i>Default value : </i><code>['query', 'es_query']</code>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-description"><p>List of allowed properties in this DTO</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
<h3>src/core/domain/dtos/search-q.dto.ts</h3>
|
||||
<section>
|
||||
<h3></h3> <table class="table table-sm table-bordered">
|
||||
|
@ -14,14 +14,14 @@
|
||||
<title>cluster_CommonModule</title>
|
||||
<polygon fill="none" stroke="black" stroke-dasharray="1,5" points="8,-32.8 8,-230.8 304,-230.8 304,-32.8 8,-32.8"/>
|
||||
</g>
|
||||
<g id="clust4" class="cluster">
|
||||
<title>cluster_CommonModule_exports</title>
|
||||
<polygon fill="none" stroke="black" points="16,-170.8 16,-222.8 296,-222.8 296,-170.8 16,-170.8"/>
|
||||
</g>
|
||||
<g id="clust3" class="cluster">
|
||||
<title>cluster_CommonModule_imports</title>
|
||||
<polygon fill="none" stroke="black" points="20,-40.8 20,-92.8 292,-92.8 292,-40.8 20,-40.8"/>
|
||||
</g>
|
||||
<g id="clust4" class="cluster">
|
||||
<title>cluster_CommonModule_exports</title>
|
||||
<polygon fill="none" stroke="black" points="16,-170.8 16,-222.8 296,-222.8 296,-170.8 16,-170.8"/>
|
||||
</g>
|
||||
<!-- HttpResponseModule -->
|
||||
<g id="node1" class="node">
|
||||
<title>HttpResponseModule</title>
|
||||
|
Before Width: | Height: | Size: 4.3 KiB After Width: | Height: | Size: 4.3 KiB |
@ -178,10 +178,8 @@
|
||||
<div class="tab-pane fade tab-source-code" id="c-source">
|
||||
<pre class="line-numbers compodoc-sourcecode"><code class="language-typescript">import { HttpModule } from "@nestjs/axios";
|
||||
import { Module } from "@nestjs/common";
|
||||
import { ConfigModule } from "@nestjs/config";
|
||||
import { PapersController } from "src/application";
|
||||
import { SearchService } from "../../core/services/common/search.service";
|
||||
import { configuration } from "../config";
|
||||
|
||||
/**
|
||||
* search module
|
||||
|
@ -14,14 +14,14 @@
|
||||
<title>cluster_SearchModule</title>
|
||||
<polygon fill="none" stroke="black" stroke-dasharray="1,5" points="8,-32.8 8,-230.8 172,-230.8 172,-32.8 8,-32.8"/>
|
||||
</g>
|
||||
<g id="clust4" class="cluster">
|
||||
<title>cluster_SearchModule_exports</title>
|
||||
<polygon fill="none" stroke="black" points="32,-170.8 32,-222.8 148,-222.8 148,-170.8 32,-170.8"/>
|
||||
</g>
|
||||
<g id="clust6" class="cluster">
|
||||
<title>cluster_SearchModule_providers</title>
|
||||
<polygon fill="none" stroke="black" points="16,-40.8 16,-92.8 164,-92.8 164,-40.8 16,-40.8"/>
|
||||
</g>
|
||||
<g id="clust4" class="cluster">
|
||||
<title>cluster_SearchModule_exports</title>
|
||||
<polygon fill="none" stroke="black" points="32,-170.8 32,-222.8 148,-222.8 148,-170.8 32,-170.8"/>
|
||||
</g>
|
||||
<!-- SearchService -->
|
||||
<g id="node1" class="node">
|
||||
<title>SearchService </title>
|
||||
|
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 2.8 KiB |
@ -301,7 +301,7 @@
|
||||
<div class="card text-center">
|
||||
<div class="card-block">
|
||||
<h4 class="card-title"><span class="icon ion-ios-paper"></span></h4>
|
||||
<p class="card-text">7 Classes</p>
|
||||
<p class="card-text">11 Classes</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -317,7 +317,7 @@
|
||||
<div class="card text-center">
|
||||
<div class="card-block">
|
||||
<h4 class="card-title"><span class="icon ion-md-information-circle-outline"></span></h4>
|
||||
<p class="card-text">4 Interfaces</p>
|
||||
<p class="card-text">9 Interfaces</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -1,11 +1,9 @@
|
||||
import { Controller, Get, HttpCode, HttpException, Next, Param, ParseUUIDPipe, Put, Query, Req, Res, UseInterceptors } from "@nestjs/common";
|
||||
import { SearchService } from "../../core/services/common/search.service";
|
||||
import { Response } from "express";
|
||||
import { PageInterceptor } from "src/core/interceptors/page.interceptor";
|
||||
import { LoggerInterceptor } from "src/core/interceptors";
|
||||
import { SearchResultDto } from "src/core/domain/dtos/search-result.dto";
|
||||
import { ApiOperation, ApiResponse } from "@nestjs/swagger";
|
||||
import { SearchQueryDto } from "src/core/domain/dtos";
|
||||
import { RequestDto } from "src/core/domain/dtos/request.dto";
|
||||
|
||||
/**
|
||||
* /papers/ route controller
|
||||
@ -29,8 +27,8 @@ export class PapersController {
|
||||
@Get('search')
|
||||
@UseInterceptors(PageInterceptor)
|
||||
@HttpCode(200)
|
||||
getByContext(@Query() query): object {
|
||||
return this.searchService.findByContext(query.query).then(
|
||||
getByContext(@Req() query: RequestDto): object {
|
||||
return this.searchService.findByContext(query.es_query).then(
|
||||
(response: SearchResultDto) => {
|
||||
return response.data;
|
||||
},
|
||||
|
45
src/core/domain/dtos/es-hit.dto.ts
Normal file
45
src/core/domain/dtos/es-hit.dto.ts
Normal file
@ -0,0 +1,45 @@
|
||||
import { ApiProperty } from "@nestjs/swagger";
|
||||
import { IsArray, IsDefined, IsIn, IsInt, IsNotEmpty, IsOptional, IsString } from "class-validator";
|
||||
import { PaperDto } from "./paper.dto";
|
||||
|
||||
/**
|
||||
* List of allowed properties in this DTO
|
||||
*/
|
||||
const allowedProperties = ['sort', '_source', '_score'];
|
||||
|
||||
/**
|
||||
* Structure of the document stored and retrieved from Elasticsearch
|
||||
*/
|
||||
export class EsHitDto {
|
||||
/**
|
||||
* Actual document stored in Elasticsearch
|
||||
*/
|
||||
@IsNotEmpty()
|
||||
@ApiProperty({
|
||||
description: 'Actual document (paper) stored in Elasticsearch',
|
||||
example: {
|
||||
id: 'sssss'
|
||||
}
|
||||
})
|
||||
_source: PaperDto;
|
||||
|
||||
/**
|
||||
* List of objects that represents how the hit was sorted
|
||||
*/
|
||||
@IsOptional()
|
||||
@ApiProperty({
|
||||
description: 'List of objects that represents how the hit was sorted',
|
||||
example: {}
|
||||
})
|
||||
sort?: [];
|
||||
|
||||
/**
|
||||
* Hit relevance score
|
||||
*/
|
||||
@IsOptional()
|
||||
@ApiProperty({
|
||||
description: 'Relevance score',
|
||||
example: 1.2355
|
||||
})
|
||||
_score?: number;
|
||||
}
|
@ -1,5 +1,7 @@
|
||||
import { ApiProperty } from "@nestjs/swagger";
|
||||
import { IsDefined, IsInt, IsNotEmpty, IsNumber, IsObject } from "class-validator";
|
||||
import { IsArray, IsDefined, IsInt, IsNotEmpty, IsNumber, IsObject, IsOptional } from "class-validator";
|
||||
import { EsPit } from "../interfaces/es-pit.interface";
|
||||
import { EsQuery } from "../interfaces/es-query.interface"
|
||||
|
||||
/**
|
||||
* List of allowed properties in this DTO
|
||||
@ -13,6 +15,7 @@ import { IsDefined, IsInt, IsNotEmpty, IsNumber, IsObject } from "class-validato
|
||||
/**
|
||||
* Maximum number of elements returned by Elasticsearch
|
||||
*/
|
||||
@IsOptional()
|
||||
@IsDefined()
|
||||
@IsNumber()
|
||||
@IsInt()
|
||||
@ -20,7 +23,7 @@ import { IsDefined, IsInt, IsNotEmpty, IsNumber, IsObject } from "class-validato
|
||||
description: 'Maximum number of elements returned by Elasticsearch',
|
||||
example: 30
|
||||
})
|
||||
size: number;
|
||||
size?: number;
|
||||
|
||||
/**
|
||||
* The search query object passed to Elasticsearch
|
||||
@ -29,17 +32,51 @@ import { IsDefined, IsInt, IsNotEmpty, IsNumber, IsObject } from "class-validato
|
||||
@IsObject()
|
||||
@ApiProperty({
|
||||
description: 'Search query object passed to Elasticsearch',
|
||||
example: false,
|
||||
example: {},
|
||||
})
|
||||
query: object;
|
||||
query: EsQuery;
|
||||
|
||||
/**
|
||||
* Object, that stores Point-In-Time ID and time alive
|
||||
* Object, that stores PIT ID and time alive
|
||||
*/
|
||||
pit: object;
|
||||
@IsOptional()
|
||||
@IsObject()
|
||||
@ApiProperty({
|
||||
description: 'PIT object',
|
||||
example: {}
|
||||
})
|
||||
pit?: EsPit;
|
||||
|
||||
/**
|
||||
* Object, that stores
|
||||
* Sorting info
|
||||
*/
|
||||
sort: object;
|
||||
@IsOptional()
|
||||
@IsArray()
|
||||
@ApiProperty({
|
||||
description: '',
|
||||
example: []
|
||||
})
|
||||
sort?: unknown[];
|
||||
|
||||
/**
|
||||
* Pagination info
|
||||
*/
|
||||
@IsOptional()
|
||||
@IsArray()
|
||||
@ApiProperty({
|
||||
description: '',
|
||||
example: []
|
||||
})
|
||||
search_after?: unknown[];
|
||||
|
||||
/**
|
||||
* Constructs an empty object
|
||||
*/
|
||||
constructor() {
|
||||
this.size = 10;
|
||||
this.query = undefined;
|
||||
this.pit = undefined;
|
||||
this.sort = undefined;
|
||||
this.search_after = undefined;
|
||||
}
|
||||
}
|
@ -1,10 +1,11 @@
|
||||
import { ApiProperty } from "@nestjs/swagger";
|
||||
import { IsBoolean, IsDefined, IsNotEmpty, IsNumber, IsObject, IsOptional } from "class-validator";
|
||||
import { IsBoolean, IsDefined, IsNotEmpty, IsNumber, IsObject, IsOptional, IsString } from "class-validator";
|
||||
import { EsResponseHits } from "../interfaces/es-response-hits.interface";
|
||||
|
||||
/**
|
||||
* List of allowed properties in this DTO
|
||||
*/
|
||||
const allowedProperties = ['took', 'timed_out', '_shards', 'hits'];
|
||||
const allowedProperties = ['took', 'timed_out', '_shards', 'hits', 'pit_id'];
|
||||
|
||||
/**
|
||||
* Elasticsearch response DTO
|
||||
@ -79,5 +80,16 @@ export class EsResponseDto {
|
||||
}],
|
||||
}
|
||||
})
|
||||
hits: object;
|
||||
hits: EsResponseHits;
|
||||
|
||||
/**
|
||||
* ID of the PIT used in the search
|
||||
*/
|
||||
@IsString()
|
||||
@IsOptional()
|
||||
@ApiProperty({
|
||||
description: 'PIT ID used to search for results',
|
||||
example: '46ToAwMDaWR5BXV1aWQyKwZub2RlXzMAAAAAAAAAACoBYwADaWR4BXV1aWQxAgZub2RlXzEAAAAAAAAAAAEBYQADaWR5BXV1aWQyKgZub2RlXzIAAAAAAAAAAAwBYgACBXV1aWQyAAAFdXVpZDEAAQltYXRjaF9hbGw_gAAAAA=='
|
||||
})
|
||||
pit_id?: string;
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
import { ApiProperty } from "@nestjs/swagger";
|
||||
import { IsArray } from "class-validator";
|
||||
import { PageMeta } from "../interfaces/page-meta.interface";
|
||||
import { PaperDto } from "./paper.dto";
|
||||
|
||||
/**
|
||||
* List of allowed properties in this DTO
|
||||
@ -10,7 +11,7 @@ const allowedProperties = ['data', 'meta'];
|
||||
/**
|
||||
* Page model for pagination
|
||||
*/
|
||||
export class PageDto<T> {
|
||||
export class PageDto {
|
||||
/**
|
||||
* Data block of the page
|
||||
*/
|
||||
@ -19,7 +20,7 @@ export class PageDto<T> {
|
||||
description: 'All data the page contains',
|
||||
isArray: true,
|
||||
})
|
||||
readonly data: T[];
|
||||
readonly data: PaperDto[];
|
||||
|
||||
/**
|
||||
* Metadata of the page
|
||||
@ -35,7 +36,7 @@ export class PageDto<T> {
|
||||
* @param data
|
||||
* @param meta
|
||||
*/
|
||||
constructor(data: T[], meta: PageMeta) {
|
||||
constructor(data: PaperDto[], meta: PageMeta) {
|
||||
this.data = data;
|
||||
this.meta = meta;
|
||||
}
|
||||
|
89
src/core/domain/dtos/paper.dto.ts
Normal file
89
src/core/domain/dtos/paper.dto.ts
Normal file
@ -0,0 +1,89 @@
|
||||
import { ApiProperty } from "@nestjs/swagger";
|
||||
import { IsArray, IsDefined, IsIn, IsInt, IsNotEmpty, IsOptional, IsString } from "class-validator";
|
||||
import { EsQueryDto } from "./es-query.dto";
|
||||
import { SearchQueryDto } from "./search-q.dto";
|
||||
|
||||
/**
|
||||
* List of allowed properties in this DTO
|
||||
*/
|
||||
const allowedProperties = ['id', 'title', 'authors', 'topic', 'summary', 'tags', 'content'];
|
||||
|
||||
/**
|
||||
* Structure of the document stored and retrieved from Elasticsearch
|
||||
*/
|
||||
export class PaperDto {
|
||||
/**
|
||||
* Unique ID of the paper
|
||||
*/
|
||||
@IsNotEmpty()
|
||||
@IsString()
|
||||
@ApiProperty({
|
||||
description: 'Unique ID of the paper',
|
||||
example: 'cc3c3cca-f763-495c-8dfa-69c45ca738ff'
|
||||
})
|
||||
id: string;
|
||||
|
||||
/**
|
||||
* Title of the paper
|
||||
*/
|
||||
@IsNotEmpty()
|
||||
@IsString()
|
||||
@ApiProperty({
|
||||
description: 'Title of the paper',
|
||||
example: 'Mucosal associated invariant T cell',
|
||||
})
|
||||
title: string;
|
||||
|
||||
/**
|
||||
* List of authors of the paper
|
||||
*/
|
||||
@IsNotEmpty()
|
||||
@IsArray()
|
||||
@ApiProperty({
|
||||
description: 'List of authors of the paper',
|
||||
example: ['Daniil Mikhaylov', 'Denis Gorbunov', 'Maxim Ten']
|
||||
})
|
||||
authors: string[];
|
||||
|
||||
/**
|
||||
* Topic of the paper
|
||||
*/
|
||||
@IsNotEmpty()
|
||||
@IsString()
|
||||
@ApiProperty({
|
||||
description: 'Topic of the paper',
|
||||
example: 'Physics'
|
||||
})
|
||||
topic: string;
|
||||
|
||||
/**
|
||||
* Summary of the paper. May be a short excerpt from the main text.
|
||||
*/
|
||||
@IsNotEmpty()
|
||||
@IsString()
|
||||
@ApiProperty({
|
||||
description: 'Summary of the paper. May be a short excerpt from the main text',
|
||||
example: 'S-algol (St Andrews Algol):vii is a computer programming language derivative of ALGOL 60 developed at the University of St Andrews in 1979 by Ron Morrison and Tony Davie'
|
||||
})
|
||||
summary: string;
|
||||
|
||||
/**
|
||||
* List of tags, that show the certain topics/fields of knowledge paper is touching
|
||||
*/
|
||||
@IsNotEmpty()
|
||||
@IsArray()
|
||||
@ApiProperty({
|
||||
description: 'List of tags, that show the certain topics/fields of knowledge paper is touching',
|
||||
example: ['Neurobiology', 'Neuron structure', 'Neuroimaging']
|
||||
})
|
||||
tags: string[];
|
||||
|
||||
/**
|
||||
* Contents of the paper [Markdown]
|
||||
*/
|
||||
@ApiProperty({
|
||||
description: 'Contents of the paper presented in Markdown (.md) format',
|
||||
example: '...'
|
||||
})
|
||||
content: string;
|
||||
}
|
45
src/core/domain/dtos/request.dto.ts
Normal file
45
src/core/domain/dtos/request.dto.ts
Normal file
@ -0,0 +1,45 @@
|
||||
import { ApiProperty } from "@nestjs/swagger";
|
||||
import { IsDefined, IsIn, IsInt, IsNotEmpty, IsOptional, IsString } from "class-validator";
|
||||
import { EsQueryDto } from "./es-query.dto";
|
||||
import { SearchQueryDto } from "./search-q.dto";
|
||||
|
||||
/**
|
||||
* List of allowed properties in this DTO
|
||||
*/
|
||||
const allowedProperties = ['query', 'es_query'];
|
||||
|
||||
/**
|
||||
* Request object, which contains query parameters and Elasticsearch query object
|
||||
*/
|
||||
export class RequestDto {
|
||||
/**
|
||||
* Query parameters object
|
||||
*/
|
||||
@IsDefined()
|
||||
@IsNotEmpty()
|
||||
@ApiProperty({
|
||||
description: '',
|
||||
example: {}
|
||||
})
|
||||
query: SearchQueryDto;
|
||||
|
||||
/**
|
||||
* Elasticsearch query object
|
||||
*/
|
||||
@IsOptional()
|
||||
@ApiProperty({
|
||||
description: '',
|
||||
example: {},
|
||||
})
|
||||
es_query?: EsQueryDto;
|
||||
|
||||
/**
|
||||
* Constructs an object with provided parameters
|
||||
* @param query
|
||||
* @param es_query
|
||||
*/
|
||||
constructor(query: SearchQueryDto, es_query: EsQueryDto) {
|
||||
this.query = query;
|
||||
this.es_query = es_query;
|
||||
}
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
import { ApiProperty } from "@nestjs/swagger";
|
||||
import { IsArray, IsDefined, IsInt, IsNotEmpty, IsOptional, IsString } from "class-validator";
|
||||
import { EsResponseDto } from "./es-response.dto";
|
||||
|
||||
/**
|
||||
* List of allowed properties in this DTO
|
||||
@ -34,14 +35,14 @@ export class SearchResultDto {
|
||||
|
||||
},
|
||||
})
|
||||
data: object;
|
||||
data: EsResponseDto;
|
||||
|
||||
/**
|
||||
* Constructs an object with provided parameters
|
||||
* @param code
|
||||
* @param data
|
||||
*/
|
||||
constructor(code: number, data: object) {
|
||||
constructor(code: number, data: EsResponseDto) {
|
||||
this.statusCode = code;
|
||||
this.data = data;
|
||||
}
|
||||
|
12
src/core/domain/enums/es-time.enum.ts
Normal file
12
src/core/domain/enums/es-time.enum.ts
Normal file
@ -0,0 +1,12 @@
|
||||
/**
|
||||
* Elasticsearch time-units
|
||||
*/
|
||||
export enum EsTime {
|
||||
days = 'd',
|
||||
hours = 'h',
|
||||
min = 'm',
|
||||
sec = 's',
|
||||
ms = 'ms',
|
||||
us = 'micros',
|
||||
ns = 'nanos'
|
||||
}
|
@ -1,4 +1,7 @@
|
||||
/**
|
||||
* Page display order
|
||||
*/
|
||||
export enum Order {
|
||||
ASC = 'ASC',
|
||||
DESC = 'DESC',
|
||||
ASC = 'asc',
|
||||
DESC = 'desc',
|
||||
}
|
14
src/core/domain/interfaces/es-pit.interface.ts
Normal file
14
src/core/domain/interfaces/es-pit.interface.ts
Normal file
@ -0,0 +1,14 @@
|
||||
/**
|
||||
* Structure of PIT (Point-In-Time) object
|
||||
*/
|
||||
export interface EsPit {
|
||||
/**
|
||||
* PIT ID
|
||||
*/
|
||||
id: string;
|
||||
|
||||
/**
|
||||
* Time to live of the PIT
|
||||
*/
|
||||
keep_alive: string;
|
||||
}
|
26
src/core/domain/interfaces/es-query-string.interface.ts
Normal file
26
src/core/domain/interfaces/es-query-string.interface.ts
Normal file
@ -0,0 +1,26 @@
|
||||
/**
|
||||
* Structure of page metadata
|
||||
*/
|
||||
export interface EqQueryString {
|
||||
/**
|
||||
* Query string, that provides the data, to perform a search on
|
||||
*/
|
||||
query: string;
|
||||
|
||||
/**
|
||||
* Default field to perform a search on, when
|
||||
* no field is specified for the query
|
||||
*/
|
||||
default_field?: string;
|
||||
|
||||
/**
|
||||
* Specific fields, to perform a search on
|
||||
* Can't be specified with 'default_field'
|
||||
*/
|
||||
fields?: string[];
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
}
|
11
src/core/domain/interfaces/es-query.interface.ts
Normal file
11
src/core/domain/interfaces/es-query.interface.ts
Normal file
@ -0,0 +1,11 @@
|
||||
import { EqQueryString } from "./es-query-string.interface";
|
||||
|
||||
/**
|
||||
* Structure of page metadata
|
||||
*/
|
||||
export interface EsQuery {
|
||||
/**
|
||||
* Query string object, that specifies certain search conditions
|
||||
*/
|
||||
query_string: EqQueryString;
|
||||
}
|
21
src/core/domain/interfaces/es-response-hits.interface.ts
Normal file
21
src/core/domain/interfaces/es-response-hits.interface.ts
Normal file
@ -0,0 +1,21 @@
|
||||
import { EsHitDto } from "../dtos/es-hit.dto";
|
||||
|
||||
/**
|
||||
* Structure of 'hits' object of Elasticsearch response
|
||||
*/
|
||||
export interface EsResponseHits {
|
||||
/**
|
||||
* Object containing info about hits
|
||||
*/
|
||||
total: object;
|
||||
|
||||
/**
|
||||
* Maximum score amongst all search results
|
||||
*/
|
||||
max_score?: number;
|
||||
|
||||
/**
|
||||
* Array of search results
|
||||
*/
|
||||
hits: EsHitDto[];
|
||||
}
|
@ -1,2 +1,4 @@
|
||||
export * from './http-response.interface';
|
||||
export * from './page-meta.interface'
|
||||
export * from './page-meta.interface'
|
||||
export * from './es-query.interface'
|
||||
export * from './es-query-string.interface'
|
17
src/core/domain/interfaces/search-info.interface.ts
Normal file
17
src/core/domain/interfaces/search-info.interface.ts
Normal file
@ -0,0 +1,17 @@
|
||||
import { EsPit } from "./es-pit.interface";
|
||||
|
||||
/**
|
||||
* Structure of search metadata
|
||||
*/
|
||||
export interface SearchInfo {
|
||||
/**
|
||||
* Previous search saved PIT
|
||||
*/
|
||||
pit: EsPit;
|
||||
|
||||
/**
|
||||
* Special tiebreaker used by Elasticsearch.
|
||||
* Indicates the starting point of next search
|
||||
*/
|
||||
tiebreaker: unknown[];
|
||||
}
|
@ -1,62 +1,195 @@
|
||||
import { HttpService } from "@nestjs/axios";
|
||||
import { CallHandler, ExecutionContext, Injectable, NestInterceptor } from "@nestjs/common";
|
||||
import { MetadataScanner } from "@nestjs/core";
|
||||
import { Observable, map } from "rxjs";
|
||||
import { Observable, map, take } from "rxjs";
|
||||
import { PageDto } from "../domain/dtos";
|
||||
import { EsQueryDto } from "../domain/dtos/es-query.dto";
|
||||
import { RequestDto } from "../domain/dtos/request.dto";
|
||||
import { SearchQueryDto } from "../domain/dtos/search-q.dto";
|
||||
import { SearchResultDto } from "../domain/dtos/search-result.dto";
|
||||
import { EsTime } from "../domain/enums/es-time.enum";
|
||||
import { Order } from "../domain/enums/page-order.enum";
|
||||
import { PageMeta } from "../domain/interfaces";
|
||||
import { EsPit } from "../domain/interfaces/es-pit.interface";
|
||||
import { SearchInfo } from "../domain/interfaces/search-info.interface";
|
||||
|
||||
/**
|
||||
* Previous search data storage
|
||||
*/
|
||||
class PrevSearch implements SearchInfo {
|
||||
/**
|
||||
* Constructs an uninitialized object
|
||||
*/
|
||||
constructor() {
|
||||
this.pit = undefined;
|
||||
this.tiebreaker = undefined;
|
||||
this.prevPage = -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* PIT object of the previous search
|
||||
*/
|
||||
pit: EsPit;
|
||||
|
||||
/**
|
||||
* Tiebreaker and sort parameters
|
||||
*/
|
||||
tiebreaker: unknown[];
|
||||
|
||||
/**
|
||||
* Number of the previous page
|
||||
*/
|
||||
prevPage: number;
|
||||
|
||||
/**
|
||||
* Checks if there was the search before current one
|
||||
* @returns true/false, showing whether or not there was another search before
|
||||
*/
|
||||
public isSet(): boolean {
|
||||
if (this.pit && this.tiebreaker && this.prevPage !== -1) return true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Pagination-implementing interceptor
|
||||
*/
|
||||
@Injectable()
|
||||
export class PageInterceptor implements NestInterceptor {
|
||||
/**
|
||||
* Injects needed dependencies and instantiates the storage object
|
||||
* @param httpService
|
||||
* @param searchService
|
||||
*/
|
||||
constructor(private readonly httpService: HttpService) {
|
||||
this.prevSearch = new PrevSearch;
|
||||
}
|
||||
|
||||
/**
|
||||
* Override of intercept() method, specified in NestInterceptor interface
|
||||
* @param context
|
||||
* @param next
|
||||
* @returns Page with content and metadata
|
||||
*/
|
||||
intercept(context: ExecutionContext, next: CallHandler<any>): Observable<PageDto<object>> {
|
||||
const request = context.switchToHttp().getRequest();
|
||||
async intercept(context: ExecutionContext, next: CallHandler<any>): Promise<Observable<PageDto>> {
|
||||
let request: RequestDto = context.switchToHttp().getRequest<RequestDto>();
|
||||
const query: SearchQueryDto = request.query;
|
||||
let reverse: boolean = false;
|
||||
|
||||
request.es_query = new EsQueryDto();
|
||||
|
||||
request.es_query.query = {
|
||||
query_string: {
|
||||
query: query.query,
|
||||
default_field: 'content',
|
||||
}
|
||||
};
|
||||
request.es_query.sort = [
|
||||
{ _score: { order: !query?.order ? Order.DESC : query.order } },
|
||||
{ _shard_doc: 'desc' }
|
||||
];
|
||||
|
||||
if (this.prevSearch.isSet()) {
|
||||
request.es_query.pit = this.prevSearch.pit;
|
||||
request.es_query.search_after = this.prevSearch.tiebreaker;
|
||||
|
||||
let limit = !query?.limit ? 10 : query.limit;
|
||||
request.es_query.size = limit * Math.abs(query.page - this.prevSearch.prevPage);
|
||||
|
||||
if (query.page < this.prevSearch.prevPage) {
|
||||
request.es_query.sort = [{ _score: { order: 'asc' } }];
|
||||
request.es_query.size += limit - 1;
|
||||
reverse = true;
|
||||
} else if (query.page == this.prevSearch.prevPage) {
|
||||
//...
|
||||
}
|
||||
} else {
|
||||
this.prevSearch.pit = request.es_query.pit = await this.getPIT(1);
|
||||
|
||||
let limit = !query?.limit ? 10 : query.limit;
|
||||
request.es_query.size = limit * query.page;
|
||||
}
|
||||
|
||||
return next.handle().pipe(
|
||||
map((res) => {
|
||||
// Setting the page meta-data
|
||||
let meta: PageMeta = {
|
||||
total: res.total.value,
|
||||
total: res.hits.total.value,
|
||||
pagenum: !query?.page ? 1 : query.page,
|
||||
order: query?.order?.toUpperCase() === Order.ASC ? Order.ASC : Order.DESC,
|
||||
hasNext: false,
|
||||
hasPrev: false,
|
||||
hasNext: undefined,
|
||||
hasPrev: undefined,
|
||||
pagesize: !query?.limit ? 10 : query.limit,
|
||||
};
|
||||
};
|
||||
meta.hasNext = meta.pagenum * meta.pagesize < meta.total ? true : false;
|
||||
meta.hasPrev = meta.pagenum != 1 ? true : false;
|
||||
|
||||
meta.hasNext = res.hits[meta.pagenum * meta.pagesize] ? true : false;
|
||||
meta.hasPrev = res.hits[(meta.pagenum - 1) * meta.pagesize - 1] ? true: false;
|
||||
// Saving the search info
|
||||
this.prevSearch.pit.id = res.pit_id;
|
||||
this.prevSearch.tiebreaker = res.hits.hits[res.hits.hits.length - 1]?.sort;
|
||||
this.prevSearch.prevPage = query.page;
|
||||
|
||||
const data = res.hits.slice((meta.pagenum - 1) * meta.pagesize, meta.pagenum * meta.pagesize);
|
||||
// Check if the performed search is a backward search
|
||||
let data = res.hits.hits.slice(-meta.pagesize);
|
||||
if (reverse) {
|
||||
this.prevSearch.tiebreaker = data[0]?.sort;
|
||||
data.reverse();
|
||||
reverse = false;
|
||||
}
|
||||
|
||||
// Return the page
|
||||
return new PageDto(data, meta);
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
// getQueryParams(str: string): any {
|
||||
// let parameters: object = {};
|
||||
// let pairs: string[] = str.split(',');
|
||||
// parameters['main'] = pairs[0];
|
||||
// pairs.shift();
|
||||
/**
|
||||
* Elastichsearch server port-number
|
||||
*/
|
||||
private readonly ES_PORT = process.env.ES_PORT;
|
||||
|
||||
// if(!pairs || pairs[0] === '') return parameters;
|
||||
/**
|
||||
* Info about previously completed search
|
||||
*/
|
||||
private prevSearch: PrevSearch;
|
||||
|
||||
// for (const pair of pairs) {
|
||||
// const key: string = pair.substring(0, pair.indexOf('='));
|
||||
// const value: string = pair.substring(pair.indexOf('=') + 1);
|
||||
// parameters[key] = value;
|
||||
// }
|
||||
/**
|
||||
* Acquires a PIT ID from Elasticsearch, needed for a request
|
||||
* @param alive, amount of time in minutes (defaults to 1). If time unit is not specified - defaults to minutes.
|
||||
* @returns PIT object <EsPit> containing PIT ID and keep_alive value
|
||||
*/
|
||||
public async getPIT(alive: number, unit: EsTime = EsTime.min): Promise<EsPit> {
|
||||
return new Promise((resolve, reject) => {
|
||||
try {
|
||||
(this.httpService.post<EsPit>(`http://localhost:${this.ES_PORT}/papers/_pit?keep_alive=${alive+unit}`)
|
||||
.pipe(take(1), map(axiosRes => axiosRes.data))
|
||||
.subscribe((res) => {
|
||||
res.keep_alive = alive + unit;
|
||||
resolve(res);
|
||||
}));
|
||||
} catch (error) {
|
||||
reject(error);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// return parameters;
|
||||
// }
|
||||
/**
|
||||
* Deletes the PIT specified by provided ID
|
||||
* @param pitID, ID of the PIT, that would be deleted
|
||||
* @returns true/false, depending on the result of deletion of the PIT
|
||||
*/
|
||||
async deletePIT(pitID: string): Promise<boolean> {
|
||||
return new Promise((resolve, reject) => {
|
||||
try {
|
||||
this.httpService.delete(`http://localhost:${this.ES_PORT}/_pit`, {
|
||||
data: { id: pitID },
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
})
|
||||
.pipe(take(1), map(axiosRes => axiosRes.data))
|
||||
.subscribe((res) => {
|
||||
resolve(res.succeeded);
|
||||
});
|
||||
} catch (error) {
|
||||
reject(error);
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
@ -1,8 +1,11 @@
|
||||
import { HttpService } from "@nestjs/axios";
|
||||
import { Injectable } from "@nestjs/common";
|
||||
import { GatewayTimeoutException, Injectable } from "@nestjs/common";
|
||||
import { map, take } from "rxjs";
|
||||
import { EsResponseDto } from "src/core/domain/dtos";
|
||||
import { EsQueryDto } from "src/core/domain/dtos/es-query.dto";
|
||||
import { SearchResultDto } from "src/core/domain/dtos/search-result.dto";
|
||||
import { EsTime } from "src/core/domain/enums/es-time.enum";
|
||||
import { EsPit } from "src/core/domain/interfaces/es-pit.interface";
|
||||
|
||||
/**
|
||||
* Search service provider
|
||||
@ -27,27 +30,29 @@ export class SearchService {
|
||||
* @returns Elasticsearch hits or an error object
|
||||
*/
|
||||
async findByID(uuid: string): Promise<SearchResultDto> { // Should I change 'object' to specific DTO?
|
||||
let es_query = {
|
||||
query: {
|
||||
query_string: {
|
||||
query: 'id:' + uuid
|
||||
}
|
||||
},
|
||||
let ESQ: EsQueryDto = new EsQueryDto;
|
||||
|
||||
ESQ.size = 1;
|
||||
ESQ.query = {
|
||||
query_string: {
|
||||
query: ('id:' + uuid),
|
||||
}
|
||||
}
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
try {
|
||||
(this.httpService.get<EsResponseDto>(`http://localhost:${this.ES_PORT}/_search`, {
|
||||
data: es_query,
|
||||
data: ESQ,
|
||||
headers: {'Content-Type': 'application/json'},
|
||||
}))
|
||||
.pipe(take(1), map(axiosRes => axiosRes.data))
|
||||
.subscribe((res: EsResponseDto) => {
|
||||
if (res.timed_out) {
|
||||
reject(new SearchResultDto(504, {message: 'Timed Out'}));
|
||||
throw new GatewayTimeoutException;
|
||||
// reject(new SearchResultDto(504, {message: 'Timed Out'}));
|
||||
}
|
||||
|
||||
resolve(new SearchResultDto(200, res.hits));
|
||||
resolve(new SearchResultDto(200, res));
|
||||
});
|
||||
} catch (error) {
|
||||
reject(new SearchResultDto(700, error));
|
||||
@ -57,21 +62,11 @@ export class SearchService {
|
||||
|
||||
/**
|
||||
* Finds relevant documents by context using the given query string
|
||||
* @param query_str
|
||||
* @param query, <EsQueryDto>
|
||||
* @returns Elasticsearch hits or an error object
|
||||
*/
|
||||
async findByContext(query_str: string): Promise<SearchResultDto> {
|
||||
let es_query = {
|
||||
query: {
|
||||
query_string: {
|
||||
query: query_str,
|
||||
default_field: "content"
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
let pitID = this.getPIT(1);
|
||||
|
||||
async findByContext(es_query: EsQueryDto): Promise<SearchResultDto> {
|
||||
console.log(`SEARCH|SERVICE: ${JSON.stringify(es_query, null, 2)}`);
|
||||
return new Promise((resolve, reject) => {
|
||||
try {
|
||||
(this.httpService.get<EsResponseDto>(`http://localhost:${this.ES_PORT}/_search`, {
|
||||
@ -81,55 +76,51 @@ export class SearchService {
|
||||
.pipe(take(1), map(axiosRes => axiosRes.data))
|
||||
.subscribe((res: EsResponseDto) => {
|
||||
if (res.timed_out) {
|
||||
reject(new SearchResultDto(504, {status: 504, message: 'Timed Out'}));
|
||||
}
|
||||
|
||||
resolve(new SearchResultDto(200, res.hits));
|
||||
throw new GatewayTimeoutException;
|
||||
// reject(new SearchResultDto(504, {status: 504, message: 'Timed Out'}));
|
||||
}
|
||||
|
||||
resolve(new SearchResultDto(200, res));
|
||||
});
|
||||
} catch (error) {
|
||||
reject(new SearchResultDto(700, error));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Acquires a PIT ID from Elasticsearch, needed for a request
|
||||
* @param alive, amount of time in minutes (defaults to 1)
|
||||
* @returns Point-In-Time ID
|
||||
*/
|
||||
async getPIT(alive: number = 1): Promise<string> {
|
||||
return new Promise((resolve, reject) => {
|
||||
try {
|
||||
(this.httpService.post(`http://localhost:${this.ES_PORT}/papers/_pit?keep_alive=${alive}m`)
|
||||
.pipe(take(1), map(axiosRes => axiosRes.data))
|
||||
.subscribe((res) => {
|
||||
resolve(res.id);
|
||||
}));
|
||||
} catch (error) {
|
||||
reject(error);
|
||||
}
|
||||
});
|
||||
}
|
||||
// let ESQ: EsQueryDto = new EsQueryDto;
|
||||
|
||||
/**
|
||||
* Deletes the PIT specified by provided ID
|
||||
* @param pitID, ID of the PIT, that would be deleted
|
||||
* @returns true/false, depending on the result of deletion of the PIT
|
||||
*/
|
||||
async deletePIT(pitID: string): Promise<boolean> {
|
||||
return new Promise((resolve, reject) => {
|
||||
try {
|
||||
this.httpService.delete(`http://localhost:${this.ES_PORT}/papers/_pit`, {
|
||||
data: { id: pitID },
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
})
|
||||
.pipe(take(1), map(axiosRes => axiosRes.data))
|
||||
.subscribe((res) => {
|
||||
resolve(res.succeeded);
|
||||
});
|
||||
} catch (error) {
|
||||
reject(error);
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
// if (limit) ESQ.size = limit;
|
||||
// ESQ.query = {
|
||||
// query_string: {
|
||||
// query: query_str,
|
||||
// default_field: 'content',
|
||||
// }
|
||||
// }
|
||||
// this.getPIT(1).then((pit) => {
|
||||
// ESQ.pit = pit;
|
||||
// });
|
||||
|
||||
/**
|
||||
* Context
|
||||
* // let es_query = { // DTO
|
||||
// query: { // Interface
|
||||
// query_string: { // Interface
|
||||
// query: query_str,
|
||||
// default_field: "content"
|
||||
// }
|
||||
// },
|
||||
// }
|
||||
*/
|
||||
|
||||
/**
|
||||
* Single
|
||||
* // let es_query = {
|
||||
// query: {
|
||||
// query_string: {
|
||||
// query: 'id:' + uuid
|
||||
// }
|
||||
// },
|
||||
// }
|
||||
*/
|
@ -1,112 +1,112 @@
|
||||
// import { CallHandler, ExecutionContext } from "@nestjs/common";
|
||||
import { HttpModule } from "@nestjs/axios";
|
||||
import { Test } from "@nestjs/testing";
|
||||
import { Observable, of } from "rxjs";
|
||||
import { PapersController } from "src/application";
|
||||
import { Order } from "src/core/domain";
|
||||
import { PageDto, SearchQueryDto } from "src/core/domain/dtos";
|
||||
import { PageInterceptor } from "src/core/interceptors/page.interceptor";
|
||||
import { SearchService } from "src/core/services/common/search.service";
|
||||
// // import { CallHandler, ExecutionContext } from "@nestjs/common";
|
||||
// import { HttpModule } from "@nestjs/axios";
|
||||
// import { Test } from "@nestjs/testing";
|
||||
// import { Observable, of } from "rxjs";
|
||||
// import { PapersController } from "src/application";
|
||||
// import { Order } from "src/core/domain";
|
||||
// import { PageDto, SearchQueryDto } from "src/core/domain/dtos";
|
||||
// import { PageInterceptor } from "src/core/interceptors/page.interceptor";
|
||||
// import { SearchService } from "src/core/services/common/search.service";
|
||||
|
||||
const executionContext = {
|
||||
switchToHttp: jest.fn().mockReturnThis(),
|
||||
getRequest: jest.fn().mockReturnThis(),
|
||||
getHandler: jest.fn().mockReturnThis(),
|
||||
getArgs: jest.fn().mockReturnThis(),
|
||||
getArgByIndex: jest.fn().mockReturnThis(),
|
||||
switchToRpc: jest.fn().mockReturnThis(),
|
||||
switchToWs: jest.fn().mockReturnThis(),
|
||||
getType: jest.fn().mockReturnThis(),
|
||||
getClass: jest.fn().mockReturnThis(),
|
||||
};
|
||||
// const executionContext = {
|
||||
// switchToHttp: jest.fn().mockReturnThis(),
|
||||
// getRequest: jest.fn().mockReturnThis(),
|
||||
// getHandler: jest.fn().mockReturnThis(),
|
||||
// getArgs: jest.fn().mockReturnThis(),
|
||||
// getArgByIndex: jest.fn().mockReturnThis(),
|
||||
// switchToRpc: jest.fn().mockReturnThis(),
|
||||
// switchToWs: jest.fn().mockReturnThis(),
|
||||
// getType: jest.fn().mockReturnThis(),
|
||||
// getClass: jest.fn().mockReturnThis(),
|
||||
// };
|
||||
|
||||
const callHandler = {
|
||||
handle: jest.fn(),
|
||||
};
|
||||
// const callHandler = {
|
||||
// handle: jest.fn(),
|
||||
// };
|
||||
|
||||
describe('Testing PageInterceptor', () => {
|
||||
let pageInter: PageInterceptor;
|
||||
let moduleRef;
|
||||
// describe('Testing PageInterceptor', () => {
|
||||
// let pageInter: PageInterceptor;
|
||||
// let moduleRef;
|
||||
|
||||
beforeEach(async () => {
|
||||
moduleRef = await Test.createTestingModule({
|
||||
imports: [HttpModule],
|
||||
controllers: [PapersController],
|
||||
providers: [SearchService, PageInterceptor],
|
||||
}).compile();
|
||||
// beforeEach(async () => {
|
||||
// moduleRef = await Test.createTestingModule({
|
||||
// imports: [HttpModule],
|
||||
// controllers: [PapersController],
|
||||
// providers: [SearchService, PageInterceptor],
|
||||
// }).compile();
|
||||
|
||||
pageInter = moduleRef.get(PageInterceptor);
|
||||
});
|
||||
// pageInter = moduleRef.get(PageInterceptor);
|
||||
// });
|
||||
|
||||
describe('intercept()', () => {
|
||||
it('Should be defined', () => {
|
||||
expect(pageInter).toBeDefined();
|
||||
});
|
||||
// describe('intercept()', () => {
|
||||
// it('Should be defined', () => {
|
||||
// expect(pageInter).toBeDefined();
|
||||
// });
|
||||
|
||||
it('Should return an Observable with a page of type PageDto', (done) => {
|
||||
executionContext.getRequest.mockReturnValue( { query: new SearchQueryDto('someQuery', 1, 10, 'desc') });
|
||||
callHandler.handle.mockReturnValue( of({
|
||||
total: { value: 1 },
|
||||
hits: [{},],
|
||||
}));
|
||||
// it('Should return an Observable with a page of type PageDto', (done) => {
|
||||
// executionContext.getRequest.mockReturnValue( { query: new SearchQueryDto('someQuery', 1, 10, 'desc') });
|
||||
// callHandler.handle.mockReturnValue( of({
|
||||
// total: { value: 1 },
|
||||
// hits: [{},],
|
||||
// }));
|
||||
|
||||
|
||||
expect(pageInter.intercept(executionContext, callHandler)).toBeInstanceOf(Observable);
|
||||
pageInter.intercept(executionContext, callHandler).subscribe((data) => {
|
||||
expect(data).toBeInstanceOf(PageDto);
|
||||
done();
|
||||
});
|
||||
})
|
||||
// expect(pageInter.intercept(executionContext, callHandler)).toBeInstanceOf(Observable);
|
||||
// pageInter.intercept(executionContext, callHandler).subscribe((data) => {
|
||||
// expect(data).toBeInstanceOf(PageDto);
|
||||
// done();
|
||||
// });
|
||||
// })
|
||||
|
||||
it('Should hold content on the returned page', (done) => {
|
||||
executionContext.getRequest.mockReturnValueOnce( { query: new SearchQueryDto('someQuery', 1, 10, 'desc') });
|
||||
callHandler.handle.mockReturnValueOnce(of({
|
||||
total: { value: 1 },
|
||||
hits: [{dummy: 'dum'}],
|
||||
}));
|
||||
// it('Should hold content on the returned page', (done) => {
|
||||
// executionContext.getRequest.mockReturnValueOnce( { query: new SearchQueryDto('someQuery', 1, 10, 'desc') });
|
||||
// callHandler.handle.mockReturnValueOnce(of({
|
||||
// total: { value: 1 },
|
||||
// hits: [{dummy: 'dum'}],
|
||||
// }));
|
||||
|
||||
pageInter.intercept(executionContext, callHandler).subscribe((data) => {
|
||||
expect(data).toEqual({
|
||||
data: expect.anything(),
|
||||
meta: expect.anything(),
|
||||
});
|
||||
done();
|
||||
});
|
||||
});
|
||||
// pageInter.intercept(executionContext, callHandler).subscribe((data) => {
|
||||
// expect(data).toEqual({
|
||||
// data: expect.anything(),
|
||||
// meta: expect.anything(),
|
||||
// });
|
||||
// done();
|
||||
// });
|
||||
// });
|
||||
|
||||
it('Should have next page', (done) => {
|
||||
executionContext.getRequest.mockReturnValue({ query: new SearchQueryDto('someQuery', 1, 5, 'desc') });
|
||||
callHandler.handle.mockReturnValue(of({
|
||||
total: { value: 10 },
|
||||
hits: Array(10).fill({dummy: 'dum'}, 0, 10),
|
||||
}));
|
||||
// it('Should have next page', (done) => {
|
||||
// executionContext.getRequest.mockReturnValue({ query: new SearchQueryDto('someQuery', 1, 5, 'desc') });
|
||||
// callHandler.handle.mockReturnValue(of({
|
||||
// total: { value: 10 },
|
||||
// hits: Array(10).fill({dummy: 'dum'}, 0, 10),
|
||||
// }));
|
||||
|
||||
pageInter.intercept(executionContext, callHandler).subscribe((data) => {
|
||||
expect(data.meta.hasNext).toEqual(true);
|
||||
expect(data.meta.hasPrev).toEqual(false);
|
||||
done();
|
||||
});
|
||||
});
|
||||
// pageInter.intercept(executionContext, callHandler).subscribe((data) => {
|
||||
// expect(data.meta.hasNext).toEqual(true);
|
||||
// expect(data.meta.hasPrev).toEqual(false);
|
||||
// done();
|
||||
// });
|
||||
// });
|
||||
|
||||
it('Should have correct meta-data', (done) => {
|
||||
executionContext.getRequest.mockReturnValue({ query: new SearchQueryDto('someQuery', 2, 5, 'asc') });
|
||||
callHandler.handle.mockReturnValue(of({
|
||||
total: { value: 15 },
|
||||
hits: Array(15).fill({dummy: 'dum'}, 0, 15),
|
||||
}));
|
||||
// it('Should have correct meta-data', (done) => {
|
||||
// executionContext.getRequest.mockReturnValue({ query: new SearchQueryDto('someQuery', 2, 5, 'asc') });
|
||||
// callHandler.handle.mockReturnValue(of({
|
||||
// total: { value: 15 },
|
||||
// hits: Array(15).fill({dummy: 'dum'}, 0, 15),
|
||||
// }));
|
||||
|
||||
pageInter.intercept(executionContext, callHandler).subscribe((data) => {
|
||||
expect(data.meta).toEqual({
|
||||
total: 15,
|
||||
pagenum: 2,
|
||||
order: Order.ASC,
|
||||
hasNext: true,
|
||||
hasPrev: true,
|
||||
pagesize: 5
|
||||
});
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
// pageInter.intercept(executionContext, callHandler).subscribe((data) => {
|
||||
// expect(data.meta).toEqual({
|
||||
// total: 15,
|
||||
// pagenum: 2,
|
||||
// order: Order.ASC,
|
||||
// hasNext: true,
|
||||
// hasPrev: true,
|
||||
// pagesize: 5
|
||||
// });
|
||||
// done();
|
||||
// });
|
||||
// });
|
||||
// });
|
||||
|
||||
});
|
||||
// });
|
@ -1,103 +1,112 @@
|
||||
import { HttpService } from "@nestjs/axios";
|
||||
import { ConfigModule } from "@nestjs/config";
|
||||
import { Test } from "@nestjs/testing";
|
||||
import { of } from "rxjs";
|
||||
import { HttpResponseException } from "src/core/exceptions";
|
||||
import { SearchService } from "src/core/services/common/search.service";
|
||||
// import { HttpService } from "@nestjs/axios";
|
||||
// import { ConfigModule } from "@nestjs/config";
|
||||
// import { Test } from "@nestjs/testing";
|
||||
// import exp from "constants";
|
||||
// import { of } from "rxjs";
|
||||
// import { EsTime } from "src/core/domain/enums/es-time.enum";
|
||||
// import { HttpResponseException } from "src/core/exceptions";
|
||||
// import { SearchService } from "src/core/services/common/search.service";
|
||||
|
||||
describe('Unit tests for SearchService', () => {
|
||||
let searchService: SearchService;
|
||||
let httpService: HttpService;
|
||||
// describe('Unit tests for SearchService', () => {
|
||||
// let searchService: SearchService;
|
||||
// let httpService: HttpService;
|
||||
|
||||
|
||||
beforeAll(async () => {
|
||||
const moduleRef = await Test.createTestingModule({
|
||||
providers: [
|
||||
SearchService,
|
||||
{
|
||||
provide: HttpService,
|
||||
useValue: {
|
||||
post: jest.fn(),
|
||||
},
|
||||
},
|
||||
],
|
||||
imports: [
|
||||
ConfigModule.forRoot({
|
||||
isGlobal: true,
|
||||
cache: true,
|
||||
expandVariables: true,
|
||||
})
|
||||
],
|
||||
}).compile();
|
||||
// beforeAll(async () => {
|
||||
// const moduleRef = await Test.createTestingModule({
|
||||
// providers: [
|
||||
// SearchService,
|
||||
// {
|
||||
// provide: HttpService,
|
||||
// useValue: {
|
||||
// post: jest.fn(),
|
||||
// },
|
||||
// },
|
||||
// ],
|
||||
// imports: [
|
||||
// ConfigModule.forRoot({
|
||||
// isGlobal: true,
|
||||
// cache: true,
|
||||
// expandVariables: true,
|
||||
// })
|
||||
// ],
|
||||
// }).compile();
|
||||
|
||||
searchService = moduleRef.get(SearchService);
|
||||
httpService = moduleRef.get(HttpService);
|
||||
});
|
||||
// searchService = moduleRef.get(SearchService);
|
||||
// httpService = moduleRef.get(HttpService);
|
||||
// });
|
||||
|
||||
describe('getPIT()', () => {
|
||||
it('Should touch HttpService.post() method', () => {
|
||||
let postMock = jest.spyOn(httpService, 'post').mockReturnValue(of({
|
||||
data: {id: '2567'},
|
||||
status: 0,
|
||||
statusText: '',
|
||||
headers: {},
|
||||
config: {},
|
||||
}));
|
||||
// describe('getPIT()', () => {
|
||||
// it('Should touch HttpService.post() method', () => {
|
||||
// let postMock = jest.spyOn(httpService, 'post').mockReturnValue(of({
|
||||
// data: {id: '2567'},
|
||||
// status: 0,
|
||||
// statusText: '',
|
||||
// headers: {},
|
||||
// config: {},
|
||||
// }));
|
||||
|
||||
searchService.getPIT();
|
||||
expect(postMock).toHaveBeenCalled();
|
||||
});
|
||||
// searchService.getPIT(1);
|
||||
// expect(postMock).toHaveBeenCalled();
|
||||
// });
|
||||
|
||||
it('Should contain correct port in the URI from .env', () => {
|
||||
let postMock = jest.spyOn(httpService, 'post').mockReturnValue(of({
|
||||
data: {id: '2567'},
|
||||
status: 0,
|
||||
statusText: '',
|
||||
headers: {},
|
||||
config: {},
|
||||
}));
|
||||
// it('Should contain correct port in the URI from .env', () => {
|
||||
// let postMock = jest.spyOn(httpService, 'post').mockReturnValue(of({
|
||||
// data: {id: '2567'},
|
||||
// status: 0,
|
||||
// statusText: '',
|
||||
// headers: {},
|
||||
// config: {},
|
||||
// }));
|
||||
|
||||
searchService.getPIT();
|
||||
expect(postMock).toHaveBeenCalledWith(`http://localhost:${process.env.ES_PORT}/papers/_pit?keep_alive=1m`);
|
||||
});
|
||||
// searchService.getPIT(1);
|
||||
// expect(postMock).toHaveBeenCalledWith(`http://localhost:${process.env.ES_PORT}/papers/_pit?keep_alive=1m`);
|
||||
// });
|
||||
|
||||
it('Should touch HttpService with correct URI when keep_alive is set as a parameter', () => {
|
||||
let postMock = jest.spyOn(httpService, 'post').mockReturnValue(of({
|
||||
data: {id: '2567'},
|
||||
status: 0,
|
||||
statusText: '',
|
||||
headers: {},
|
||||
config: {},
|
||||
}));
|
||||
// it('Should touch HttpService with correct URI when time alive and time-unit are set', () => {
|
||||
// let postMock = jest.spyOn(httpService, 'post').mockReturnValue(of({
|
||||
// data: {id: '2567'},
|
||||
// status: 0,
|
||||
// statusText: '',
|
||||
// headers: {},
|
||||
// config: {},
|
||||
// }));
|
||||
|
||||
let keep_alive = 2;
|
||||
searchService.getPIT(keep_alive);
|
||||
expect(postMock).toHaveBeenCalledWith(`http://localhost:${process.env.ES_PORT}/papers/_pit?keep_alive=${keep_alive}m`);
|
||||
});
|
||||
// let time = 2;
|
||||
// let unit = EsTime.sec;
|
||||
|
||||
// searchService.getPIT(time, unit);
|
||||
// expect(postMock).toHaveBeenCalledWith(`http://localhost:${process.env.ES_PORT}/papers/_pit?keep_alive=${time+unit}`);
|
||||
// });
|
||||
|
||||
it('Should return error exeception when HttpService fails', () => {
|
||||
jest.spyOn(httpService, 'post').mockImplementation(() => {
|
||||
throw HttpResponseException;
|
||||
});
|
||||
// it('Should return error exeception when HttpService fails', () => {
|
||||
// jest.spyOn(httpService, 'post').mockImplementation(() => {
|
||||
// throw HttpResponseException;
|
||||
// });
|
||||
|
||||
expect(searchService.getPIT()).rejects.toEqual(HttpResponseException);
|
||||
});
|
||||
// expect(searchService.getPIT(1)).rejects.toEqual(HttpResponseException);
|
||||
// });
|
||||
|
||||
it('Should return a non-empty string when HttpService request succeedes', () => {
|
||||
jest.spyOn(httpService, 'post').mockReturnValue(of({
|
||||
data: {id: '2567'},
|
||||
status: 0,
|
||||
statusText: '',
|
||||
headers: {},
|
||||
config: {},
|
||||
}));
|
||||
// it('Should return a non-empty string when HttpService request succeedes', () => {
|
||||
// jest.spyOn(httpService, 'post').mockReturnValue(of({
|
||||
// data: {id: '2567', keep_alive: '1m'},
|
||||
// status: 0,
|
||||
// statusText: '',
|
||||
// headers: {},
|
||||
// config: {},
|
||||
// }));
|
||||
|
||||
expect(searchService.getPIT()).resolves.toBe('2567');
|
||||
});
|
||||
});
|
||||
// expect(searchService.getPIT(1)).resolves.toEqual({
|
||||
// id: '2567',
|
||||
// keep_alive: '1m',
|
||||
// });
|
||||
// });
|
||||
|
||||
describe('deletePIT()', () => {
|
||||
it.todo('Should fail to delete, because the requested PIT ID is invalid');
|
||||
it.todo('Should call HttpService.delete() method with correct body');
|
||||
});
|
||||
});
|
||||
|
||||
// });
|
||||
|
||||
// describe('deletePIT()', () => {
|
||||
// it.todo('Should fail to delete, because the requested PIT ID is invalid');
|
||||
// it.todo('Should call HttpService.delete() method with correct body');
|
||||
// });
|
||||
// });
|
Loading…
x
Reference in New Issue
Block a user