Skip to content

Commit

Permalink
lucene
Browse files Browse the repository at this point in the history
  • Loading branch information
calypsomatic committed Aug 21, 2024
1 parent 1370a32 commit 5cbfbd4
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 2 deletions.
11 changes: 11 additions & 0 deletions .pnp.cjs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"jwt-decode": "^3.1.2",
"keycode-js": "^3.1.0",
"lodash": "^4.17.21",
"lucene": "^2.1.1",
"marked": "^4.0.10",
"oidc-client-ts": "^2.4.0",
"outdated-browser-rework": "^3.0.1",
Expand Down
5 changes: 3 additions & 2 deletions src/libs/ajax/data-table-providers/WdsDataTableProvider.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import _ from 'lodash/fp';
import lucene from 'lucene';
import { Ajax } from 'src/libs/ajax';
import {
AttributeArray,
Expand Down Expand Up @@ -242,8 +243,8 @@ export class WdsDataTableProvider implements DataTableProvider {
};

protected transformQuery = (query: string): string => {
const specialCharactersRegex = /([+\-&|!(){}[\]^"~*?:\\/\s])/g;
return query.replace(specialCharactersRegex, '\\$1').replace('=', ':');
const escapedQuery = lucene.term.escape(query);
return escapedQuery.replace('=', ':');
};

protected queryOptionsToSearchRequest = (queryOptions: EntityQueryOptions): SearchRequest => {
Expand Down
8 changes: 8 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -12389,6 +12389,13 @@ __metadata:
languageName: node
linkType: hard

"lucene@npm:^2.1.1":
version: 2.1.1
resolution: "lucene@npm:2.1.1"
checksum: 29bbbddfc0b31b3b5f24b2ee19bc134bb5ca9db0f948b7506df96215e2c24631ed7031cc31a0dddc71024c640ce6eb05c92722bf57bf0e6a4f387ca796cc8df7
languageName: node
linkType: hard

"lz-string@npm:^1.5.0":
version: 1.5.0
resolution: "lz-string@npm:1.5.0"
Expand Down Expand Up @@ -16471,6 +16478,7 @@ __metadata:
keycode-js: ^3.1.0
lint-staged: ^13.0.3
lodash: ^4.17.21
lucene: ^2.1.1
marked: ^4.0.10
oidc-client-ts: ^2.4.0
outdated-browser-rework: ^3.0.1
Expand Down

0 comments on commit 5cbfbd4

Please sign in to comment.