Skip to content

feat: [FC-86] implement multivalue faceted search using Elasticsearch - #14

Closed
Serj-N wants to merge 15 commits into
nanai/axm-2532/discovery-apifrom
nanai/axm-2525/elastic
Closed

Serj-N wants to merge 15 commits into
nanai/axm-2532/discovery-apifrom
nanai/axm-2525/elastic

Conversation

@Serj-N

@Serj-N Serj-N commented Jul 16, 2025

Copy link
Copy Markdown

Implement multi-value faceted search for course discovery using Elasticsearch as a search engine.

Summary of changes:

  • Make modifications to the search engine layer to support both single- and multi-value search
  • Accept a flag from the api layer to determine the type of search being used
  • Add unit tests and integration tests

@Serj-N
Serj-N requested a review from NiedielnitsevIvan July 16, 2025 08:59
Comment thread search/elastic.py Outdated
return translated_result

def translate_agg_bucket(bucket, agg_result):
def translate_agg_bucket(facet_name, agg_result):

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Do we really need to change the parameter name?
Some OeX providers may have their own customizations using the old argument name. I agree that the new name gives a better understanding of what this variable is, but unless it is urgent, I would not change it.

@Serj-N Serj-N Jul 16, 2025 •

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Correct, I renamed it for clarity, to distinguish between facets and buckets. I changed it back as requested.

"""
Integration tests for Elasticsearch + /course_discovery/ endpoint
"""
def setUp(self):

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Please add a blank line between the doctring and the method, and please add docstrings to the tests, describing what is being tested.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Done.

ElasticSearch tests.
"""
@patch("search.elastic.Elasticsearch")
def test_multivalue_aggregations_translated_correctly(self, mock_elasticsearch_class):

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Ditto here.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Done.

Comment thread search/elastic.py Outdated
exclude_dictionary=None,
aggregation_terms=None,
exclude_ids=None,
sort_by=None,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Why are we adding this? We did not add sorting to MeilisearchEngine.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Apparently, it got through during cherry-picking or rebasing. Removed.

@Serj-N

Serj-N commented Jul 16, 2025

Copy link
Copy Markdown
Author

I am adding here the screenshots of test runs to confirm the test pass locally:
test_course_discovery_Elastic

test_course_discovery_views_Elastic test_engines_Elastic

@NiedielnitsevIvan
NiedielnitsevIvan force-pushed the nanai/axm-2532/discovery-api branch 2 times, most recently from 9acac1c to 344d511 Compare July 25, 2025 09:23
@Serj-N
Serj-N force-pushed the nanai/axm-2532/discovery-api branch 5 times, most recently from f5f7711 to d1ecf82 Compare September 18, 2025 12:20
@Serj-N
Serj-N force-pushed the nanai/axm-2532/discovery-api branch from 74739ab to db57f57 Compare October 2, 2025 12:42
@Serj-N

Serj-N commented Oct 15, 2025

Copy link
Copy Markdown
Author

Reopened in a PR covering both Meilisearch and Elasticsearch: openedx#213

@Serj-N Serj-N closed this Oct 15, 2025
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.

2 participants