1
0
mirror of https://github.com/nextapps-de/flexsearch.git synced 2025-09-03 10:53:41 +02:00

better support for result highlighting when using resolver

This commit is contained in:
Thomas Wilkerling
2025-06-06 07:57:38 +02:00
parent 1c4bcaac2e
commit 35fd7c80c2
74 changed files with 4856 additions and 5041 deletions

View File

@@ -324,3 +324,27 @@ Result:
```js
"<i>...</i> dolor <b>sit</b> <b>amet</b> conset<i>...</i>"
```
### Using Result Highlighting on Resolver
When using complex queries by `Resolver` you can pass a highlight option to any one of the resolver stages that is also including a query. The last resolver stage will then automatically inherit necessary options.
```js
const raw = new Resolver({
index: index,
field: "title",
query: "some query"
})
.or({
field: "title",
// highlight requires a query
query: "highlight this",
// define on a single resolver stage
highlight: { /* ... */ }
})
.not({
field: "title",
query: "undefined",
})
.resolve();
```