Skip to content

Conversation

@IsaacClem
Copy link

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 :)

let idx = 1;
for (const it of items) {
const url = `${base}/t/${it.slug}/${it.id}`;
lines.push(`${idx}. ${it.title}${url}`);
Copy link
Author

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,
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indentation looks off here

@IsaacClem
Copy link
Author

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 }))
Copy link
Author

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

@IsaacClem
Copy link
Author

cc @SamSaffron @marstall - not sure if you're the people to ping about this, sorry if not!

@SamSaffron
Copy link
Member

feels a bit weak though, id alone is not enough:

  "posts": [
    {
      "id": 218354,
      "name": null,
      "username": "Discourse",
      "avatar_template": "/user_avatar/meta.discourse.org/discourse/{size}/148734_2.png",
      "created_at": "2016-08-24T20:48:02.587Z",
      "like_count": 15,
      "blurb": "...down the road. If you test too many things in your template, it will mean it's a pain for someone else in the future to change it. Just start small, testing the most obvious things, and in time you'll get the hang of it. Acceptance Tests https://guides.emberjs.com/v1.12.0/testing/acceptance/ Acceptance te...",
      "post_number": 1,
      "topic_id": 49167
    },
    {
      "id": 138484,
      "name": null,
      "username": "Discourse",
      "avatar_template": "/user_avatar/meta.discourse.org/discourse/{size}/148734_2.png",
      "created_at": "2015-08-27T21:32:26.407Z",
      "like_count": 30,
      "blurb": "...uses https://rspec.info/ rspec . For the browser application, we have a https://qunitjs.com/ qunit suite that has https://guides.emberjs.com/release/testing/testing-application/ ember-testing included. Assuming you have a development environment set up, if you visit the http://localhost:4200/tests URL you...",
      "post_number": 1,
      "topic_id": 32619
    },

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.

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

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants