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

Text queries with text score support #84

Open
Turnerj opened this issue Jul 8, 2019 · 1 comment
Open

Text queries with text score support #84

Turnerj opened this issue Jul 8, 2019 · 1 comment
Labels
affects-querying Query-related issue enhancement Enhancements & features moderate-change Moderate changes required
Milestone

Comments

@Turnerj
Copy link
Member

Turnerj commented Jul 8, 2019

With the recent addition of text indexes and queries in #82 , there was one part I missed that I did not realise - text queries actually have a text score associated to them. This text score is useful for sorting and even filtering.

Sorting: https://docs.mongodb.com/manual/tutorial/text-search-in-aggregation/#return-results-sorted-by-text-search-score
Filtering: https://docs.mongodb.com/manual/tutorial/text-search-in-aggregation/#match-on-text-score

Sorting wouldn't be terribly hard to add. It would mean changing the text query to act more like SearchGeoNear and use raw stages. That is would require more than one (one for the search, one for the sort), would mean MongoFrameworkQueryProvider needs to support multiple stages.

Filtering is just another stage on top BUT to get a filter to work requires the projection of the score in its own stage. Now while this is possible, projecting requires noting every single field you want in every subsequent stage. For filtering, I'm really just wanting to add a single additional field rather than change/remove other fields. I could use the entity mapping in MongoFramework but then all "extra fields" in the DB would be ignored in a projection.

@Turnerj Turnerj added the enhancement Enhancements & features label Jul 8, 2019
@Turnerj Turnerj added this to the 1.0.0 milestone Jul 9, 2019
@Turnerj Turnerj added affects-querying Query-related issue moderate-change Moderate changes required labels Jul 9, 2019
@Turnerj
Copy link
Member Author

Turnerj commented May 19, 2020

This would likely be easier to implement once #112 lands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-querying Query-related issue enhancement Enhancements & features moderate-change Moderate changes required
Projects
None yet
Development

No branches or pull requests

1 participant