dsmiley commented on a change in pull request #780: SOLR-11866: Support
efficient subset matching in query elevation rules
URL: https://github.com/apache/lucene-solr/pull/780#discussion_r303720194
##########
File path:
solr/core/src/java/org/apache/solr/handler/component/QueryElevationComponent.java
##########
@@ -834,48 +850,77 @@ public int size() {
};
/**
- * Simple query exact match {@link ElevationProvider}.
- * <p>
- * It does not support subset matching (see {@link
#parseMatchPolicy(String)}).
- * <p>
- * Immutable.
+ * Provides elevations with either:
+ * <ul>
+ * <li><b>subset match</b> - all the elevating terms are matched in the
search query, in any order.</li>
+ * <li><b>exact match</b> - the elevating query matches fully (all terms in
same order) the search query.</li>
+ * </ul>
+ * The terms are tokenized with the query analyzer.
*/
- @SuppressWarnings("WeakerAccess")
- protected class MapElevationProvider implements ElevationProvider {
+ protected class SubsetMatchElevationProvider implements ElevationProvider {
- private final Map<String, Elevation> elevationMap;
+ private final SubsetMatcher<String, Elevation> subsetMatcher;
+ private final Map<String, Elevation> exactMatchElevationMap;
- public MapElevationProvider(Map<ElevatingQuery, ElevationBuilder>
elevationBuilderMap) {
- elevationMap = buildElevationMap(elevationBuilderMap);
- }
-
- private Map<String, Elevation> buildElevationMap(Map<ElevatingQuery,
ElevationBuilder> elevationBuilderMap) {
- Map<String, Elevation> elevationMap =
Maps.newHashMapWithExpectedSize(elevationBuilderMap.size());
+ /**
+ * @param subsetMatcherBuilder The {@link SubsetMatcher.Builder} to build
the {@link SubsetMatcher}.
+ * @param elevationBuilderMap The map of elevation rules.
+ */
+ protected SubsetMatchElevationProvider(SubsetMatcher.Builder<String,
Elevation> subsetMatcherBuilder,
Review comment:
This is the only ElevationProvider that Solr provides. So I think we should
just call it DefaultElevationProvider. By using the name
SubsetMatchElevationProvider it suggests it only does this when it does exact
as well. It's not like there are separate impls.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]