You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@solr.apache.org by GitBox <gi...@apache.org> on 2021/09/28 18:39:58 UTC

[GitHub] [solr] janhoy commented on a change in pull request #313: SOLR-13681: make Lucene's index sorting directly configurable in Solr

janhoy commented on a change in pull request #313:
URL: https://github.com/apache/solr/pull/313#discussion_r717856962



##########
File path: solr/core/src/java/org/apache/solr/update/SolrIndexConfig.java
##########
@@ -261,9 +269,19 @@ public IndexWriterConfig toIndexWriterConfig(SolrCore core) throws IOException {
     iwc.setMergeScheduler(mergeScheduler);
     iwc.setInfoStream(infoStream);
 
+    if (indexSort != null) {
+      SortSpec indexSortSpec = SortSpecParsing.parseSortSpec(indexSort, schema);
+      iwc.setIndexSort(indexSortSpec.getSort());
+    }
+
     if (mergePolicy instanceof SortingMergePolicy) {
-      Sort indexSort = ((SortingMergePolicy) mergePolicy).getSort();
-      iwc.setIndexSort(indexSort);
+      Sort mergeSort = ((SortingMergePolicy) mergePolicy).getSort();
+      Sort indexSort = iwc.getIndexSort();
+      if (indexSort != null && !indexSort.equals(mergeSort)) {
+        log.warn("indexSort={} differs from mergePolicySort={}", indexSort, mergeSort);

Review comment:
       Perhaps clarify that `indexSort` is the one picked?

##########
File path: solr/core/src/test/org/apache/solr/update/SolrIndexConfigTest.java
##########
@@ -146,6 +146,7 @@ public void testSortingMPSolrIndexConfigCreation() throws Exception {
     final Sort expected = new Sort(new SortField(expectedFieldName, expectedFieldType, expectedFieldSortDescending));
     final Sort actual = sortingMergePolicy.getSort();
     assertEquals("SortingMergePolicy.getSort", expected, actual);
+    assertEquals("indexSort", expected, iwc.getIndexSort());

Review comment:
       Let's create a new test method for the new config option, which will survive removal of SMP. Instead of creating yet another solrconfig-xyz.xml I think it should be possible to let the test invoke config-api to set the new setting.




-- 
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-unsubscribe@solr.apache.org

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



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