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

Enhance Ditto search to be able to query for equality of JsonObjects + JsonArrays #1804

Open
thjaeckle opened this issue Nov 11, 2023 · 5 comments

Comments

@thjaeckle
Copy link
Member

thjaeckle commented Nov 11, 2023

Currently, it is only possible to query e.g. for eq using scalar Json values, like Json String, Number, Boolean.

It would also be very useful to e.g. query for equality of full Json Objects, e.g. like:

eq(attributes/location,{"longitude":23.12313,"latitude":52.23123})

Also helpful would e.g. be the search for empty JsonObjects or JsonArrays, e.g.:

eq(attributes/errors,[])

ne(attributes/location,{})

Predicates which could support this:

  • eq
  • ne
  • in ?
@Abhijeetmishr
Copy link
Contributor

Hi @thjaeckle can I work on this ?

@thjaeckle
Copy link
Member Author

@Abhijeetmishr sure, that would be great. You already collected some experience enhancing the RQL with ilike, right?

@Abhijeetmishr
Copy link
Contributor

@Abhijeetmishr sure, that would be great. You already collected some experience enhancing the RQL with ilike, right?

@thjaeckle Yes Thomas you are right.
I will be sharing my approach soon with you.

@Abhijeetmishr
Copy link
Contributor

Hi @thjaeckle Thomas,
Basically we wanted all the predicates to accept JsonObject and Arrays inplace of JsonValue.
image

But I wanted to understand the whole code flow before jumping to the implementation part how can I test it ?

@thjaeckle
Copy link
Member Author

@Abhijeetmishr no, not all predicates .. as mentioned in the description this only makes sense for:

Predicates which could support this:

  • eq
  • ne
  • in ?

You cannot compare if a JsonObject is "greater than" another JsonObject in a meaningful way.

How to test?
E.g. via ThingPredicatePredicateVisitorTest for the Java based predicate evaluation.
For the Mongo BSON based ones, the SearchActorIT is probably the unit test of choice to e.g. enhance then..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants