Skip to content

Commit

Permalink
Merge pull request #4398 from bbc/t2062-query-syntax
Browse files Browse the repository at this point in the history
support for diacritics in the basic search query and field names in quotes
  • Loading branch information
andrew-nowak authored Jan 15, 2025
2 parents 96a4a84 + eff6e07 commit 849f2af
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions kahuna/public/js/search/structured-query/syntax.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {getLabel, getCollection} from '../../search-query/query-syntax';

// Line too long for eslint, but can't break it down..
/*eslint-disable max-len */
const parserRe = /(-?)(?:(?:([a-zA-Z@><]+):|(#)|(~))(?:([^ "']+)|"([^"]+)"|'([^']+)')|([a-zA-Z0-9]+)|"([^"]*)"|'([^']*)')/g;
const parserRe = /(-?)(?:(?:([\p{L}@><]+):|"([^"]+)":|'([^']+)':|(#)|(~))(?:([^ "']+)|"([^"]+)"|'([^']+)')|([\p{L}0-9]+)|"([^"]*)"|'([^']*)')/gu;
/*eslint-enable max-len */
const falsyValuesToEmptyString = (value) => {
if (!value){
Expand All @@ -23,10 +23,10 @@ export function structureQuery(query) {
}
while ((m = parserRe.exec(query)) !== null) {
const sign = m[1];
const field = m[2];
const symbol = m[3] || m[4];
const value = m[5] || m[6] || m[7];
const text = m[8] || m[9] || m[10];
const field = m[2] || m[3] || m[4];
const symbol = m[5] || m[6];
const value = m[7] || m[8] || m[9];
const text = m[10] || m[11] || m[12];
const key = {
'#': 'label',
'~': 'collection'
Expand Down

0 comments on commit 849f2af

Please sign in to comment.