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

docs(realtime-perso): add new realtime-perso api #4613

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

benamib
Copy link

@benamib benamib commented Mar 17, 2025

🧭 What and Why

🎟 JIRA Ticket: https://algolia.atlassian.net/browse/PRED-3652

Changes included:

  • Add new API specs for Realtime Perso

TODO

  • Update Doc link

🧪 Test

@algolia-bot
Copy link
Collaborator

algolia-bot commented Mar 17, 2025

🪓 The generated code will be pushed at the end of the CI.

Action triggered by commit 33e6cb8baaa1208b8bee82ca78fd80921f60cd74.

Please do not push any generated code to this pull request.

@benamib benamib changed the title feat(realtime-perso): add new realtime-perso api docs(realtime-perso): add new realtime-perso api Mar 19, 2025
$ref: '#/searchFilters'

searchFilters:
type: object
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this allow us to store search configurations for multiple groups of indices, and have a dynamic name?

Example extracted from Francois' presentation:
Screenshot 2025-03-19 at 17 19 59

Not sure how we represent that in the spec though.

Copy link
Author

@benamib benamib Mar 20, 2025

Choose a reason for hiding this comment

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

The attribute additionalProperties allows us to tell the generator that the key of the object can be dynamic but that the format of the value should be of type searchFilters.

I'm not fond of this method but we don't have too much choice to respect the response we want.
We could still challenge the response format to replace the objects by arrays which would make the specs clearer imo like:

...
"search": [
	{ "aliases": "abc", "strategy": "def", "filters": {...} }
]
...

Copy link
Author

Choose a reason for hiding this comment

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

With the current specs the generated exemples looks like this :

{
  "version": "string",
  "userID": "string",
  "search": {
    "additionalProp1": {
      "indices": [
        "storefront",
        "storefront_price_asc",
        "storefront_price_desc"
      ],
      "strategy": "session",
      "filters": {
        "session": [
          "brand:Dyson<score=12>"
        ],
        "additionalProp1": {}
      },
      "additionalProp1": {}
    },
    "additionalProp2": {
      "indices": [
        "storefront",
        "storefront_price_asc",
        "storefront_price_desc"
      ],
      "strategy": "session",
      "filters": {
        "session": [
          "brand:Dyson<score=12>"
        ],
        "additionalProp1": {}
      },
      "additionalProp1": {}
    },
    "additionalProp3": {
      "indices": [
        "storefront",
        "storefront_price_asc",
        "storefront_price_desc"
      ],
      "strategy": "session",
      "filters": {
        "session": [
          "brand:Dyson<score=12>"
        ],
        "additionalProp1": {}
      },
      "additionalProp1": {}
    }
  },
  "additionalProp1": {}
}

Copy link
Contributor

Choose a reason for hiding this comment

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

I believe the reason for this structure was so that the FE could retrieve the required attributes as quick as possible (it's more time consuming to filter an array based on a key than it is to get a specific key from a map).

This looks good for now, but if it causes issues we can rethink it

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.

3 participants