Add `collection.effective_ancestors` to model search results (#41746)
* Add `collection.effective_ancestors` to search Fixes #41909 The ultimate goal here is to be able to display a UI that showed the entire (effective) path to each collection. This was a bit more painful than I'd hoped. The primary issue is that we tied two things together: - scoring results - "serializing" results (really, partially serializing results, because we do more work to shape the data later) Why is this a problem? The `top-scorers` function took a transducer and returned the *serialized* top scorers. Later, when we need to operate on *all* the top results (in this case, to collect all the collection IDs and names that we know of), we're looking at the serialized results. In our case, we needed some data (collection location) that wasn't included after serialization. We could add it, of course, but it's frustrating to need to change the API of what data is *returned* from the endpoint for purely internal purposes (changing the data available during *processing*). I ended up pulling serialization out of the scoring function. At some point down the road, we should go ahead and move the `serialize` function out of the `search.scoring` namespace entirely - there's really no reason for it to belong there as far as I can tell.
Showing
- src/metabase/api/search.clj 54 additions, 5 deletionssrc/metabase/api/search.clj
- src/metabase/search/config.clj 3 additions, 0 deletionssrc/metabase/search/config.clj
- src/metabase/search/scoring.clj 16 additions, 10 deletionssrc/metabase/search/scoring.clj
- test/metabase/api/search_test.clj 45 additions, 1 deletiontest/metabase/api/search_test.clj
- test/metabase/search/filter_test.clj 1 addition, 0 deletionstest/metabase/search/filter_test.clj
- test/metabase/search/scoring_test.clj 6 additions, 4 deletionstest/metabase/search/scoring_test.clj
Loading
Please register or sign in to comment