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

Search Show Notes #2

Open
Southporter opened this issue May 17, 2022 · 7 comments
Open

Search Show Notes #2

Southporter opened this issue May 17, 2022 · 7 comments

Comments

@Southporter
Copy link

I want to get some feedback, but what do you think about adding a shoe notes search via bot. The community has notes.jupiterbroadcasting.com that already does some searching. Maybe we can hook into that to do lookups.

Possible command structures:
!search CoderRadio Crystal
!find LUP Manjaro
!search nebula vpn

The show hint part could be optional. Looks like the notes site searches all shows by default.

I'm planning on taking a stab at this when I have some time, but wanted to get some discussion going.

@xPMo
Copy link
Owner

xPMo commented May 17, 2022

Good thought! The search is a fancy dynamic thing which I don't want to deconstruct, it would be nice if search sharing was enabled and then we could generate that url and parse its output instead.

I don't know if there's a machine-consumable endpoint for mkdocs, I can't find one atm.

@Southporter
Copy link
Author

So looking into the mkdocs plugin, it looks like it does provide the search_index at https://notes.jupiterbroadcasting.com/search/search_index.json. That's a pretty bulky json, but we only need to fetch it once a week (the notes site is built every friday).
So no easy way to just query an endpoint, but we could build the index cache as part of the module.

I'll create a pr against the notes site to enable search sharing.

@xPMo
Copy link
Owner

xPMo commented May 17, 2022

One design paradigm Hemppa uses is that it stores as much state as possible in userdata on the server. Storing the whole search index would be wasteful; pushing it up to the server every time a state change happens locally is not good.

My first opinion for bot command and subcommands:

Using a local cache of the search_index.json:

  • !mkdocs add <name><url> ... sets the url to pull from for a given name.
  • !mkdocs pull <name> pulls the newest search_index for <name>. We can use !cron to pull notes regularly.
  • !mkdocs search <name> <search terms> does a search against the site <name>. Using the alias system, we can alias !jbnotes/ !notes or similar to !mkdocs search jbnotes

Note that I'm leaving it flexible enough so that we can support multiple sites. iirc, some of the hosts have public mkdocs instances that we might want to support, or there might be a few projects which are close to the community that we could support searchable docs.

@Southporter
Copy link
Author

Southporter commented May 18, 2022 via email

@xPMo
Copy link
Owner

xPMo commented May 18, 2022

To make sure we are on the same page, are you saying that we should store
the search index locally?

Yes. This is assuming we go with the "download the giant json and just search it" method.

Would we want to have some sort of TTL on the
index and automatically update it after x days?

The laziest approach is to have a command to manually do it, and then use the existing !cron module to update it regularly.

@Southporter
Copy link
Author

@xPMo I've got a PoC put together, what have you been doing to test? I saw your update to the Readme about the .env file. I guess I can create a private room and create a user for my testing, unless you have an easier route.

@xPMo
Copy link
Owner

xPMo commented May 24, 2022

I've been testing on prod so far, but we should change that. Check vranki/hemppa for more info on getting an access token.

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

No branches or pull requests

2 participants