yeraydiazdiaz / lunr.py

A Python implementation of Lunr.js 🌖
http://lunr.readthedocs.io
MIT License
188 stars 16 forks source link

How to export serialized indexes? #78

Closed chrisspen closed 4 years ago

chrisspen commented 4 years ago

In your README, you write, "Lunr.py provides a backend solution, allowing you to parse the documents ahead of time and create a Lunr.js compatible index you can pass have the browser version read, minimizing start up time of your application."

This is exactly what I'd like to do. However, aside from this brief mention, I can find no documentation on how to do this. There's a lot of great example on how to create indexes in Python, but it's unclear how to save or export these indexes for use elsewhere, like you describe.

Is serialization currently supported by lunr.py? If so, how do you export a serialized index suitable for loading into lunr.js?

kernc commented 4 years ago

Maybe Index.serialize()? https://github.com/yeraydiazdiaz/lunr.py/blob/89f067e1d9ae603f1a735c7c888c801561779199/lunr/index.py#L315-L332

chrisspen commented 4 years ago

Thanks. That's what I was looking for.

yeraydiazdiaz commented 4 years ago

Thanks for answering @kernc, opened https://github.com/yeraydiazdiaz/lunr.py/issues/82 to document the process.