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: personal sort with demo #174

Merged
merged 7 commits into from
Jun 21, 2024
Merged

feat: personal sort with demo #174

merged 7 commits into from
Jun 21, 2024

Conversation

alexgarel
Copy link
Member

A sort option for scripts + a demo in off.html

Part of: #172

Also fix a bug if sort_by is a script with minus in front,
and create a real personal sort script
and bettre display errors if storing scripts fails
@alexgarel alexgarel marked this pull request as ready for review June 20, 2024 11:36
@alexgarel alexgarel changed the title Feat: personal sort with demo feat: personal sort with demo Jun 20, 2024
Copy link
Collaborator

@Kout95 Kout95 left a comment

Choose a reason for hiding this comment

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

I have 2 bugs when i try to test sort by personal score :

  • first one can be solved : page_size: this.pageSize.toString(), pageSize can be undefined

  • second one, search return :
    { "debug": { "query": { "aggs": { "brands_tags": { "terms": { "field": "brands_tags" } }, "categories_tags": { "terms": { "field": "categories_tags" } }, "nutrition_grades": { "terms": { "field": "nutrition_grades" } }, "ecoscore_grade": { "terms": { "field": "ecoscore_grade" } } }, "sort": [ { "_script": { "type": "number", "script": { "id": "off__personal_score", "params": { "nutri_score": 1, "nova_group": 2, "eco_score": 0, "nova_to_score": [ 100, 100, 100, 75, 4 ], "grades_to_score": { "a": 100, "b": 75, "c": 50, "d": 25, "e": 0 } } }, "order": "desc" } } ], "size": 24, "from": 0 } }, "errors": [ { "title": "es_api_error", "description": "NotFoundError(404, 'search_phase_execution_exception', 'unable to find script [off__personal_score] in cluster state')" } ] }

@alexgarel
Copy link
Member Author

I have 2 bugs when i try to test sort by personal score :

* second one, search return :
  `{ "debug": { "query": { "aggs": { "brands_tags": { "terms": { "field": "brands_tags" } }, "categories_tags": { "terms": { "field": "categories_tags" } }, "nutrition_grades": { "terms": { "field": "nutrition_grades" } }, "ecoscore_grade": { "terms": { "field": "ecoscore_grade" } } }, "sort": [ { "_script": { "type": "number", "script": { "id": "off__personal_score", "params": { "nutri_score": 1, "nova_group": 2, "eco_score": 0, "nova_to_score": [ 100, 100, 100, 75, 4 ], "grades_to_score": { "a": 100, "b": 75, "c": 50, "d": 25, "e": 0 } } }, "order": "desc" } } ], "size": 24, "from": 0 } }, "errors": [ { "title": "es_api_error", "description": "NotFoundError(404, 'search_phase_execution_exception', 'unable to find script [off__personal_score] in cluster state')" } ] }`

You have to run

docker compose run --rm api python -m app sync-scripts

(BTW I should add it to the deploy action)

@alexgarel alexgarel merged commit 4484d51 into main Jun 21, 2024
6 checks passed
@alexgarel alexgarel deleted the feat-personal-sort-demo-2 branch June 21, 2024 15:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants