#community-help

Docusaurus Integration - Prioritise Exact Matches

TLDR Abhishek wanted to prioritize exact matches in Docusaurus integration search results. Jason investigated but couldn't resolve the issue yet.

Powered by Struct AI
Mar 10, 2023 (6 months ago)
Abhishek
Photo of md5-39b08f19a4a6e14122188814743e5c3e
Abhishek
04:18 PM
Using the docusaurus integration, how can I prioritise exact matches to show up before other matches? For example, in this screenshot, I'd like Team to show up before Team Collaborator .
Image 1 for Using the docusaurus integration, how can I prioritise exact matches to show up before other matches? For example, in this screenshot, I'd like <code>Team</code> to show up before <code>Team Collaborator</code> .
04:19
Abhishek
04:19 PM
My config
  "start_urls": [
    {
      "url": "",
      "selectors_key": "glossary_selector",
      "page_rank": 5000000
    },
    {
      "url": "",
      "page_rank": 1
    }
  ],
  "sitemap_urls": [
    ""
  ],
  "sitemap_alternate_links": true,
  "end_urls": [
    ""
  ],
  "selectors": {
    "default": {
      "lvl0": {
        "selector": "invalid",
        "default_value": "Documentation"
      },
      "lvl1": {
        "selector": "(//a[contains(@class, 'menu__link--active')])[1]",
        "type": "xpath"
      },
      "lvl2": {
        "selector": "(//a[contains(@class, 'menu__link--active')])[2]",
        "type": "xpath"
      },
      "lvl3": {
        "selector": "(//a[contains(@class, 'menu__link--active')])[3]",
        "type": "xpath"
      },
      "lvl4": {
        "selector": "(//a[contains(@class, 'menu__link--active')])[4]",
        "type": "xpath"
      },
      "lvl5": {
        "selector": "(//a[contains(@class, 'menu__link--active')])[5]",
        "type": "xpath"
      },
      "lvl6": {
        "selector": "(//a[contains(@class, 'menu__link--active')])[6]",
        "type": "xpath"
      },
      "text": "article p, article li, article td:last-child"
    },
    "glossary_selector": {
      "lvl0": {
        "selector": "h4"
      },
      "text": "article p, article td:last-child"
    }
Mar 11, 2023 (6 months ago)
Jason
Photo of md5-8813087cccc512313602b6d9f9ece19f
Jason
12:10 AM
Could you open the network inspector in the dev console, look for this network request, right-click, copy-as-curl and post it here?

Could you then click on the preview tab, click on the output and post it here?
Mar 12, 2023 (6 months ago)
Abhishek
Photo of md5-39b08f19a4a6e14122188814743e5c3e
Abhishek
03:08 AM
curl '' \
  -H 'authority: ' \
  -H 'accept: application/json, text/plain, */*' \
  -H 'accept-language: en-US,en;q=0.9,fr;q=0.8,da;q=0.7' \
  -H 'content-type: text/plain' \
  -H 'origin: ' \
  -H 'referer: ' \
  -H 'sec-ch-ua: "Chromium";v="110", "Not A(Brand";v="24", "Google Chrome";v="110"' \
  -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 'user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36' \
  --data-raw '{"searches":[{"collection":"clerky-typesense-search","q":"team","query_by":"hierarchy.lvl0,hierarchy.lvl1,hierarchy.lvl2,hierarchy.lvl3,hierarchy.lvl4,hierarchy.lvl5,hierarchy.lvl6,content","include_fields":"hierarchy.lvl0,hierarchy.lvl1,hierarchy.lvl2,hierarchy.lvl3,hierarchy.lvl4,hierarchy.lvl5,hierarchy.lvl6,content,anchor,url,type,id","highlight_full_fields":"hierarchy.lvl0,hierarchy.lvl1,hierarchy.lvl2,hierarchy.lvl3,hierarchy.lvl4,hierarchy.lvl5,hierarchy.lvl6,content","group_by":"url","group_limit":3,"filter_by":"language:=en && docusaurus_tag:=[default,docs-default-current]"}]}' \
  --compressed
03:09
Abhishek
03:09 AM
response
Mar 14, 2023 (6 months ago)
Abhishek
Photo of md5-39b08f19a4a6e14122188814743e5c3e
Abhishek
03:28 PM
Jason any update on this?
Mar 15, 2023 (6 months ago)
Jason
Photo of md5-8813087cccc512313602b6d9f9ece19f
Jason
01:51 AM
Hmm, this almost looks like a bug. We’re going to take a closer look and keep you posted in a few days.
Mar 21, 2023 (6 months ago)
Jason
Photo of md5-8813087cccc512313602b6d9f9ece19f
Jason
03:48 AM
Abhishek Could you upgrade to 0.10.0-1 of docusaurus-theme-search-typesense and let me know how it goes?

I’ve merged your PR to fix the blank results issue, and I’ve also fixed the ranking issue you pointed out above
Mar 22, 2023 (6 months ago)
Abhishek
Photo of md5-39b08f19a4a6e14122188814743e5c3e
Abhishek
10:23 AM
I still don't see this fixed.
Image 1 for I still don't see this fixed.
Jason
Photo of md5-8813087cccc512313602b6d9f9ece19f
Jason
03:41 PM
Hmm, could you share the curl command from the network inspector in the browser for that search?