Skip to content
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

searchResultWithHighlight incorrectly typed #496

Closed
tpict opened this issue Sep 27, 2023 · 4 comments · Fixed by #497
Closed

searchResultWithHighlight incorrectly typed #496

tpict opened this issue Sep 27, 2023 · 4 comments · Fixed by #497

Comments

@tpict
Copy link

tpict commented Sep 27, 2023

Describe the bug
See guide on setting up highlighting. It indicates that the results will come in shape

{
  elapsed: {...},
  count: ...,
  hits: [
    {
      id: ...,
      score: ...,
      document: { text: 'hello world' },
      positions: {
        text: {
          hello: [
            {
              start: 0,
              length: 5
            }
          ]
        }
      }
    }
  ]
}

but if you do typeof results.hits[number].positions[number], you get Position which is just the innermost object with { start: number; length: number; }. This doesn't line up with the record of document fields -> search hits -> positions seen in the example.

To Reproduce
Follow example above

Expected behavior
hits.positions is correctly typed

Screenshots
image

Desktop (please complete the following information):

  • OS: macOS 12
  • Browser: N/A
  • Version: "@orama/orama": "^1.2.8", "@orama/plugin-match-highlight": "^1.2.8",
@micheleriva
Copy link
Member

micheleriva commented Sep 27, 2023

Hi @tpict! Thanks for opening this.
I'll put a $50 bounty for anyone willing to fix this.

/bounty 50

@algora-pbc
Copy link

algora-pbc bot commented Sep 27, 2023

💎 $50 bounty created by micheleriva
🙋 If you start working on this, comment /attempt #496 to notify everyone
👉 To claim this bounty, submit a pull request that includes the text /claim #496 somewhere in its body
📝 Before proceeding, please make sure you can receive payouts in your country
💵 Payment arrives in your account 2-5 days after the bounty is rewarded
💯 You keep 100% of the bounty award
🙏 Thank you for contributing to oramasearch/orama!

Attempt Started (GMT+0) Solution
🟢 @rishi-raj-jain Sep 27, 2023, 5:41:44 PM #497

@algora-pbc
Copy link

algora-pbc bot commented Sep 27, 2023

💡 @rishi-raj-jain submitted a pull request that claims the bounty. You can visit your org dashboard to reward.

@algora-pbc
Copy link

algora-pbc bot commented Sep 28, 2023

🎉🎈 @rishi-raj-jain has been awarded $50! 🎈🎊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants