WIP: BACKUP-SAVED
This commit is contained in:
parent
3022eaa0a3
commit
35a2cbac4c
465
documentation/classes/EsMultimatchQueryDto.html
Normal file
465
documentation/classes/EsMultimatchQueryDto.html
Normal file
@ -0,0 +1,465 @@
|
||||
<!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 >EsMultimatchQueryDto</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/elastic/es-multimatch.dto.ts</code>
|
||||
</p>
|
||||
|
||||
|
||||
<p class="comment">
|
||||
<h3>Description</h3>
|
||||
</p>
|
||||
<p class="comment">
|
||||
<p>Elasticsearch multi-match query DTO</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">Public</span>
|
||||
<span class="modifier">Optional</span>
|
||||
<a href="#from" >from</a>
|
||||
</li>
|
||||
<li>
|
||||
<span class="modifier">Private</span>
|
||||
<span class="modifier">Readonly</span>
|
||||
<a href="#query" >query</a>
|
||||
</li>
|
||||
<li>
|
||||
<span class="modifier">Public</span>
|
||||
<span class="modifier">Optional</span>
|
||||
<a href="#size" >size</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="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/string" target="_blank">string</a>, fields: Array<string>)</code>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-line">Defined in <a href="" data-line="53" class="link-to-prism">src/core/domain/dtos/elastic/es-multimatch.dto.ts:53</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-description"><p>Constructs a multi-match</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="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/string" target="_blank" >string</a></code>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
No
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
<tr>
|
||||
<td>fields</td>
|
||||
|
||||
<td>
|
||||
<code>Array<string></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="from"></a>
|
||||
<span class="name">
|
||||
<span class="modifier">Public</span>
|
||||
<span class="modifier">Optional</span>
|
||||
<span ><b>from</b></span>
|
||||
<a href="#from"><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 />@IsInt()<br />@ApiPropertyOptional({description: 'Offset from the start of the list of hits', example: 5})<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/elastic/es-multimatch.dto.ts:23</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-description"><p>Offset from the start of the list of hits</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 class="modifier">Private</span>
|
||||
<span class="modifier">Readonly</span>
|
||||
<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="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">
|
||||
<b>Decorators : </b>
|
||||
<br />
|
||||
<code>
|
||||
@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="53" class="link-to-prism">src/core/domain/dtos/elastic/es-multimatch.dto.ts:53</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-description"><p>The search query object passed to Elasticsearch</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">Public</span>
|
||||
<span class="modifier">Optional</span>
|
||||
<span ><b>size</b></span>
|
||||
<a href="#size"><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 />@IsInt()<br />@ApiPropertyOptional({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="34" class="link-to-prism">src/core/domain/dtos/elastic/es-multimatch.dto.ts:34</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-description"><p>Maximum number of elements returned by Elasticsearch</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 { ApiExtraModels, ApiProperty, ApiPropertyOptional } from "@nestjs/swagger";
|
||||
import { IsDefined, IsInt, IsObject, IsOptional } from "class-validator";
|
||||
|
||||
/**
|
||||
* List of allowed properties in this DTO
|
||||
*/
|
||||
const allowedProperties = ['query'];
|
||||
|
||||
/**
|
||||
* Elasticsearch multi-match query DTO
|
||||
*/
|
||||
@ApiExtraModels()
|
||||
export class EsMultimatchQueryDto {
|
||||
/**
|
||||
* Offset from the start of the list of hits
|
||||
*/
|
||||
@IsOptional()
|
||||
@IsInt()
|
||||
@ApiPropertyOptional({
|
||||
description: 'Offset from the start of the list of hits',
|
||||
example: 5,
|
||||
})
|
||||
public from?: number;
|
||||
|
||||
/**
|
||||
* Maximum number of elements returned by Elasticsearch
|
||||
*/
|
||||
@IsOptional()
|
||||
@IsInt()
|
||||
@ApiPropertyOptional({
|
||||
description: 'Maximum number of elements returned by Elasticsearch',
|
||||
example: 30
|
||||
})
|
||||
public size?: number;
|
||||
|
||||
/**
|
||||
* The search query object passed to Elasticsearch
|
||||
*/
|
||||
@IsDefined()
|
||||
@IsObject()
|
||||
@ApiProperty({
|
||||
description: 'Search query object passed to Elasticsearch',
|
||||
example: {
|
||||
multi_match: {
|
||||
query: 'Maths',
|
||||
fields: [
|
||||
'title',
|
||||
'content'
|
||||
]
|
||||
}
|
||||
},
|
||||
})
|
||||
private readonly query: Object;
|
||||
|
||||
/**
|
||||
* Constructs a multi-match
|
||||
*/
|
||||
constructor(query: string = '', fields: Array<string> = ['content']) {
|
||||
this.query = {
|
||||
multi_match: {
|
||||
query: query,
|
||||
fields: fields
|
||||
}
|
||||
}
|
||||
}
|
||||
}</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 = 'EsMultimatchQueryDto.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>
|
@ -124,12 +124,12 @@
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<code>constructor(query: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/string" target="_blank">string</a>, page: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/number" target="_blank">number</a>, limit: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/number" target="_blank">number</a>, order: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/string" target="_blank">string</a>)</code>
|
||||
<code>constructor(query: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/string" target="_blank">string</a>, limit: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/number" target="_blank">number</a>, offset: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/number" target="_blank">number</a>, order: <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="57" class="link-to-prism">src/core/domain/dtos/search-q.dto.ts:57</a></div>
|
||||
<div class="io-line">Defined in <a href="" data-line="65" class="link-to-prism">src/core/domain/dtos/search-q.dto.ts:65</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@ -161,7 +161,7 @@
|
||||
|
||||
</tr>
|
||||
<tr>
|
||||
<td>page</td>
|
||||
<td>limit</td>
|
||||
|
||||
<td>
|
||||
<code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/number" target="_blank" >number</a></code>
|
||||
@ -173,7 +173,7 @@
|
||||
|
||||
</tr>
|
||||
<tr>
|
||||
<td>limit</td>
|
||||
<td>offset</td>
|
||||
|
||||
<td>
|
||||
<code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/number" target="_blank" >number</a></code>
|
||||
@ -233,13 +233,13 @@
|
||||
<b>Decorators : </b>
|
||||
<br />
|
||||
<code>
|
||||
@IsOptional()<br />@IsInt()<br />@ApiPropertyOptional({description: 'Limits the number of displayed elements', example: 10})<br />
|
||||
@IsOptional()<br />@IsInt()<br />@Type(undefined)<br />@Min(1)<br />@ApiPropertyOptional({description: 'Limits the number of displayed elements', example: 10, required: false})<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/search-q.dto.ts:35</a></div>
|
||||
<div class="io-line">Defined in <a href="" data-line="39" class="link-to-prism">src/core/domain/dtos/search-q.dto.ts:39</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@ -275,13 +275,13 @@
|
||||
<b>Decorators : </b>
|
||||
<br />
|
||||
<code>
|
||||
@IsOptional()<br />@IsInt()<br />@ApiPropertyOptional({description: 'Offset from the start of the list of hits', example: 0})<br />
|
||||
@IsOptional()<br />@IsInt()<br />@Type(undefined)<br />@Min(0)<br />@ApiPropertyOptional({description: 'Offset from the start of the list of hits', example: 0, required: false})<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/search-q.dto.ts:46</a></div>
|
||||
<div class="io-line">Defined in <a href="" data-line="53" class="link-to-prism">src/core/domain/dtos/search-q.dto.ts:53</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@ -317,13 +317,13 @@
|
||||
<b>Decorators : </b>
|
||||
<br />
|
||||
<code>
|
||||
@IsOptional()<br />@IsString()<br />@ApiPropertyOptional({description: 'Indicates in which order elements need to be displayed', example: 'asc'})<br />
|
||||
@IsOptional()<br />@IsString()<br />@ApiPropertyOptional({description: 'Indicates in which order elements need to be displayed', example: 'asc', required: false})<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/search-q.dto.ts:57</a></div>
|
||||
<div class="io-line">Defined in <a href="" data-line="65" class="link-to-prism">src/core/domain/dtos/search-q.dto.ts:65</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@ -364,7 +364,7 @@
|
||||
</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/search-q.dto.ts:24</a></div>
|
||||
<div class="io-line">Defined in <a href="" data-line="25" class="link-to-prism">src/core/domain/dtos/search-q.dto.ts:25</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@ -390,12 +390,13 @@
|
||||
|
||||
<div class="tab-pane fade tab-source-code" id="c-source">
|
||||
<pre class="line-numbers compodoc-sourcecode"><code class="language-typescript">import { ApiExtraModels, ApiPropertyOptional } from "@nestjs/swagger";
|
||||
import { IsDefined, IsInt, IsNotEmpty, IsOptional, IsString } from "class-validator";
|
||||
import { Type } from "class-transformer";
|
||||
import { IsDefined, IsInt, IsNotEmpty, IsOptional, IsString, Min } from "class-validator";
|
||||
|
||||
/**
|
||||
* List of allowed properties in this DTO
|
||||
*/
|
||||
const allowedProperties = ['query', 'pagen', 'limit', 'order'];
|
||||
const allowedProperties = ['query', 'limit', 'offset', 'order'];
|
||||
|
||||
/**
|
||||
* Elasticsearch response DTO
|
||||
@ -419,9 +420,12 @@ export class SearchQueryDto {
|
||||
*/
|
||||
@IsOptional()
|
||||
@IsInt()
|
||||
@Type(() => Number)
|
||||
@Min(1)
|
||||
@ApiPropertyOptional({
|
||||
description: 'Limits the number of displayed elements',
|
||||
example: 10,
|
||||
required: false
|
||||
})
|
||||
limit?: number;
|
||||
|
||||
@ -430,26 +434,26 @@ export class SearchQueryDto {
|
||||
*/
|
||||
@IsOptional()
|
||||
@IsInt()
|
||||
@Type(() => Number)
|
||||
@Min(0)
|
||||
@ApiPropertyOptional({
|
||||
description: 'Offset from the start of the list of hits',
|
||||
example: 0,
|
||||
required: false,
|
||||
})
|
||||
offset?: number;
|
||||
|
||||
/**
|
||||
* Indicates in which order elements need to be displayed.
|
||||
*/
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
@ApiPropertyOptional({
|
||||
description: 'Indicates in which order elements need to be displayed',
|
||||
example: 'asc',
|
||||
})
|
||||
order?: string;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
@ApiPropertyOptional({
|
||||
description: 'Indicates in which order elements need to be displayed',
|
||||
example: 'asc',
|
||||
required: false,
|
||||
})
|
||||
order?: string;
|
||||
|
||||
/**
|
||||
* Constructs an object with provided parameters
|
||||
@ -458,9 +462,10 @@ export class SearchQueryDto {
|
||||
* @param limit
|
||||
* @param order
|
||||
*/
|
||||
constructor(query: string, page: number, limit: number, order: string) {
|
||||
constructor(query: string = undefined, limit: number = 10, offset: number = 0, order: string = undefined) {
|
||||
this.query = query;
|
||||
this.limit = limit;
|
||||
this.offset = offset;
|
||||
this.order = order;
|
||||
}
|
||||
}</code></pre>
|
||||
|
@ -188,7 +188,20 @@ export class HealthController {
|
||||
@Get()
|
||||
@HealthCheck()
|
||||
check() {
|
||||
return { status: 'ok', info: { alive: { status: 'up' } }, error: {}, details: { alive: { status: 'up' } } };
|
||||
return {
|
||||
status: 'ok',
|
||||
info: {
|
||||
alive: {
|
||||
status: 'up'
|
||||
}
|
||||
},
|
||||
error: {},
|
||||
details: {
|
||||
alive: {
|
||||
status: 'up'
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
</code></pre>
|
||||
|
@ -121,7 +121,7 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<code>getByContext(request: <a href="../classes/RequestDto.html" target="_self">RequestDto</a>)</code>
|
||||
<code>getByContext(request: <a href="../classes/SearchQueryDto.html" target="_self">SearchQueryDto</a>)</code>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@ -129,14 +129,14 @@
|
||||
<td class="col-md-4">
|
||||
<b>Decorators : </b>
|
||||
<br />
|
||||
<code>@ApiTags('Search')<br />@ApiOperation({summary: 'Finds papers by context based on the query'})<br />@ApiResponse({status: 200, description: 'Returns back a page with acquired papers', type: PageDto})<br />@ApiGatewayTimeoutResponse({description: 'Elasticsearch request timed out'})<br />@Get('search')<br />@UseInterceptors(PageInterceptor)<br />@HttpCode(200)<br /></code>
|
||||
<code>@ApiTags('Search')<br />@ApiOperation({summary: 'Finds papers by context based on the query'})<br />@ApiResponse({status: 200, description: 'Returns back a page with acquired papers', type: PageDto})<br />@ApiGatewayTimeoutResponse({description: 'Elasticsearch request timed out'})<br />@Get('search')<br />@HttpCode(200)<br />@UseInterceptors(PageInterceptor)<br /></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/application/controller/papers.controller.ts:43</a></div>
|
||||
<div class="io-line">Defined in <a href="" data-line="41"
|
||||
class="link-to-prism">src/application/controller/papers.controller.ts:41</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@ -161,7 +161,7 @@
|
||||
<tr>
|
||||
<td>request</td>
|
||||
<td>
|
||||
<code><a href="../classes/RequestDto.html" target="_self" >RequestDto</a></code>
|
||||
<code><a href="../classes/SearchQueryDto.html" target="_self" >SearchQueryDto</a></code>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
@ -214,8 +214,8 @@
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-line">Defined in <a href="" data-line="75"
|
||||
class="link-to-prism">src/application/controller/papers.controller.ts:75</a></div>
|
||||
<div class="io-line">Defined in <a href="" data-line="73"
|
||||
class="link-to-prism">src/application/controller/papers.controller.ts:73</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@ -270,13 +270,12 @@
|
||||
|
||||
|
||||
<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, Param, ParseUUIDPipe, Req, UseFilters, UseInterceptors } from "@nestjs/common";
|
||||
<pre class="line-numbers compodoc-sourcecode"><code class="language-typescript">import { Controller, Get, HttpCode, Param, ParseUUIDPipe, Query, UseFilters, UseInterceptors } from "@nestjs/common";
|
||||
import { SearchService } from "../../core/services/common/search.service";
|
||||
import { PageInterceptor } from "../../core/interceptors/page.interceptor";
|
||||
import { ApiExtraModels, ApiGatewayTimeoutResponse, ApiOperation, ApiResponse, ApiTags } from "@nestjs/swagger";
|
||||
import { RequestDto } from "../../core/domain/dtos/request.dto";
|
||||
import { EsHitDto, EsResponseDto, PageDto, PaperDto } from "../../core/domain";
|
||||
import { HttpExceptionFilter } from "src/core/filters/http-exception.filter";
|
||||
import { EsHitDto, EsResponseDto, PageDto, PaperDto, SearchQueryDto } from "../../core/domain";
|
||||
import { HttpExceptionFilter } from "../../core/filters/http-exception.filter";
|
||||
|
||||
/**
|
||||
* /papers/ route controller
|
||||
@ -286,8 +285,7 @@ import { HttpExceptionFilter } from "src/core/filters/http-exception.filter
|
||||
version: '1',
|
||||
path: 'papers',
|
||||
})
|
||||
@ApiExtraModels(RequestDto, EsHitDto, EsResponseDto)
|
||||
// @UseInterceptors(CacheInterceptor)
|
||||
@ApiExtraModels(EsHitDto, EsResponseDto)
|
||||
export class PapersController {
|
||||
constructor(private searchService: SearchService) {}
|
||||
|
||||
@ -310,10 +308,10 @@ export class PapersController {
|
||||
description: 'Elasticsearch request timed out'
|
||||
})
|
||||
@Get('search')
|
||||
@UseInterceptors(PageInterceptor)
|
||||
@HttpCode(200)
|
||||
getByContext(@Req() request: RequestDto): Promise<EsResponseDto> {
|
||||
return this.searchService.findByContext(request.es_query).then(
|
||||
@UseInterceptors(PageInterceptor)
|
||||
getByContext(@Query() request: SearchQueryDto): Promise<EsResponseDto> {
|
||||
return this.searchService.findByContext(request).then(
|
||||
(response) => {
|
||||
return response;
|
||||
},
|
||||
|
@ -164,6 +164,30 @@
|
||||
<span class="coverage-count">(1/1)</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="very-good">
|
||||
<td>
|
||||
<!-- miscellaneous -->
|
||||
<a href="./classes/EsMultimatchQueryDto.html">src/core/domain/dtos/elastic/es-multimatch.dto.ts</a>
|
||||
</td>
|
||||
<td>class</td>
|
||||
<td>EsMultimatchQueryDto</td>
|
||||
<td align="right" data-sort="100">
|
||||
<span class="coverage-percent">100 %</span>
|
||||
<span class="coverage-count">(5/5)</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="very-good">
|
||||
<td>
|
||||
<!-- miscellaneous -->
|
||||
<a href="./miscellaneous/variables.html#allowedProperties">src/core/domain/dtos/elastic/es-multimatch.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 -->
|
||||
@ -284,30 +308,6 @@
|
||||
<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 -->
|
||||
@ -332,30 +332,6 @@
|
||||
<span class="coverage-count">(1/1)</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="very-good">
|
||||
<td>
|
||||
<!-- miscellaneous -->
|
||||
<a href="./classes/SearchResultDto.html">src/core/domain/dtos/search-result.dto.ts</a>
|
||||
</td>
|
||||
<td>class</td>
|
||||
<td>SearchResultDto</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/search-result.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 -->
|
||||
|
@ -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="1322pt" height="329pt"
|
||||
viewBox="0.00 0.00 1322.00 328.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 324.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>
|
||||
<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"/>
|
||||
</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"/>
|
||||
</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"/>
|
||||
</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"/>
|
||||
</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"/>
|
||||
</g>
|
||||
<polygon fill="white" stroke="transparent" points="-4,4 -4,-324.8 1318,-324.8 1318,4 -4,4"/>
|
||||
<text text-anchor="middle" x="657" y="-8.2" font-family="sans-serif" font-size="14.00">dependencies</text>
|
||||
<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="1138,-32.8 1138,-236.8 1306,-236.8 1306,-32.8 1138,-32.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="1154,-176.8 1154,-228.8 1272,-228.8 1272,-176.8 1154,-176.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="1146,-40.8 1146,-92.8 1298,-92.8 1298,-40.8 1146,-40.8"/>
|
||||
</g>
|
||||
<g id="clust7" class="cluster">
|
||||
<title>cluster_CommonModule</title>
|
||||
<polygon fill="none" stroke="black" stroke-dasharray="1,5" points="834,-100.8 834,-312.8 1130,-312.8 1130,-100.8 834,-100.8"/>
|
||||
</g>
|
||||
<g id="clust9" class="cluster">
|
||||
<title>cluster_CommonModule_imports</title>
|
||||
<polygon fill="none" stroke="black" points="842,-108.8 842,-160.8 996,-160.8 996,-108.8 842,-108.8"/>
|
||||
</g>
|
||||
<g id="clust10" class="cluster">
|
||||
<title>cluster_CommonModule_exports</title>
|
||||
<polygon fill="none" stroke="black" points="842,-252.8 842,-304.8 1122,-304.8 1122,-252.8 842,-252.8"/>
|
||||
</g>
|
||||
<g id="clust1" class="cluster">
|
||||
<title>cluster_AppModule</title>
|
||||
<polygon fill="none" stroke="black" stroke-dasharray="1,5" points="304,-168.8 304,-304.8 434,-304.8 434,-168.8 304,-168.8"/>
|
||||
</g>
|
||||
<g id="clust3" class="cluster">
|
||||
<title>cluster_AppModule_imports</title>
|
||||
<polygon fill="none" stroke="black" points="312,-176.8 312,-228.8 426,-228.8 426,-176.8 312,-176.8"/>
|
||||
</g>
|
||||
<g id="clust19" class="cluster">
|
||||
<title>cluster_HttpResponseModule</title>
|
||||
<polygon fill="none" stroke="black" stroke-dasharray="1,5" points="442,-168.8 442,-236.8 826,-236.8 826,-168.8 442,-168.8"/>
|
||||
</g>
|
||||
<g id="clust22" class="cluster">
|
||||
<title>cluster_HttpResponseModule_exports</title>
|
||||
<polygon fill="none" stroke="black" points="662,-176.8 662,-228.8 818,-228.8 818,-176.8 662,-176.8"/>
|
||||
</g>
|
||||
<g id="clust24" class="cluster">
|
||||
<title>cluster_HttpResponseModule_providers</title>
|
||||
<polygon fill="none" stroke="black" points="450,-176.8 450,-228.8 654,-228.8 654,-176.8 450,-176.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="8,-244.8 8,-312.8 296,-312.8 296,-244.8 8,-244.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="172,-252.8 172,-304.8 288,-304.8 288,-252.8 172,-252.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="16,-252.8 16,-304.8 164,-304.8 164,-252.8 16,-252.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="974.67,-220.8 971.67,-224.8 950.67,-224.8 947.67,-220.8 863.33,-220.8 863.33,-184.8 974.67,-184.8 974.67,-220.8"/>
|
||||
<text text-anchor="middle" x="919" y="-198.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="417.66,-296.8 414.66,-300.8 393.66,-300.8 390.66,-296.8 334.34,-296.8 334.34,-260.8 417.66,-260.8 417.66,-296.8"/>
|
||||
<text text-anchor="middle" x="376" y="-274.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="M863.13,-208.8C845.24,-208.8 829.98,-208.8 829.98,-208.8 829.98,-208.8 829.98,-278.8 829.98,-278.8 829.98,-278.8 427.9,-278.8 427.9,-278.8"/>
|
||||
<polygon fill="black" stroke="black" points="427.9,-275.3 417.9,-278.8 427.9,-282.3 427.9,-275.3"/>
|
||||
</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="1113.6,-296.8 972.4,-296.8 972.4,-260.8 1113.6,-260.8 1113.6,-296.8"/>
|
||||
<text text-anchor="middle" x="1043" y="-274.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="M974.76,-208.8C978.87,-208.8 981.44,-208.8 981.44,-208.8 981.44,-208.8 981.44,-250.77 981.44,-250.77"/>
|
||||
<polygon fill="black" stroke="black" points="977.94,-250.77 981.44,-260.77 984.94,-250.77 977.94,-250.77"/>
|
||||
</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="953.98,-296.8 850.02,-296.8 850.02,-260.8 953.98,-260.8 953.98,-296.8"/>
|
||||
<text text-anchor="middle" x="902" y="-274.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="M908.45,-220.81C908.45,-220.81 908.45,-250.65 908.45,-250.65"/>
|
||||
<polygon fill="black" stroke="black" points="904.95,-250.65 908.45,-260.65 911.95,-250.65 904.95,-250.65"/>
|
||||
</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="417.64,-220.8 414.64,-224.8 393.64,-224.8 390.64,-220.8 320.36,-220.8 320.36,-184.8 417.64,-184.8 417.64,-220.8"/>
|
||||
<text text-anchor="middle" x="369" y="-198.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="M375.99,-220.81C375.99,-220.81 375.99,-250.65 375.99,-250.65"/>
|
||||
<polygon fill="black" stroke="black" points="372.49,-250.65 375.99,-260.65 379.49,-250.65 372.49,-250.65"/>
|
||||
</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="279.57,-296.8 180.43,-296.8 180.43,-260.8 279.57,-260.8 279.57,-296.8"/>
|
||||
<text text-anchor="middle" x="230" y="-274.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="M327.17,-220.81C327.17,-243.29 327.17,-278.8 327.17,-278.8 327.17,-278.8 289.73,-278.8 289.73,-278.8"/>
|
||||
<polygon fill="black" stroke="black" points="289.73,-275.3 279.73,-278.8 289.73,-282.3 289.73,-275.3"/>
|
||||
</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="988.1,-152.8 985.1,-156.8 964.1,-156.8 961.1,-152.8 849.9,-152.8 849.9,-116.8 988.1,-116.8 988.1,-152.8"/>
|
||||
<text text-anchor="middle" x="919" 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="M919,-153.02C919,-153.02 919,-174.53 919,-174.53"/>
|
||||
<polygon fill="black" stroke="black" points="915.5,-174.53 919,-184.53 922.5,-174.53 915.5,-174.53"/>
|
||||
</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="810.03,-220.8 669.97,-220.8 669.97,-184.8 810.03,-184.8 810.03,-220.8"/>
|
||||
<text text-anchor="middle" x="740" y="-198.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="M856.71,-153.07C856.71,-171.36 856.71,-196.8 856.71,-196.8 856.71,-196.8 820.25,-196.8 820.25,-196.8"/>
|
||||
<polygon fill="black" stroke="black" points="820.25,-193.3 810.25,-196.8 820.25,-200.3 820.25,-193.3"/>
|
||||
</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="1262.98,-152.8 1259.98,-156.8 1238.98,-156.8 1235.98,-152.8 1163.02,-152.8 1163.02,-116.8 1262.98,-116.8 1262.98,-152.8"/>
|
||||
<text text-anchor="middle" x="1213" 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="M1162.77,-134.8C1159.86,-134.8 1158.08,-134.8 1158.08,-134.8 1158.08,-134.8 1158.08,-196.8 1158.08,-196.8 1158.08,-196.8 984.75,-196.8 984.75,-196.8"/>
|
||||
<polygon fill="black" stroke="black" points="984.75,-193.3 974.75,-196.8 984.75,-200.3 984.75,-193.3"/>
|
||||
</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="1263.91,-220.8 1162.09,-220.8 1162.09,-184.8 1263.91,-184.8 1263.91,-220.8"/>
|
||||
<text text-anchor="middle" x="1213" y="-198.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="M1213,-153.02C1213,-153.02 1213,-174.53 1213,-174.53"/>
|
||||
<polygon fill="black" stroke="black" points="1209.5,-174.53 1213,-184.53 1216.5,-174.53 1209.5,-174.53"/>
|
||||
</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="552" cy="-202.8" rx="94.35" ry="18"/>
|
||||
<text text-anchor="middle" x="552" y="-198.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="M552,-184.58C552,-164.43 552,-134.8 552,-134.8 552,-134.8 839.54,-134.8 839.54,-134.8"/>
|
||||
<polygon fill="black" stroke="black" points="839.54,-138.3 849.54,-134.8 839.54,-131.3 839.54,-138.3"/>
|
||||
</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="1222" cy="-66.8" rx="67.76" ry="18"/>
|
||||
<text text-anchor="middle" x="1222" y="-62.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="M1213,-84.67C1213,-84.67 1213,-106.34 1213,-106.34"/>
|
||||
<polygon fill="black" stroke="black" points="1209.5,-106.34 1213,-116.34 1216.5,-106.34 1209.5,-106.34"/>
|
||||
</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="90" cy="-278.8" rx="66.03" ry="18"/>
|
||||
<text text-anchor="middle" x="90" y="-274.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="M90,-260.79C90,-238.31 90,-202.8 90,-202.8 90,-202.8 310.08,-202.8 310.08,-202.8"/>
|
||||
<polygon fill="black" stroke="black" points="310.08,-206.3 320.08,-202.8 310.08,-199.3 310.08,-206.3"/>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
@ -143,7 +143,7 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-line">Defined in <a href="" data-line="18" class="link-to-prism">src/core/interceptors/page.interceptor.ts:18</a></div>
|
||||
<div class="io-line">Defined in <a href="" data-line="15" class="link-to-prism">src/core/interceptors/page.interceptor.ts:15</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@ -222,8 +222,8 @@
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-line">Defined in <a href="" data-line="117"
|
||||
class="link-to-prism">src/core/interceptors/page.interceptor.ts:117</a></div>
|
||||
<div class="io-line">Defined in <a href="" data-line="106"
|
||||
class="link-to-prism">src/core/interceptors/page.interceptor.ts:106</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@ -302,8 +302,8 @@
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-line">Defined in <a href="" data-line="97"
|
||||
class="link-to-prism">src/core/interceptors/page.interceptor.ts:97</a></div>
|
||||
<div class="io-line">Defined in <a href="" data-line="86"
|
||||
class="link-to-prism">src/core/interceptors/page.interceptor.ts:86</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@ -401,8 +401,8 @@
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-line">Defined in <a href="" data-line="45"
|
||||
class="link-to-prism">src/core/interceptors/page.interceptor.ts:45</a></div>
|
||||
<div class="io-line">Defined in <a href="" data-line="42"
|
||||
class="link-to-prism">src/core/interceptors/page.interceptor.ts:42</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@ -491,7 +491,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/interceptors/page.interceptor.ts:37</a></div>
|
||||
<div class="io-line">Defined in <a href="" data-line="34" class="link-to-prism">src/core/interceptors/page.interceptor.ts:34</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@ -524,7 +524,7 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-line">Defined in <a href="" data-line="32" class="link-to-prism">src/core/interceptors/page.interceptor.ts:32</a></div>
|
||||
<div class="io-line">Defined in <a href="" data-line="29" class="link-to-prism">src/core/interceptors/page.interceptor.ts:29</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@ -544,12 +544,9 @@
|
||||
|
||||
<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 { CACHE_MANAGER, CallHandler, ExecutionContext, Inject, Injectable, NestInterceptor } from "@nestjs/common";
|
||||
import { BadRequestException, CACHE_MANAGER, CallHandler, ExecutionContext, Inject, Injectable, InternalServerErrorException, NestInterceptor } from "@nestjs/common";
|
||||
import { Observable, map, take, switchMap, of } from "rxjs";
|
||||
import { PageDto } from "../domain/dtos";
|
||||
import { EsQueryDto } from "../domain/dtos/elastic/es-query.dto";
|
||||
import { RequestDto } from "../domain/dtos/request.dto";
|
||||
import { SearchQueryDto } from "../domain/dtos/search-q.dto";
|
||||
import { EsTime } from "../domain/enums/es-time.enum";
|
||||
import { Order, toOrder } from "../domain/enums/page-order.enum";
|
||||
import { EsPit } from "../domain/interfaces/elastic/es-pit.interface";
|
||||
@ -588,29 +585,21 @@ export class PageInterceptor implements NestInterceptor {
|
||||
* @returns Page with content and metadata
|
||||
*/
|
||||
async intercept(context: ExecutionContext, next: CallHandler<any>): Promise<Observable<PageDto>> {
|
||||
const request: RequestDto = context.switchToHttp().getRequest<RequestDto>();
|
||||
const query: SearchQueryDto = request.query;
|
||||
const query = context.switchToHttp().getRequest().query;
|
||||
|
||||
const offset = !query.offset ? 0 : query.offset;
|
||||
const limit = !query.limit ? 10 : query.limit;
|
||||
const order = !query.order ? Order.DESC : query.order;
|
||||
const offset = query.offset;
|
||||
const limit = query.limit;
|
||||
const order = query.order;
|
||||
const query_string = query.query;
|
||||
|
||||
const prev_page = await this.cacheManager.get('prev_page');
|
||||
const prev_page = await this.cacheManager.get('prev_page');
|
||||
if (prev_page) {
|
||||
if (offset == prev_page[1] && limit == prev_page[2] && order == prev_page[3]) return of(prev_page[0]);
|
||||
if (offset == prev_page[1] &&
|
||||
limit == prev_page[2] &&
|
||||
order == prev_page[3] &&
|
||||
query_string === prev_page[4]) return of(prev_page[0]);
|
||||
}
|
||||
|
||||
// Contruct a body for querying Elasticsearch
|
||||
request.es_query = new EsQueryDto();
|
||||
request.es_query.query = {
|
||||
query_string: {
|
||||
query: query.query,
|
||||
default_field: 'content',
|
||||
}
|
||||
};
|
||||
request.es_query.from = offset;
|
||||
request.es_query.size = limit;
|
||||
|
||||
return next.handle().pipe(
|
||||
switchMap(async (res) => {
|
||||
// Setting the page meta-data
|
||||
@ -620,7 +609,7 @@ export class PageInterceptor implements NestInterceptor {
|
||||
};
|
||||
|
||||
// Check if the performed search is a backwards search
|
||||
let data = res.hits.hits;
|
||||
let data = res?.hits?.hits;
|
||||
// Omitting the redundant info and leaving only the document
|
||||
data = data.map((el) => el._source);
|
||||
// Change the order if set
|
||||
@ -628,7 +617,7 @@ export class PageInterceptor implements NestInterceptor {
|
||||
|
||||
// Cache and return the page
|
||||
const page: PageDto = new PageDto(data, meta);
|
||||
await this.cacheManager.set('prev_page', [page, offset, limit, order]);
|
||||
await this.cacheManager.set('prev_page', [page, offset, limit, order, query_string]);
|
||||
return page;
|
||||
})
|
||||
);
|
||||
|
@ -138,7 +138,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="12" class="link-to-prism">src/core/services/common/search.service.ts:12</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@ -199,7 +199,7 @@ HTTPService instance</p>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<span class="modifier-icon icon ion-ios-reset"></span>
|
||||
<code>findByContext(es_query: <a href="../interfaces/EsQuery.html" target="_self">EsQueryDto</a>)</code>
|
||||
<code>findByContext(query: <a href="../classes/SearchQueryDto.html" target="_self">SearchQueryDto</a>)</code>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@ -226,13 +226,14 @@ HTTPService instance</p>
|
||||
<td>Name</td>
|
||||
<td>Type</td>
|
||||
<td>Optional</td>
|
||||
<td>Description</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>es_query</td>
|
||||
<td>query</td>
|
||||
<td>
|
||||
<code><a href="../interfaces/EsQuery.html" target="_self" >EsQueryDto</a></code>
|
||||
<code><a href="../classes/SearchQueryDto.html" target="_self" >SearchQueryDto</a></code>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
@ -240,6 +241,10 @@ HTTPService instance</p>
|
||||
</td>
|
||||
|
||||
|
||||
<td>
|
||||
<p>, <EsQueryDto></p>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
@ -251,7 +256,7 @@ HTTPService instance</p>
|
||||
|
||||
</div>
|
||||
<div class="io-description">
|
||||
<p>Elasticsearch hits or an error object</p>
|
||||
<p>Elasticsearch response</p>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
@ -280,8 +285,8 @@ HTTPService instance</p>
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-line">Defined in <a href="" data-line="34"
|
||||
class="link-to-prism">src/core/services/common/search.service.ts:34</a></div>
|
||||
<div class="io-line">Defined in <a href="" data-line="35"
|
||||
class="link-to-prism">src/core/services/common/search.service.ts:35</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@ -300,6 +305,7 @@ HTTPService instance</p>
|
||||
<td>Name</td>
|
||||
<td>Type</td>
|
||||
<td>Optional</td>
|
||||
<td>Description</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@ -314,6 +320,10 @@ HTTPService instance</p>
|
||||
</td>
|
||||
|
||||
|
||||
<td>
|
||||
<p>String, that represents unique identifier of a paper</p>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
@ -358,7 +368,7 @@ HTTPService instance</p>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-line">Defined in <a href="" data-line="27" class="link-to-prism">src/core/services/common/search.service.ts:27</a></div>
|
||||
<div class="io-line">Defined in <a href="" data-line="28" class="link-to-prism">src/core/services/common/search.service.ts:28</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@ -391,7 +401,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="23" class="link-to-prism">src/core/services/common/search.service.ts:23</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@ -411,9 +421,10 @@ 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 { BadRequestException, GatewayTimeoutException, HttpException, Injectable, NotFoundException } from "@nestjs/common";
|
||||
import { GatewayTimeoutException, ImATeapotException, Injectable, NotFoundException } from "@nestjs/common";
|
||||
import { map, take } from "rxjs";
|
||||
import { EsResponseDto} from "../../domain/dtos";
|
||||
import { EsMultimatchQueryDto } from "src/core/domain/dtos/elastic/es-multimatch.dto";
|
||||
import { EsResponseDto, SearchQueryDto} from "../../domain/dtos";
|
||||
import { EsQueryDto } from "../../domain/dtos/elastic/es-query.dto";
|
||||
|
||||
/**
|
||||
@ -440,14 +451,13 @@ export class SearchService {
|
||||
|
||||
/**
|
||||
* Finds a paper by its own ID
|
||||
* @param uuid
|
||||
* @param uuid String, that represents unique identifier of a paper
|
||||
* @returns Elasticsearch hits or an error object
|
||||
*/
|
||||
async findByID(uuid: string): Promise<EsResponseDto> { // Should I change 'object' to specific DTO?
|
||||
let ESQ: EsQueryDto = new EsQueryDto;
|
||||
|
||||
// ESQ.size = 1;
|
||||
ESQ.query = {
|
||||
const es_query: EsQueryDto = new EsQueryDto();
|
||||
es_query.size = 1;
|
||||
es_query.query = {
|
||||
query_string: {
|
||||
query: ('id:' + uuid),
|
||||
}
|
||||
@ -456,17 +466,17 @@ export class SearchService {
|
||||
return new Promise((resolve, reject) => {
|
||||
try {
|
||||
(this.httpService.get<EsResponseDto>(`http://${this.ES_IP}:${this.ES_PORT}/_search`, {
|
||||
data: ESQ,
|
||||
data: es_query,
|
||||
headers: {'Content-Type': 'application/json'},
|
||||
}))
|
||||
?.pipe(take(1), map(axiosRes => axiosRes.data))
|
||||
.subscribe((res: EsResponseDto) => {
|
||||
if (!res.hits.hits.length) {
|
||||
reject(new NotFoundException);
|
||||
}
|
||||
if (res.timed_out) {
|
||||
reject(new GatewayTimeoutException('Elasticsearch Timed Out'));
|
||||
}
|
||||
if (!res?.hits?.hits?.length) {
|
||||
reject(new NotFoundException);
|
||||
}
|
||||
resolve(res);
|
||||
});
|
||||
} catch (error) {
|
||||
@ -478,21 +488,24 @@ export class SearchService {
|
||||
/**
|
||||
* Finds relevant documents by context using the given query string
|
||||
* @param query, <EsQueryDto>
|
||||
* @returns Elasticsearch hits or an error object
|
||||
* @returns Elasticsearch response
|
||||
*/
|
||||
async findByContext(es_query: EsQueryDto): Promise<EsResponseDto> {
|
||||
async findByContext(query: SearchQueryDto): Promise<EsResponseDto> {
|
||||
// Contruct a body for querying Elasticsearch
|
||||
const es_query: EsMultimatchQueryDto = new EsMultimatchQueryDto(query.query, [
|
||||
'title', 'content'
|
||||
]);
|
||||
es_query.from = query.offset;
|
||||
es_query.size = query.limit;
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
try {
|
||||
if (!es_query.query.query_string.query) {
|
||||
throw new BadRequestException;
|
||||
}
|
||||
|
||||
(this.httpService.get<EsResponseDto>(`http://${this.ES_IP}:${this.ES_PORT}/_search`, {
|
||||
data: es_query,
|
||||
headers: {'Content-Type': 'application/json'},
|
||||
}))
|
||||
?.pipe(take(1), map(axiosRes => axiosRes.data))
|
||||
.subscribe((res: EsResponseDto) => {
|
||||
?.subscribe((res: EsResponseDto) => {
|
||||
if (res.timed_out) {
|
||||
reject(new GatewayTimeoutException('Elasticsearch Timed Out'));
|
||||
}
|
||||
|
@ -177,6 +177,9 @@ customElements.define('compodoc-menu', class extends HTMLElement {
|
||||
<li class="link">
|
||||
<a href="classes/EsHitDto.html" data-type="entity-link" >EsHitDto</a>
|
||||
</li>
|
||||
<li class="link">
|
||||
<a href="classes/EsMultimatchQueryDto.html" data-type="entity-link" >EsMultimatchQueryDto</a>
|
||||
</li>
|
||||
<li class="link">
|
||||
<a href="classes/EsQueryDto.html" data-type="entity-link" >EsQueryDto</a>
|
||||
</li>
|
||||
@ -198,15 +201,9 @@ customElements.define('compodoc-menu', class extends HTMLElement {
|
||||
<li class="link">
|
||||
<a href="classes/PaperDto.html" data-type="entity-link" >PaperDto</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>
|
||||
<li class="link">
|
||||
<a href="classes/SearchResultDto.html" data-type="entity-link" >SearchResultDto</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="chapter">
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -70,17 +70,14 @@
|
||||
<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>
|
||||
<li>
|
||||
<a href="#allowedProperties" title="src/core/domain/dtos/search-result.dto.ts" ><b>allowedProperties</b> (src/.../search-result.dto.ts)</a>
|
||||
<a href="#allowedProperties" title="src/core/domain/dtos/elastic/es-hit.dto.ts" ><b>allowedProperties</b> (src/.../es-hit.dto.ts)</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#allowedProperties" title="src/core/domain/dtos/elastic/es-hit.dto.ts" ><b>allowedProperties</b> (src/.../es-hit.dto.ts)</a>
|
||||
<a href="#allowedProperties" title="src/core/domain/dtos/elastic/es-multimatch.dto.ts" ><b>allowedProperties</b> (src/.../es-multimatch.dto.ts)</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#allowedProperties" title="src/core/domain/dtos/elastic/es-query.dto.ts" ><b>allowedProperties</b> (src/.../es-query.dto.ts)</a>
|
||||
@ -218,41 +215,6 @@
|
||||
</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">
|
||||
@ -274,42 +236,7 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<i>Default value : </i><code>['query', 'pagen', 'limit', 'order']</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-result.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>['data', 'status']</code>
|
||||
<i>Default value : </i><code>['query', 'limit', 'offset', 'order']</code>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@ -358,6 +285,41 @@
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
<h3>src/core/domain/dtos/elastic/es-multimatch.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']</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/elastic/es-query.dto.ts</h3>
|
||||
<section>
|
||||
<h3></h3> <table class="table table-sm table-bordered">
|
||||
|
@ -158,7 +158,7 @@
|
||||
|
||||
<div class="tab-pane fade tab-source-code" id="c-source">
|
||||
<pre class="line-numbers compodoc-sourcecode"><code class="language-typescript">import { CacheInterceptor, CacheModule, Module } from '@nestjs/common';
|
||||
import { APP_INTERCEPTOR } from '@nestjs/core';
|
||||
import { APP_INTERCEPTOR, APP_PIPE } from '@nestjs/core';
|
||||
import { ConfigModule } from '@nestjs/config';
|
||||
import { configuration } from '../config/env.objects';
|
||||
import { validate } from '../config/env.validation';
|
||||
|
@ -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 |
@ -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">12 Classes</p>
|
||||
<p class="card-text">11 Classes</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -27,10 +27,8 @@
|
||||
"type": "keyword"
|
||||
},
|
||||
"content": {
|
||||
"type": "text"
|
||||
},
|
||||
"publisher": {
|
||||
"type": "text"
|
||||
"type": "text",
|
||||
"analyzer": "content_analyzer_engram"
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -39,7 +37,10 @@
|
||||
"analyzer": {
|
||||
"title_analyzer": {
|
||||
"type": "custom",
|
||||
"tokenizer": "title_engram_tokenizer"
|
||||
"tokenizer": "title_engram_tokenizer",
|
||||
"filter": [
|
||||
"lowercase"
|
||||
]
|
||||
},
|
||||
"content_analyzer_i": {
|
||||
"type": "custom",
|
||||
@ -57,14 +58,21 @@
|
||||
"filter": [
|
||||
]
|
||||
},
|
||||
"basic_analyzer": {
|
||||
|
||||
"content_analyzer_engram": {
|
||||
"type": "custom",
|
||||
"tokenizer": "content_engram_tokenizer",
|
||||
"char_filter": [
|
||||
"markdown_token_filter"
|
||||
],
|
||||
"filter": [
|
||||
"lowercase"
|
||||
]
|
||||
}
|
||||
},
|
||||
"tokenizer": {
|
||||
"title_engram_tokenizer": {
|
||||
"type": "edge_ngram",
|
||||
"min_gram": 2,
|
||||
"min_gram": 3,
|
||||
"max_gram": 10,
|
||||
"token_chars": [
|
||||
"letter",
|
||||
@ -78,6 +86,15 @@
|
||||
".", ",", "(", ")", "-", "[", "]", "{",
|
||||
"}", "#", ":", ";", "`", "!", "*"
|
||||
]
|
||||
},
|
||||
"content_engram_tokenizer": {
|
||||
"type": "edge_ngram",
|
||||
"min_gram": 3,
|
||||
"max_gram": 10,
|
||||
"token_chars": [
|
||||
"letter",
|
||||
"digit"
|
||||
]
|
||||
}
|
||||
},
|
||||
"char_filter": {
|
||||
|
@ -3,7 +3,7 @@
|
||||
__isint='^[0-9]+$'
|
||||
__isvalidstr='^[a-z0-9]+$'
|
||||
__isvalidaddr='^[a-z]+$|^((25[0-5]|2[0-4]?[0-9]|1[0-9]?[0-9]|[3-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4]?[0-9]|1[0-9]?[0-9]|[3-9][0-9]|[0-9])$'
|
||||
__isJSONfile='^[a-z0-9\_\-]+(\.json)$'
|
||||
__isJSONfile='^[~_\-.\/a-zA-Z0-9]+(\.json)$'
|
||||
|
||||
create_template() {
|
||||
curl -H "Content-Type: application/json" -X PUT "$1:$2/_index_template/papers_t" -d @"$3"
|
||||
@ -27,10 +27,6 @@ upload_files() {
|
||||
-d @"$_file"
|
||||
elif [[ -n "$_dir" ]]; then
|
||||
for file in "$_dir"/*; do
|
||||
if [[ ! file =~ $__isJSONfile ]]; then
|
||||
echo "$file is not identified as JSON. Skipping..."
|
||||
continue;
|
||||
fi
|
||||
|
||||
curl -X POST "$1:$2/papers-$3/_doc/" \
|
||||
-H "Content-Type: application/json" \
|
||||
@ -113,7 +109,7 @@ else
|
||||
fi
|
||||
;;
|
||||
-f | --file)
|
||||
if [[ -n "$2" && $2 =~ $__isJSONfile ]]; then
|
||||
if [[ true ]]; then
|
||||
FPATH="$2"
|
||||
shift
|
||||
else
|
||||
|
@ -19,6 +19,19 @@ export class HealthController {
|
||||
@Get()
|
||||
@HealthCheck()
|
||||
check() {
|
||||
return { status: 'ok', info: { alive: { status: 'up' } }, error: {}, details: { alive: { status: 'up' } } };
|
||||
return {
|
||||
status: 'ok',
|
||||
info: {
|
||||
alive: {
|
||||
status: 'up'
|
||||
}
|
||||
},
|
||||
error: {},
|
||||
details: {
|
||||
alive: {
|
||||
status: 'up'
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
0
src/core/domain/dtos/elastic/es-hit.dto.spec.ts
Normal file
0
src/core/domain/dtos/elastic/es-hit.dto.spec.ts
Normal file
0
src/core/domain/dtos/elastic/es-query.dto.spec.ts
Normal file
0
src/core/domain/dtos/elastic/es-query.dto.spec.ts
Normal file
@ -1,6 +1,8 @@
|
||||
export * from './elastic/es-query.dto';
|
||||
export * from './elastic/es-response.dto';
|
||||
export * from './elastic/es-hit.dto';
|
||||
export * from './elastic/es-multimatch.dto';
|
||||
export * from './page.dto';
|
||||
export * from './search-q.dto';
|
||||
export * from './paper.dto';
|
||||
export * from './paper.dto';
|
||||
export * from './page-meta.dto';
|
@ -1,5 +1,5 @@
|
||||
import { ApiExtraModels, ApiProperty } from "@nestjs/swagger";
|
||||
import { IsArray } from "class-validator";
|
||||
import { IsArray, IsInt } from "class-validator";
|
||||
import { Order } from "../enums";
|
||||
|
||||
/**
|
||||
@ -15,7 +15,7 @@ export class PageMetaDto {
|
||||
/**
|
||||
* Total number of hits (results) acquired from the search
|
||||
*/
|
||||
@IsArray()
|
||||
@IsInt()
|
||||
@ApiProperty({
|
||||
description: 'Total number of hits (results) acquired from the search',
|
||||
example: 314
|
||||
@ -30,4 +30,9 @@ export class PageMetaDto {
|
||||
example: Order.DESC
|
||||
})
|
||||
order: Order;
|
||||
|
||||
constructor(total: number = 0, order: Order = Order.DESC) {
|
||||
this.total = total;
|
||||
this.order = order;
|
||||
}
|
||||
}
|
@ -18,7 +18,7 @@ export enum Order {
|
||||
* @param str String to be converted
|
||||
* @returns Appropriate enum-member
|
||||
*/
|
||||
export function toOrder(str: string): Order {
|
||||
export function stringToOrder(str: string): Order {
|
||||
if (!str) return Order.DESC;
|
||||
|
||||
switch (str) {
|
||||
|
@ -3,7 +3,7 @@ import { BadRequestException, CACHE_MANAGER, CallHandler, ExecutionContext, Inje
|
||||
import { Observable, map, take, switchMap, of } from "rxjs";
|
||||
import { PageDto } from "../domain/dtos";
|
||||
import { EsTime } from "../domain/enums/es-time.enum";
|
||||
import { Order, toOrder } from "../domain/enums/page-order.enum";
|
||||
import { Order, stringToOrder } from "../domain/enums/page-order.enum";
|
||||
import { EsPit } from "../domain/interfaces/elastic/es-pit.interface";
|
||||
import { Cache } from 'cache-manager'
|
||||
import { PageMetaDto } from "../domain/dtos/page-meta.dto";
|
||||
@ -58,10 +58,7 @@ export class PageInterceptor implements NestInterceptor {
|
||||
return next.handle().pipe(
|
||||
switchMap(async (res) => {
|
||||
// Setting the page meta-data
|
||||
let meta: PageMetaDto = {
|
||||
total: res.hits.total.value,
|
||||
order: toOrder(order),
|
||||
};
|
||||
let meta: PageMetaDto = new PageMetaDto(res.hits.total.value, stringToOrder(order));
|
||||
|
||||
// Check if the performed search is a backwards search
|
||||
let data = res?.hits?.hits;
|
||||
@ -79,6 +76,7 @@ export class PageInterceptor implements NestInterceptor {
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* 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
|
||||
@ -99,6 +97,7 @@ export class PageInterceptor implements NestInterceptor {
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* 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
|
||||
|
Loading…
x
Reference in New Issue
Block a user