diff --git a/app/routes/circulars/circulars.server.ts b/app/routes/circulars/circulars.server.ts index 9c65084a3..c839e8d73 100644 --- a/app/routes/circulars/circulars.server.ts +++ b/app/routes/circulars/circulars.server.ts @@ -32,7 +32,7 @@ import type { CircularMetadata, } from './circulars.lib' import { sendEmail } from '~/lib/email.server' -import { origin } from '~/lib/env.server' +import { feature, origin } from '~/lib/env.server' // A type with certain keys required. type Require = Omit & Required> @@ -158,6 +158,22 @@ export async function search({ }, } + const queryObj = query + ? feature('CICRULARS_LUCENE') + ? { + simple_query_string: { + query, + fields: ['submitter', 'subject', 'body'], + }, + } + : { + multi_match: { + query, + fields: ['submitter', 'subject', 'body'], + }, + } + : undefined + const { body: { hits: { @@ -170,14 +186,7 @@ export async function search({ body: { query: { bool: { - must: query - ? { - multi_match: { - query, - fields: ['submitter', 'subject', 'body'], - }, - } - : undefined, + must: queryObj, filter: { range: { createdOn: {