mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-07 14:02:48 +00:00
fix: enhance default search query generation
This commit is contained in:
@@ -20,6 +20,14 @@ const config: ElasticsearchConfigFile = {
|
|||||||
database: {
|
database: {
|
||||||
name: 'elasticsearch',
|
name: 'elasticsearch',
|
||||||
version: '5.6',
|
version: '5.6',
|
||||||
|
query: {
|
||||||
|
minMatch: '75%',
|
||||||
|
queryType: 'dis_max',
|
||||||
|
matchBoosting: 1.3,
|
||||||
|
fuzziness: 'AUTO',
|
||||||
|
cutoffFrequency: 0.0,
|
||||||
|
tieBreaker: 0,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -135,7 +135,7 @@ export interface ElasticsearchQueryDisMaxConfig {
|
|||||||
* The maximum allowed Levenshtein Edit Distance (or number of edits)
|
* The maximum allowed Levenshtein Edit Distance (or number of edits)
|
||||||
* @see https://www.elastic.co/guide/en/elasticsearch/reference/5.6/common-options.html#fuzziness
|
* @see https://www.elastic.co/guide/en/elasticsearch/reference/5.6/common-options.html#fuzziness
|
||||||
*/
|
*/
|
||||||
fuzziness: number;
|
fuzziness: number | string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Increase the importance (relevance score) of a field
|
* Increase the importance (relevance score) of a field
|
||||||
|
|||||||
@@ -347,7 +347,7 @@ export function buildQuery(
|
|||||||
query_string: {
|
query_string: {
|
||||||
analyzer: 'search_german',
|
analyzer: 'search_german',
|
||||||
default_field: 'name',
|
default_field: 'name',
|
||||||
minimum_should_match: elasticsearchConfig.query.fuzziness,
|
minimum_should_match: elasticsearchConfig.query.minMatch,
|
||||||
query: (typeof params.query !== 'string') ? '*' : escapeESReservedCharacters(params.query),
|
query: (typeof params.query !== 'string') ? '*' : escapeESReservedCharacters(params.query),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user