Semafind / semadb

No fuss multi-index hybrid vector database / search engine
https://semadb.com/
Apache License 2.0
9 stars 2 forks source link

Clarify the document type - flat vs. nested #13

Closed dandv closed 3 months ago

dandv commented 3 months ago

https://semadb.com/docs/concepts/point/ states

A point can have any number of fields and the fields can be of any type.

Can a field be an object, i.e. are nested documents supported?

nuric commented 3 months ago

Nested documents are supported, SemaDB just serialises any unindexed fields as is. So it shouldn't be a problem to put a nested document.

The questions is, can you index nested fields? To be honest, we didn't have this use case and when implementing I thought we could but never tested it. I would like to say yes, as in "myfield.nestedvector" with dot notation could work but I refrained from adding to the documentation due to lack of tests.

The indexing and select field of queries both use decoder.Query from the message pack library which supports the dot notation for nested fields.

nuric commented 3 months ago

It does work with dot notation myfield.nestedfield and I added some test cases to cover this. The index schema should now correctly process nested fields; for example if there is a vector inside a nested document following the same notation.

I updated the documentation to give some examples. Hopefully others can follow through.

We'll monitor this and fold into the next beta release. I'll close the issue soonafter.