Seunghan-Jung commented on code in PR #2697:
URL: https://github.com/apache/solr/pull/2697#discussion_r1779548037


##########
solr/core/src/java/org/apache/solr/highlight/UnifiedSolrHighlighter.java:
##########
@@ -314,6 +343,26 @@ protected PassageFormatter getFormatter(String fieldName) {
       return new DefaultPassageFormatter(preTag, postTag, ellipsis, 
"html".equals(encoder));
     }
 
+    @Override
+    protected Comparator<Passage> getPassageSortComparator(String fieldName) {
+      String value = params.get(HighlightParams.PASSAGE_SORT, 
PassageSort.START_OFFSET.key);
+
+      PassageSort passageSort = PassageSort.parse(value);
+
+      switch (passageSort) {
+        case START_OFFSET:
+          return Comparator.comparingInt(Passage::getStartOffset);

Review Comment:
   ```suggestion
         switch (passageSort) {
           case "startOffset:
             return Comparator.comparingInt(Passage::getStartOffset);
   ```
   
   Is this the direction you were aiming for? Are you suggesting that we avoid 
creating unnecessary enum class and use string literals instead?



-- 
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.

To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org
For additional commands, e-mail: issues-h...@solr.apache.org

Reply via email to