Help with search results ordering in docusaurus in...
# community-help
a
Help with search results ordering in docusaurus integration ๐Ÿงต
search term -
audit trail
result json -
Copy code
{
  "results": [
    {
      "facet_counts": [],
      "found": 5,
      "grouped_hits": [
        {
          "group_key": [
            "<https://clerky-guides-temp.netlify.app/#docusaurus-base-url-issue-banner-container>"
          ],
          "hits": [
            {
              "document": {
                "anchor": "docusaurus-base-url-issue-banner-container",
                "content": "Audit Trail",
                "hierarchy": {
                  "lvl0": "Your Clerky Account",
                  "lvl1": null,
                  "lvl2": null,
                  "lvl3": null,
                  "lvl4": null,
                  "lvl5": null,
                  "lvl6": null
                },
                "hierarchy.lvl0": "Your Clerky Account",
                "id": "10",
                "type": "content",
                "url": "<https://clerky-guides-temp.netlify.app/#docusaurus-base-url-issue-banner-container>"
              },
              "highlight": {
                "content": {
                  "matched_tokens": [
                    "Audit",
                    "Trail"
                  ],
                  "snippet": "<mark>Audit</mark> <mark>Trail</mark>",
                  "value": "<mark>Audit</mark> <mark>Trail</mark>"
                }
              },
              "highlights": [
                {
                  "field": "content",
                  "matched_tokens": [
                    "Audit",
                    "Trail"
                  ],
                  "snippet": "<mark>Audit</mark> <mark>Trail</mark>",
                  "value": "<mark>Audit</mark> <mark>Trail</mark>"
                }
              ],
              "text_match": 1157451471441625000,
              "text_match_info": {
                "best_field_score": "2211897868544",
                "best_field_weight": 8,
                "fields_matched": 1,
                "score": "1157451471441625153",
                "tokens_matched": 2
              }
            }
          ]
        },
        {
          "group_key": [
            "<https://clerky-guides-temp.netlify.app/glossary/#audit-trail>"
          ],
          "hits": [
            {
              "document": {
                "anchor": "audit-trail",
                "content": "Your Clerky Account: Audit Trails",
                "hierarchy": {
                  "lvl0": "Audit Trail โ€‹",
                  "lvl1": null,
                  "lvl2": null,
                  "lvl3": null,
                  "lvl4": null,
                  "lvl5": null,
                  "lvl6": null
                },
                "hierarchy.lvl0": "Audit Trail โ€‹",
                "id": "14",
                "type": "content",
                "url": "<https://clerky-guides-temp.netlify.app/glossary/#audit-trail>"
              },
              "highlight": {
                "content": {
                  "matched_tokens": [
                    "Audit",
                    "Trail"
                  ],
                  "snippet": "Your Clerky Account: <mark>Audit</mark> <mark>Trail</mark>s",
                  "value": "Your Clerky Account: <mark>Audit</mark> <mark>Trail</mark>s"
                }
              },
              "highlights": [
                {
                  "field": "content",
                  "matched_tokens": [
                    "Audit",
                    "Trail"
                  ],
                  "snippet": "Your Clerky Account: <mark>Audit</mark> <mark>Trail</mark>s",
                  "value": "Your Clerky Account: <mark>Audit</mark> <mark>Trail</mark>s"
                }
              ],
              "text_match": 1157451471441100800,
              "text_match_info": {
                "best_field_score": "2211897868288",
                "best_field_weight": 15,
                "fields_matched": 2,
                "score": "1157451471441100922",
                "tokens_matched": 2
              }
            },
            {
              "document": {
                "anchor": "audit-trail",
                "content": "Audit trails help you monitor activity in your workspace by tracking who changed what and when. Depending on what you're looking at, an audit trail can appear as a sidebar menu or as an option in a  More (...)  menu",
                "hierarchy": {
                  "lvl0": "Audit Trail โ€‹",
                  "lvl1": null,
                  "lvl2": null,
                  "lvl3": null,
                  "lvl4": null,
                  "lvl5": null,
                  "lvl6": null
                },
                "hierarchy.lvl0": "Audit Trail โ€‹",
                "id": "13",
                "type": "content",
                "url": "<https://clerky-guides-temp.netlify.app/glossary/#audit-trail>"
              },
              "highlight": {
                "content": {
                  "matched_tokens": [
                    "Audit",
                    "trail"
                  ],
                  "snippet": "<mark>Audit</mark> <mark>trail</mark>s help you monitor activity",
                  "value": "<mark>Audit</mark> <mark>trail</mark>s help you monitor activity in your workspace by tracking who changed what and when. Depending on what you're looking at, an <mark>audit</mark> <mark>trail</mark> can appear as a sidebar menu or as an option in a  More (...)  menu"
                }
              },
              "highlights": [
                {
                  "field": "content",
                  "matched_tokens": [
                    "Audit",
                    "trail"
                  ],
                  "snippet": "<mark>Audit</mark> <mark>trail</mark>s help you monitor activity",
                  "value": "<mark>Audit</mark> <mark>trail</mark>s help you monitor activity in your workspace by tracking who changed what and when. Depending on what you're looking at, an <mark>audit</mark> <mark>trail</mark> can appear as a sidebar menu or as an option in a  More (...)  menu"
                }
              ],
              "text_match": 1157451471441100800,
              "text_match_info": {
                "best_field_score": "2211897868288",
                "best_field_weight": 15,
                "fields_matched": 2,
                "score": "1157451471441100922",
                "tokens_matched": 2
              }
            },
            {
              "document": {
                "anchor": "audit-trail",
                "hierarchy": {
                  "lvl0": "Audit Trail โ€‹",
                  "lvl1": null,
                  "lvl2": null,
                  "lvl3": null,
                  "lvl4": null,
                  "lvl5": null,
                  "lvl6": null
                },
                "hierarchy.lvl0": "Audit Trail โ€‹",
                "id": "12",
                "type": "lvl0",
                "url": "<https://clerky-guides-temp.netlify.app/glossary/#audit-trail>"
              },
              "highlight": {
                "hierarchy": {
                  "lvl0": "Audit Trail โ€‹",
                  "lvl1": null,
                  "lvl2": null,
                  "lvl3": null,
                  "lvl4": null,
                  "lvl5": null,
                  "lvl6": null
                }
              },
              "highlights": [],
              "text_match": 1157451471441100800,
              "text_match_info": {
                "best_field_score": "2211897868288",
                "best_field_weight": 15,
                "fields_matched": 1,
                "score": "1157451471441100921",
                "tokens_matched": 2
              }
            }
          ]
        },
        {
          "group_key": [
            "<https://clerky-guides-temp.netlify.app/your-clerky-account/audit-trails/viewing-audit-trails/>"
          ],
          "hits": [
            {
...
result
question - If the result json has
<mark>Audit</mark> <mark>Trail</mark>
in the first group hites and then
Your Clerky Account: <mark>Audit</mark> <mark>Trail</mark>s
in the second group hit, shouldn't that be the 2nd result?
the ordering is correct on the search result page though. I need the results to be shown in the same order in the popup as well.
also, this is probably a bug but if the result matches against a heirarcy, no highlight text is shown in the popup. See last result in this popup.
here's the json result for the above -
Copy code
{
  "document": {
    "anchor": "audit-trail",
    "hierarchy": {
      "lvl0": "Audit Trail โ€‹",
      "lvl1": null,
      "lvl2": null,
      "lvl3": null,
      "lvl4": null,
      "lvl5": null,
      "lvl6": null
    },
    "hierarchy.lvl0": "Audit Trail โ€‹",
    "id": "12",
    "type": "lvl0",
    "url": "<https://clerky-guides-temp.netlify.app/glossary/#audit-trail>"
  },
  "highlight": {
    "hierarchy": {
      "lvl0": "Audit Trail โ€‹",
      "lvl1": null,
      "lvl2": null,
      "lvl3": null,
      "lvl4": null,
      "lvl5": null,
      "lvl6": null
    }
  },
  "highlights": [],
  "text_match": 1157451471441100800,
  "text_match_info": {
    "best_field_score": "2211897868288",
    "best_field_weight": 15,
    "fields_matched": 1,
    "score": "1157451471441100921",
    "tokens_matched": 2
  }
}
ping @Jason Bosco I'm mainly looking for a fix for my last two comments here - https://typesense-community.slack.com/archives/C01P749MET0/p1677869631345769?thread_ts=1677869266.139009&amp;cid=C01P749MET0 Could you confirm if this is a bug and possible fixes.
j
The docsearch modal library groups results visually in a particular opinionated wayโ€ฆ whereas the search results page is built by docusaurus, which follows a different approach, which is why they look different.
If you look at the search queries generated when you type in the same query in the modal vs the search results page, youโ€™ll see the exact differences in the query structure
Could you open a GitHub issue for that blank highlight issue?