cozydev-pink / protosearch

prototype search library in pure scala
https://cozydev-pink.github.io/protosearch/
Apache License 2.0
9 stars 5 forks source link

Add initial support for storing fields #159

Closed valencik closed 8 months ago

valencik commented 8 months ago

This PR lets us store fields in the index so we can ship a single file and have it be usable in a frontend application.

We add initial support for storing String fields directly in the MultiIndex. The fields are stored in a Map[String, Array[String]] where the map keys are the field names, and the Arrays are all the field values. This means they're sort of stored in a columnar fashion.

A new search method, searchMap is added which returns a (Int, Map[String, String]) for each resulting document. Where the Int is the doc ID, and the Map[String, String] is all the fields for that document. This interface isn't great but it feels "good enough for now".

JsInterop has been updated to leverage this and some tweaks to the UI have been made: Screenshot 2023-12-27 at 09-58-07 JS Interop Search

Resolves https://github.com/cozydev-pink/protosearch/issues/154