mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-19 08:02:55 +00:00
feat: improve search experience
This commit is contained in:
@@ -23,7 +23,7 @@ node ./lib/cli.js e2e http://localhost:3000
|
||||
Example to clone the full database
|
||||
|
||||
```shell
|
||||
node app.js copy "*" https://mobile.app.uni-frankfurt.de http://localhost:3000 100
|
||||
node app.js copy "*" -a "999.0.0" https://mobile.server.uni-frankfurt.de http://localhost:3000 100
|
||||
```
|
||||
|
||||
### Program arguments
|
||||
|
||||
@@ -97,6 +97,8 @@
|
||||
"date",
|
||||
"validatable",
|
||||
"filterable",
|
||||
"suggestable",
|
||||
"completable",
|
||||
"inheritTags",
|
||||
"minLength",
|
||||
"pattern",
|
||||
|
||||
0
packages/core/src/protocol/search/completion.ts
Normal file
0
packages/core/src/protocol/search/completion.ts
Normal file
@@ -24,6 +24,11 @@ export interface SCSearchResult {
|
||||
*/
|
||||
data: SCThings[];
|
||||
|
||||
/**
|
||||
* Suggestions for query corrections
|
||||
*/
|
||||
suggestions?: SCSearchSuggestions;
|
||||
|
||||
/**
|
||||
* Facets (aggregations over all matching data)
|
||||
*/
|
||||
@@ -40,6 +45,18 @@ export interface SCSearchResult {
|
||||
stats: SCSearchResultSearchEngineStats;
|
||||
}
|
||||
|
||||
/**
|
||||
* Seach suggestions
|
||||
*
|
||||
* Not to be confused with search-as-you-type suggestions
|
||||
*/
|
||||
export interface SCSearchSuggestions {
|
||||
/**
|
||||
* Suggestions for query terms that might have been misspelled
|
||||
*/
|
||||
terms?: Record<string, string[]>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Stores information about Pagination
|
||||
*/
|
||||
|
||||
@@ -63,7 +63,7 @@ export interface SCThingWithoutReferences {
|
||||
/**
|
||||
* Alternate names of the thing
|
||||
* @filterable
|
||||
* @keyword
|
||||
* @text
|
||||
*/
|
||||
alternateNames?: string[];
|
||||
|
||||
@@ -92,6 +92,8 @@ export interface SCThingWithoutReferences {
|
||||
* @filterable
|
||||
* @minLength 1
|
||||
* @sortable ducet
|
||||
* @completable
|
||||
* @suggestable
|
||||
* @text
|
||||
*/
|
||||
name: string;
|
||||
@@ -240,6 +242,8 @@ export interface SCThingTranslatableProperties {
|
||||
* Translation of the name of the thing
|
||||
* @sortable ducet
|
||||
* @text
|
||||
* @suggestable
|
||||
* @completable
|
||||
*/
|
||||
name?: string;
|
||||
/**
|
||||
|
||||
@@ -43,6 +43,27 @@ export const fieldmap: ElasticsearchFieldmap = {
|
||||
},
|
||||
ignore: ['price'],
|
||||
},
|
||||
suggestable: {
|
||||
default: {
|
||||
trigram: {
|
||||
type: 'text',
|
||||
analyzer: 'trigram',
|
||||
},
|
||||
reverse: {
|
||||
type: 'text',
|
||||
analyzer: 'reverse',
|
||||
},
|
||||
},
|
||||
ignore: [],
|
||||
},
|
||||
completable: {
|
||||
default: {
|
||||
completion: {
|
||||
type: 'search_as_you_type',
|
||||
},
|
||||
},
|
||||
ignore: [],
|
||||
},
|
||||
};
|
||||
|
||||
export const filterableTagName = 'filterable';
|
||||
|
||||
@@ -19,4 +19,27 @@ export const settings: IndicesPutTemplateRequest['settings'] = {
|
||||
'max_result_window': 30_000,
|
||||
'number_of_replicas': 0,
|
||||
'number_of_shards': 1,
|
||||
'index': {
|
||||
analysis: {
|
||||
analyzer: {
|
||||
trigram: {
|
||||
type: 'custom',
|
||||
tokenizer: 'standard',
|
||||
filter: ['lowercase', 'shingle'],
|
||||
},
|
||||
reverse: {
|
||||
type: 'custom',
|
||||
tokenizer: 'standard',
|
||||
filter: ['lowercase', 'reverse'],
|
||||
},
|
||||
},
|
||||
filter: {
|
||||
shingle: {
|
||||
type: 'shingle',
|
||||
min_shingle_size: 2,
|
||||
max_shingle_size: 3,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user