diff --git a/scripts/core/ArticlesListByQuery.tsx b/scripts/core/ArticlesListByQuery.tsx index 15069bcab9..1ef8eb6cb0 100644 --- a/scripts/core/ArticlesListByQuery.tsx +++ b/scripts/core/ArticlesListByQuery.tsx @@ -151,21 +151,6 @@ class ArticlesListByQueryComponent extends SuperdeskReactComponent { // TEMPORARY FIX FOR SDESK-6157 return false; - - /** TODO: Have websockets transmit the diff. - * The component should not update when field value changes do not affect the query - - * for example, if the query is {desk: 'X'} and an update is about an item moved - * from desk Y to Z. - */ - - const queryFields = getQueryFieldsRecursive(this.props.query.filter); - - // add sorting fields - flatMap(this.props.query.sort, (option) => Object.keys(option)).forEach((sortField) => { - queryFields.add(sortField); - }); - - return Array.from(changedFields).some((changedField) => queryFields.has(changedField)); }} onItemClick={this.props.onItemClick} onItemDoubleClick={this.props.onItemDoubleClick} diff --git a/scripts/core/query-formatting.ts b/scripts/core/query-formatting.ts index 288085ad91..15659154d1 100644 --- a/scripts/core/query-formatting.ts +++ b/scripts/core/query-formatting.ts @@ -117,6 +117,7 @@ export function toElasticQuery(q: ISuperdeskQuery): {q?: string; source: string} query?: { filtered: { filter?: {}; + query?: {}; }; }; sort: ISuperdeskQuery['sort']; @@ -142,14 +143,20 @@ export function toElasticQuery(q: ISuperdeskQuery): {q?: string; source: string} }; } + if (q.fullTextSearch) { + query.query.filtered.query = { + query_string: { + query: q.fullTextSearch, + lenient: true, + default_operator: 'AND', + }, + }; + } + const result: ReturnType = { source: JSON.stringify(query), }; - if (q.fullTextSearch != null) { - result.q = q.fullTextSearch; - } - return result; }