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

improve document docs #2359

Merged
merged 1 commit into from
Apr 22, 2024
Merged

improve document docs #2359

merged 1 commit into from
Apr 22, 2024

Conversation

PSeitz
Copy link
Contributor

@PSeitz PSeitz commented Apr 15, 2024

No description provided.

Comment on lines -17 to +21
//! - `BTreeMap<Field, Value>` a mapping of field_ids to their relevant schema value using a
//! - `BTreeMap<Field, OwnedValue>` a mapping of field_ids to their relevant schema value using a
//! BTreeMap.
//! - `HashMap<Field, Value>` a mapping of field_ids to their relevant schema value using a HashMap.
//! - `HashMap<Field, OwnedValue>` a mapping of field_ids to their relevant schema value using a
//! HashMap.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be helpful to explain what these bring to the table, i.e. how the three built-in options compare, e.g. BTreeMap provides associative access but ordered where HashMap has faster associative access, but neither supports multiple values per field if I understand this correctly.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, not sure why we have that actually. Seems too niche

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wrote the original doc originally IIRC, but the motive for the impl was because a lot of people have situations where they have single-value fields and just want to deserialize and serialize the data to and from JSON as is without needing to convert the by-default multi-value fields into single-value fields. So this was a utility for that.

@adamreichold
Copy link
Collaborator

One other question I had while trying to migrate my code base to this and which I think would be nice to clarify in the docs: Can I rely on DocumentDeserialize visiting my fields in the same order they were serialize into the document store?

If I cannot match field positionally between serialization and deserialization, I would need access to the relevant Field values when deserializing a structure field by field, i.e. something like DeserializeSeed to pass in a collection of Field values.

@PSeitz
Copy link
Contributor Author

PSeitz commented Apr 15, 2024

One other question I had while trying to migrate my code base to this and which I think would be nice to clarify in the docs: Can I rely on DocumentDeserialize visiting my fields in the same order they were serialize into the document store?

If I cannot match field positionally between serialization and deserialization, I would need access to the relevant Field values when deserializing a structure field by field, i.e. something like DeserializeSeed to pass in a collection of Field values.

From the API contract there is no such guarantee, e.g. we may choose whatever is better compressible in the future.

@adamreichold
Copy link
Collaborator

From the API contract there is no such guarantee, e.g. we may choose whatever is better compressible in the future.

But then we need to extend the API with a seed as otherwise, I do not see how I can deserialize the compile-time fields of struct without knowing their runtime field ID.

@adamreichold
Copy link
Collaborator

From the API contract there is no such guarantee, e.g. we may choose whatever is better compressible in the future.

But then we need to extend the API with a seed as otherwise, I do not see how I can deserialize the compile-time fields of struct without knowing their runtime field ID.

#2362 should provide what is required pass the runtime field ID to a deserialize implementation.

@PSeitz PSeitz merged commit 4f8493d into main Apr 22, 2024
4 checks passed
@PSeitz PSeitz deleted the improve_docs branch April 22, 2024 10:05
philippemnoel pushed a commit to paradedb/tantivy that referenced this pull request Aug 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants