-
Notifications
You must be signed in to change notification settings - Fork 701
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
SOLR-13681: make Lucene's index sorting directly configurable in Solr #313
base: main
Are you sure you want to change the base?
Changes from 10 commits
b37f45c
564a66d
bc39779
e8ecd26
7514d34
8171b27
33a722e
2247d79
1478be7
14b8c49
7feca02
736a75b
3920768
97b1206
f0889c0
0fd2c9f
eae8527
94190d5
eee971c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<?xml version="1.0" ?> | ||
|
||
<!-- | ||
Licensed to the Apache Software Foundation (ASF) under one or more | ||
contributor license agreements. See the NOTICE file distributed with | ||
this work for additional information regarding copyright ownership. | ||
The ASF licenses this file to You under the Apache License, Version 2.0 | ||
(the "License"); you may not use this file except in compliance with | ||
the License. You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
--> | ||
|
||
<config> | ||
<luceneMatchVersion>${tests.luceneMatchVersion:LATEST}</luceneMatchVersion> | ||
<directoryFactory name="DirectoryFactory" class="${solr.directoryFactory:solr.RAMDirectoryFactory}"/> | ||
<schemaFactory class="ClassicIndexSchemaFactory"/> | ||
|
||
<indexConfig> | ||
<lockType>${solr.tests.lockType:single}</lockType> | ||
<indexSort>timestamp_i_dvo desc</indexSort> | ||
</indexConfig> | ||
|
||
<requestHandler name="/select" class="solr.SearchHandler" /> | ||
|
||
<updateHandler class="solr.DirectUpdateHandler2"> | ||
<updateLog> | ||
<str name="dir">${solr.ulog.dir:}</str> | ||
</updateLog> | ||
|
||
<autoCommit> | ||
<maxTime>${solr.autoCommit.maxTime:-1}</maxTime> | ||
<openSearcher>false</openSearcher> | ||
</autoCommit> | ||
|
||
<autoSoftCommit> | ||
<maxTime>${solr.autoSoftCommit.maxTime:-1}</maxTime> | ||
</autoSoftCommit> | ||
</updateHandler> | ||
<initParams path="/select"> | ||
<lst name="defaults"> | ||
<str name="df">text</str> | ||
</lst> | ||
</initParams> | ||
|
||
</config> |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,6 +52,7 @@ public class SolrIndexConfigTest extends SolrTestCaseJ4 { | |
private static final String solrConfigFileNameTieredMergePolicyFactory = "solrconfig-tieredmergepolicyfactory.xml"; | ||
private static final String solrConfigFileNameConnMSPolicyFactory = "solrconfig-concurrentmergescheduler.xml"; | ||
private static final String solrConfigFileNameSortingMergePolicyFactory = "solrconfig-sortingmergepolicyfactory.xml"; | ||
private static final String solrConfigFileNameIndexSort = "solrconfig-indexSort.xml"; | ||
private static final String schemaFileName = "schema.xml"; | ||
|
||
@BeforeClass | ||
|
@@ -146,6 +147,24 @@ 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()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 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. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, I would also favour not creating yet another solrconfig-xyz.xml file. Have used the config-api in tests before but from my research done so far it seems There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also interestingly V2 'get' works but V1 does not, for
https://solr.apache.org/guide/8_10/config-api.html#retrieving-the-config lists
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, perhaps they are R/O because it is not supported to change these after collection creation? Are you planning to validate that index sorting is working in the test, or simply that the config is set? I think perhaps a new method in the existing IndexConfig test would be enough? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, and perhaps changing some Added a new method, modelled on the existing sorting-merge-policy one that will go away with sorting merge policy. There is existing |
||
} | ||
|
||
public void testIndexSortSolrIndexConfigCreation() throws Exception { | ||
final String expectedFieldName = "timestamp_i_dvo"; | ||
final SortField.Type expectedFieldType = SortField.Type.INT; | ||
final boolean expectedFieldSortDescending = true; | ||
|
||
SolrConfig solrConfig = new SolrConfig(instanceDir, solrConfigFileNameIndexSort); | ||
SolrIndexConfig solrIndexConfig = new SolrIndexConfig(solrConfig, null, null); | ||
assertNotNull(solrIndexConfig); | ||
IndexSchema indexSchema = IndexSchemaFactory.buildIndexSchema(schemaFileName, solrConfig); | ||
|
||
h.getCore().setLatestSchema(indexSchema); | ||
IndexWriterConfig iwc = solrIndexConfig.toIndexWriterConfig(h.getCore()); | ||
|
||
final Sort expected = new Sort(new SortField(expectedFieldName, expectedFieldType, expectedFieldSortDescending)); | ||
assertEquals("indexSort", expected, iwc.getIndexSort()); | ||
} | ||
|
||
public void testMergedSegmentWarmerIndexConfigCreation() throws Exception { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://issues.apache.org/jira/browse/SOLR-15390 is about deprecating the
segmentTerminateEarly
flag.