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

Clarify the document type - flat vs. nested #13

Closed
dandv opened this issue Jun 3, 2024 · 2 comments
Closed

Clarify the document type - flat vs. nested #13

dandv opened this issue Jun 3, 2024 · 2 comments
Assignees
Labels
question Further information is requested testing Improvements or additions to test cases

Comments

@dandv
Copy link
Contributor

dandv commented Jun 3, 2024

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 nuric added the question Further information is requested label Jun 3, 2024
@nuric
Copy link
Collaborator

nuric commented Jun 3, 2024

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 nuric self-assigned this Jun 3, 2024
nuric added a commit that referenced this issue Jun 3, 2024
@nuric nuric added the testing Improvements or additions to test cases label Jun 3, 2024
@nuric
Copy link
Collaborator

nuric commented Jun 3, 2024

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.

@nuric nuric closed this as completed Jun 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested testing Improvements or additions to test cases
Projects
None yet
Development

No branches or pull requests

2 participants