chromem-go icon indicating copy to clipboard operation
chromem-go copied to clipboard

feat: WhereDocument filter with $and, $or, $contains and $not_contains filters

Open iwilltry42 opened this issue 1 year ago • 2 comments

Top-Level WhereDocument structs are ANDed. A WhereDocument can be a singular operator like $contains or $not_contains, which require a Value to be set. $or and $and require nested WhereDocuments

I'm sure this could be done without a struct and using some map[string]any and reflect logic, but this feels cleaner, though breaking.

Let me know what you think!

iwilltry42 avatar Aug 14 '24 13:08 iwilltry42

Happy to surprise you 😅

I actually would vote against using a JSON string as a function parameter - I feel like accepting such is more on the user interface's side, e.g. in a CLI or whatever UI. As a library/module I think it should use proper types. Though we could provide a QueryJSON (I'm bad at naming) func that implements your suggestion.

But that's all up to you :)

FWIW I'm not sure about the Value and WhereDocuments fields - we could use any and accept either there to reduce it to a single field. That would be more abstract.

iwilltry42 avatar Aug 19 '24 06:08 iwilltry42

Sorry for the late response! The breaking change was holding me back from merging because all other changes since the last release were without breaking changes. And for releasing a version before merging, the decision regarding the Vertex options passing held me back. :grimacing:

Both are done now, so I'm open to some breaking changes (not only from this PR but also other changes) in the next release.


Having a separate method for passing the query as JSON is a good idea :+1:. I'll look into adding that as soon as this one is merged. Regarding the Value and WhereDocuments as any I'll think a bit about it.

philippgille avatar Sep 01 '24 17:09 philippgille