This message was deleted.
# community-help
s
This message was deleted.
j
Could you open your browser's dev console, navigate to the network tab and then perform a search in the UI, and look for a
multi_search
request, copy as curl and paste it here, minus the API key?
m
Here’s what this comes up with: curl ‘https://dxkjm74r9falewn2p-1.a1.typesense.net/multi_search?x-typesense-api-key=xxx’ \ -H ‘authority: dxkjm74r9falewn2p-1.a1.typesense.net’ \ -H ‘accept: application/json, text/plain, */*’ \ -H ‘accept-language: en-US,en;q=0.9’ \ -H ‘content-type: text/plain’ \ -H ‘dnt: 1’ \ -H ‘origin: https://mecad-production.netlify.app’ \ -H ‘sec-ch-ua: “Not=A?Brand”;v=“99", “Chromium”;v=“118"’ \ -H ‘sec-ch-ua-mobile: ?0’ \ -H ‘sec-ch-ua-platform: “macOS”’ \ -H ‘sec-fetch-dest: empty’ \ -H ‘sec-fetch-mode: cors’ \ -H ‘sec-fetch-site: cross-site’ \ -H ‘sec-gpc: 1’ \ -H ‘user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.0.0 Safari/537.36’ \ --data-raw ‘{“searches”[{“query by”“title, page_path, body_text, site_section”,“highlight_affix_num_tokens”50,“highlight full fields”“title, page_path, body_text, site_section”,“collection”“pages v1”,“q”“anders”,“facet_by”“site section”,“max facet values”10,“page”:1}]}’ \ --compressed
j
When instantiating the typesense-instantsearch-adapter, in additionalSearchParameters, you want to do something like this:
Copy code
const typesenseInstantsearchAdapter = new TypesenseInstantSearchAdapter({
  ...
  additionalSearchParameters: {
    query_by: 'title, page_path, body_text, site_section',
    highlight_fields: 'body_text',
    highlight_full_fields: 'title, page_path, site_section',
    highlight_affix_num_tokens: 50,
    ...
  },
});
✅ 1
highlight_fields
will snippet the
body_text
and for the other fields, the full field will be highlighted
🙌 1
m
Thanks! This kinda works. It highlights and truncates the output to a smaller amount of words. The problem I continue to have (and perhaps there is no way to cure it) is paragraphs that do not have the search term in them are also returned. So on long pages, there are 30-40 snippets lumped together into a single block of text. Is it possible to exclude snippets that do not have a highlight? or to set a maximum number of characters of body text displayed? I saw a tutorial that used the truncate method from Tailwind. I’m not using Tailwind so I’m hoping there is another truncate method.
j
So on long pages, there are 30-40 snippets lumped together into a single block of text.
Ideally you'd want to break large pieces of text into smaller records... But I'm not sure I fully understand this. Could you share a screenshot of this issue?