Code Monkey home page Code Monkey logo

Comments (7)

xPMo avatar xPMo commented on July 30, 2024

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.

from hemppa-bot.

Southporter avatar Southporter commented on July 30, 2024

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.

from hemppa-bot.

xPMo avatar xPMo commented on July 30, 2024

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.

from hemppa-bot.

Southporter avatar Southporter commented on July 30, 2024

from hemppa-bot.

xPMo avatar xPMo commented on July 30, 2024

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.

from hemppa-bot.

Southporter avatar Southporter commented on July 30, 2024

@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.

from hemppa-bot.

xPMo avatar xPMo commented on July 30, 2024

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

from hemppa-bot.

Related Issues (3)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.