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

Add support to access search response fields #185

Merged
merged 3 commits into from
Apr 27, 2023

Conversation

markaya
Copy link
Contributor

@markaya markaya commented Apr 25, 2023

Summary:

  • Added full response to SearchResult class so we can support accessing different fields from response. (should discuss further)
  • Added sort field to Item so we can access sort field of each individual document returned

lazy val results: List[Json] = hits.hits.map(_.source)

lazy val resultsWithHighlights: List[(Json, Option[Json])] = hits.hits.map(h => (h.source, h.highlight))
lazy val resultsWithHighlightsAndSort: List[(Json, Option[Json], Option[Json])] =
Copy link
Collaborator

Choose a reason for hiding this comment

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

We should think about a dedicated type for the tuple (Json, Option[Json], Option[Json]) so we wouldn't need to communicate the meaning of each element through a complicated value name.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes definetly. It would be much easier to understand if we had case class for this. I will implement it, just not sure about naming of such class.

@drmarjanovic drmarjanovic merged commit 1fe1f83 into main Apr 27, 2023
@drmarjanovic drmarjanovic deleted the task-support-accessing-search-response-fields branch April 27, 2023 09:03
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