acodeninja / modern-tools-for-social-care

An ecosystem of tools for social care management.
0 stars 0 forks source link

Be able to see the search ranking of a result #21

Closed acodeninja closed 2 years ago

acodeninja commented 2 years ago

What does it do now?

Does not return the results ranking for the terms entered.

What should it do?

Return the ranking of each result.

jhackett1 commented 2 years ago

example: https://github.com/LBHackney-IT/lbh-social-care-next-gen-search/blob/main/pages/api/search.ts#L114

we want to expose this as a number in the _meta key of the result, like:

{
  _meta: {
    score: 0.5
    // etc...
  }
  // etc...
}
acodeninja commented 2 years ago

This is actually already implemented...

{
  results: [
    {
      score: 0.5198604,
      data: {
        mosaicId: 39201,
        title: "Mr",
        firstName: "Able",
        lastName: "Thornton",
        _meta: {
          location: {
            frontend: "https://website/resident/39201",
            api: "https://api/resident/39201"
          },
          domain: "resident",
          compound: "39201 Mr Able Thornton"
        }
      }
    }
  ],
  count: 1
}