Skip to content

Commit

Permalink
Merge pull request #156 from smartprocure/feature/revamp-highlighting
Browse files Browse the repository at this point in the history
Revamp highlighting
  • Loading branch information
stellarhoof authored Jan 23, 2024
2 parents c375c41 + e004eda commit 265cb8b
Show file tree
Hide file tree
Showing 34 changed files with 2,862 additions and 1,530 deletions.
6 changes: 6 additions & 0 deletions .changeset/green-windows-melt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'contexture-elasticsearch': minor
'contexture-react': minor
---

Revamp elasticsearch highlighting API and implementation
2 changes: 1 addition & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"extends": ["eslint:recommended", "plugin:import/recommended"],
"ignorePatterns": ["dist", "node_modules"],
"ignorePatterns": ["dist", "node_modules", "*.ts"],
"parserOptions": {
"ecmaVersion": "2022",
"sourceType": "module"
Expand Down
48 changes: 36 additions & 12 deletions packages/export/src/nodes/__snapshots__/results.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ exports[`results with contexts not wrapped in \`response\` retrieves records 1`
"totalRecords": 3,
},
},
"highlight": false,
"highlight": {
"disable": true,
},
"include": [
"a",
"b",
Expand Down Expand Up @@ -108,7 +110,9 @@ exports[`results with contexts not wrapped in \`response\` retrieves records 1`
"totalRecords": 3,
},
},
"highlight": false,
"highlight": {
"disable": true,
},
"include": [
"a",
"b",
Expand Down Expand Up @@ -172,7 +176,9 @@ exports[`results with contexts not wrapped in \`response\` retrieves records 1`
"totalRecords": 3,
},
},
"highlight": false,
"highlight": {
"disable": true,
},
"include": [
"a",
"b",
Expand Down Expand Up @@ -239,7 +245,9 @@ exports[`results with contexts not wrapped in \`response\` retrieves records 1`
"totalRecords": 3,
},
},
"highlight": false,
"highlight": {
"disable": true,
},
"include": [
"a",
"b",
Expand Down Expand Up @@ -303,7 +311,9 @@ exports[`results with contexts not wrapped in \`response\` retrieves records 1`
"totalRecords": 3,
},
},
"highlight": false,
"highlight": {
"disable": true,
},
"include": [
"a",
"b",
Expand Down Expand Up @@ -368,7 +378,9 @@ exports[`results with contexts not wrapped in \`response\` retrieves records 1`
"totalRecords": 3,
},
},
"highlight": false,
"highlight": {
"disable": true,
},
"include": [
"a",
"b",
Expand Down Expand Up @@ -437,7 +449,9 @@ exports[`results with contexts wrapped in \`response\` retrieves records 1`] =
],
"totalRecords": 3,
},
"highlight": false,
"highlight": {
"disable": true,
},
"include": [
"a",
"b",
Expand Down Expand Up @@ -498,7 +512,9 @@ exports[`results with contexts wrapped in \`response\` retrieves records 1`] =
],
"totalRecords": 3,
},
"highlight": false,
"highlight": {
"disable": true,
},
"include": [
"a",
"b",
Expand Down Expand Up @@ -560,7 +576,9 @@ exports[`results with contexts wrapped in \`response\` retrieves records 1`] =
],
"totalRecords": 3,
},
"highlight": false,
"highlight": {
"disable": true,
},
"include": [
"a",
"b",
Expand Down Expand Up @@ -625,7 +643,9 @@ exports[`results with contexts wrapped in \`response\` retrieves records 1`] =
],
"totalRecords": 3,
},
"highlight": false,
"highlight": {
"disable": true,
},
"include": [
"a",
"b",
Expand Down Expand Up @@ -687,7 +707,9 @@ exports[`results with contexts wrapped in \`response\` retrieves records 1`] =
],
"totalRecords": 3,
},
"highlight": false,
"highlight": {
"disable": true,
},
"include": [
"a",
"b",
Expand Down Expand Up @@ -750,7 +772,9 @@ exports[`results with contexts wrapped in \`response\` retrieves records 1`] =
],
"totalRecords": 3,
},
"highlight": false,
"highlight": {
"disable": true,
},
"include": [
"a",
"b",
Expand Down
2 changes: 1 addition & 1 deletion packages/export/src/nodes/results.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ describe('results', () => {
page: 1,
totalPages: 1,
include,
highlight: false,
highlight: { disable: true },
sortField: 'a',
sortDir: 'desc',
...strategyParams,
Expand Down
7 changes: 3 additions & 4 deletions packages/provider-elasticsearch/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,9 @@ This provider takes a config object as a parameter:

Schemas with with an elasticsearch provider can specify any or all of the following properties:

| Option | Type | Description | Required |
| ----------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- |
| `index` | `string` | Which ES index to use when querying | x |
| `highlight` | `object` | Used by `results` to determine what fields to highlight, and whether or not they are `inline` (copied over inline on to the source) or `additional` (in a list of additional fields that matched) | |
| Option | Type | Description | Required |
| ------- | -------- | ----------------------------------- | -------- |
| `index` | `string` | Which ES index to use when querying | x |

### Example Schema for SomeType in SomeIndex

Expand Down
1 change: 1 addition & 0 deletions packages/provider-elasticsearch/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
"futil": "^1.76.0",
"js-combinatorics": "^2.1.1",
"lodash": "^4.17.4",
"minimatch": "^9.0.3",
"moment": "^2.18.1",
"moment-timezone": "^0.5.28",
"unidecode": "^0.1.8"
Expand Down
Loading

0 comments on commit 265cb8b

Please sign in to comment.