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

feat(java): browse objects/synonyms/rules #952

Merged
merged 3 commits into from
Aug 25, 2022
Merged

feat(java): browse objects/synonyms/rules #952

merged 3 commits into from
Aug 25, 2022

Conversation

millotp
Copy link
Collaborator

@millotp millotp commented Aug 24, 2022

🧭 What and Why

🎟 JIRA Ticket: APIC-616

Implement browse for object/synonyms/rules.

They are meant to be used with for loop like:

Iterable<Actor> browse = client.browseObjects(indexName, new BrowseParamsObject(), Actor.class);
for(Actor actor : browse) {
  System.out.println(actor.name);
}

Changes included:

  • Not sure if the doc is outdated or the query was wrong but _highlightResult only contains "synonym" and never the expected object, so we decided to remove it from the spec.
  • Move the helpers to it's own mustache file

🧪 Test

Playground with the snippet above

@millotp millotp self-assigned this Aug 24, 2022
@millotp millotp marked this pull request as draft August 24, 2022 14:50
@netlify
Copy link

netlify bot commented Aug 24, 2022

Deploy Preview for api-clients-automation canceled.

Name Link
🔨 Latest commit 11a306e
🔍 Latest deploy log https://app.netlify.com/sites/api-clients-automation/deploys/6307879fd770d70008022f83

@algolia-bot
Copy link
Collaborator

algolia-bot commented Aug 24, 2022

✗ The generated branch has been deleted.

If the PR has been merged, you can check the generated code on the main branch.
You can still access the code generated on main via this commit.

@@ -39,17 +39,6 @@ synonymHit:
items:
type: string
description: List of query words that will match the token.
_highlightResult:
Copy link
Member

Choose a reason for hiding this comment

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

shouldn't it still be there but a string?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'm afraid in some case it can be the object, as defined here and in that case it would be a mess.
I'm not sure what's best

Copy link
Member

Choose a reason for hiding this comment

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

Maybe worth to go with what we know for now and assume that it can be an enum "synonym" or a free form object?

It should be enough until we have a proper use case to investigate, wdyt?

Copy link
Member

Choose a reason for hiding this comment

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

Would it still be valid once the Java unknown parameter validation is removed?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

FAIL_ON_UNKNOWN_PROPERTIES is already disabled for the client, but it will still fail when trying to deserialize a known property, maybe I could return null instead of throwing but then it's misleading.
Are you sure this property is ever used for synonym ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

for rules we have the same issue, it's listed in the doc but not in our spec

Copy link
Member

@shortcuts shortcuts Aug 25, 2022

Choose a reason for hiding this comment

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

In the JS client, browseRules and browseSynonyms both delete the _highlightResult key for each responses, but not in the searchRules and searchSynonyms methods. I'd be fine keeping the same logic until we have some context

maybe @Haroenv (off) @francoischalifour (?) knows more about those?

Copy link
Member

Choose a reason for hiding this comment

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

I don't know, but I would guess that we prefer having consistent keys when using search endpoints to facilitate the data flow in the consumers.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

from usage it seems like _highlightResult is pretty random (example) so we remove it for now

@millotp millotp marked this pull request as ready for review August 24, 2022 16:29
@millotp millotp requested a review from damcou August 24, 2022 16:29
Copy link
Member

@shortcuts shortcuts left a comment

Choose a reason for hiding this comment

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

good!

@millotp millotp enabled auto-merge (squash) August 25, 2022 14:32
@millotp millotp merged commit 68ff7ee into main Aug 25, 2022
@millotp millotp deleted the feat/browse-java branch August 25, 2022 15:27
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