-
-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Core] Highlight search results #343
Comments
Not yet on the issue tracker. As for all features a research would first be required so adding here the Currently supported search engines are:
Based on the result of the research it can then be decided if its possible to implement such features in the abstraction and already should us get an idea how we can achieve this. Based on that we can then design a common interface for such feature. If you already did some research around it let us know. |
Done a quick search for the start: |
@mario-fehr Thx for the research 👍 Depending on a quick look we maybe could go with something like and what example Loupe is doing here: $searchBuilder
->addIndex('blog')
->addFilter(new Condition\SearchCondition('Test'))
->withHighlight(
fields: ['title', 'description'],
preTag: '<mark>',
postTag: '</mark>',
) What is also interesting how we handle the highlighting in the Result object. Currently the result has directly the documents. There are two options we put it into a special key something like: {
"title": "Text Title",
"description": "Some Test Description",
"_highlight": {
"title": "<mark>Test</mark> Title",
"description": "Some <mark>Test</mark> description"
}
} Or of we split it into 2 seperate objects which would require a ResultItem object: {
"document": {
"title": "Text Title",
"description": "Some Test Description",
},
"highlight": {
"title": "<mark>Test</mark> Title",
"description": "Some <mark>Test</mark> description"
}
} foreach ($result as $item) {
$item->document;
$item->highlight;
$item->document['title'];
$item->highlight['title'];
$item->document['description'];
$item->highlight['description'];
} |
Loupe currently seems not yet support pre and postTag configuration but tried to implement that here: loupe-php/loupe#70 |
loupe-php/loupe#70 is already merged an will be part of the next feature release so we can start implementing it here. If somebody want to help implementing it let me know. |
@alexander-schranz Is there a preference which result variant should be used? The |
@mario-fehr I would go with the For new features we create for each adapter an own Pull request to keep things reviewable. And as first implementation It would be good to create the feature first for the The following tests can be copied and adopted for a |
Created the main feature branch |
As far as I can currently see highlighting the search result is currently not supported.
Are there any plans for adding this feature in the (near) future?
The text was updated successfully, but these errors were encountered: