-
-
Notifications
You must be signed in to change notification settings - Fork 63
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
Highlights from exluded field not showing up in Instantsearch hit (question) #162
Comments
Could you share the code snippet that shows how you instantiate the adapter, and also the version of typesense-instantsearch-adapter and typesense server you're using? |
I am using typesense cloud (v0.24.0) and typesense-instantsearch-adapter 2.6.0. First I am creating a scoped api key like so:
Then I am using that scopedApiKey to instantiate the typesense adapter:
I also tried including 'fullText' in the highlight_fields as part of the adapter parameters. |
going through the adapter code, I think I've tracked down where the highlight gets lost. The adapter creates highlights by iterating over the document fields and finding corresponding entries in the highlight object. but because I have explicitly excluded the value of the 'fullText' field from the document it wont get added to the snippets, even though the snippet is present in the server response. The solution is probably to do concat the document key/value entries with the highlight key/snippet entries where the key is not in the document. What do you think? Below is the code I am referring to:
|
I tried to fix this with the code in the pull request. While it worked in the tests, it didn't work when I installed the PR as an npm package so I'm clearly missing something. I will resort to using the _rawTypesenseHit field to construct a custom highlight instead. |
Yup. I'll re-open this, so we can keep a track of this issue. I plan to address this in the next few weeks. |
Description
More of a question than an issue.
On the typesense end, I am using a scoped api key to remove fullText field from the search results but including the fullText highlight snippets.
This is what typesense returns for the search results, which is exactly what I need:
It excludes the full field value and only shows the snippet for the relevant content.
However this data/info seems to get lost with when it goes through instantsearch to the 'Hit' object. The highlighted snippet is not present in the _highlightResult or _snippetResult:
Is this a limitation of instantsearch, where it doesn't pick up a highlight field if it's not present in the search results? Is there anyway for me to use the highlight snippet without having to replace instantsearch with something custom? Is there a setting that will allow the highlight snippet from the typesense server to pass through to the instantsearch hit?
Thanks!
The text was updated successfully, but these errors were encountered: