-
Notifications
You must be signed in to change notification settings - Fork 16
FEAT: Add ability to see which posts matched the search #17
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
base: main
Are you sure you want to change the base?
Conversation
| let idx = 1; | ||
| for (const it of items) { | ||
| const url = `${base}/t/${it.slug}/${it.id}`; | ||
| lines.push(`${idx}. ${it.title} – ${url}`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if we also need an update here?
| const jsonFooter = { | ||
| results: items.map((it) => ({ id: it.id, url: `${base}/t/${it.slug}/${it.id}`, title: it.title })), | ||
| results: items.map((it) => ({ | ||
| id: it.id, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indentation looks off here
|
Then the only open question from me is how this interacts with the single 'max_results' parameter. At the moment that still limits topics but could return a large number of post references. Not sure if we want a limit for posts too? |
| id: it.id, | ||
| url: `${base}/t/${it.slug}/${it.id}`, | ||
| title: it.title, | ||
| posts: it.posts.map(({id}) => ({ id })) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
might be nice to add the urls here too
|
cc @SamSaffron @marstall - not sure if you're the people to ping about this, sorry if not! |
|
feels a bit weak though, id alone is not enough: The hard question here is how much content is "too much" content. The blurb, username, post_number can all be super important context wise. I feel like we should just shape this data in a better way for the llm. Search -> finds posts (not topics) and for each post we have post_number, topic_id, post_id, topic_title, post_blurb unless you are searching explicitly in topic (which is super rare) you will only get 1 post per topic due to Discourse implementation. |
Hey, I noticed that although we get the post information back from the search API, we don't return that as part of the search tool. We are looking to use the search tool to find posts in a topic matching our query to help people find useful posts so this would be a useful feature for us.
Had a go at adding this and have added a test based on the other tests already written but let me know if I'm miles off or if there's a reason we weren't returning the posts :)