Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions changelog/unreleased/SOLR-12074-numeric-field-terms.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# See https://github.com/apache/solr/blob/main/dev-docs/changelog.adoc
title: Add new NumericField that indexes both terms and numeric Point values, to speed up term lookup and close functionality gap with Trie fields.
type: added # added, changed, fixed, deprecated, removed, dependency_update, security, other
authors:
- name: Houston Putman
nick: HoustonPutman
url: https://home.apache.org/phonebook.html?uid=houston
links:
- name: SOLR-12074
url: https://issues.apache.org/jira/browse/SOLR-12074
- name: SOLR-18017
url: https://issues.apache.org/jira/browse/SOLR-18017
156 changes: 140 additions & 16 deletions solr/benchmark/src/java/org/apache/solr/bench/search/NumericSearch.java
Original file line number Diff line number Diff line change
Expand Up @@ -147,20 +147,24 @@ public void setupIteration(MiniClusterState.MiniClusterBenchState miniClusterSta
miniClusterState.client.requestWithBaseUrl(miniClusterState.nodes.get(0), reload, null);
}

public QueryRequest intSetQuery(boolean dvs) {
return setQuery("numbers_i" + (dvs ? "_dv" : ""));
public QueryRequest intTrieSetQuery(boolean dvs, boolean enhancedIndex) {
return setQuery("numbers_it" + (dvs ? "_dv" : ""));
}

public QueryRequest longSetQuery(boolean dvs) {
return setQuery("numbers_l" + (dvs ? "_dv" : ""));
public QueryRequest intSetQuery(boolean dvs, boolean enhancedIndex) {
return setQuery("numbers_i" + (dvs ? "_dv" : "") + (enhancedIndex ? "_e" : ""));
}

public QueryRequest doubleSetQuery(boolean dvs) {
return setQuery("numbers_d" + (dvs ? "_dv" : ""));
public QueryRequest longSetQuery(boolean dvs, boolean enhancedIndex) {
return setQuery("numbers_l" + (dvs ? "_dv" : "") + (enhancedIndex ? "_e" : ""));
}

public QueryRequest floatSetQuery(boolean dvs) {
return setQuery("numbers_f" + (dvs ? "_dv" : ""));
public QueryRequest doubleSetQuery(boolean dvs, boolean enhancedIndex) {
return setQuery("numbers_d" + (dvs ? "_dv" : "") + (enhancedIndex ? "_e" : ""));
}

public QueryRequest floatSetQuery(boolean dvs, boolean enhancedIndex) {
return setQuery("numbers_f" + (dvs ? "_dv" : "") + (enhancedIndex ? "_e" : ""));
}

QueryRequest setQuery(String field) {
Expand All @@ -175,14 +179,38 @@ QueryRequest setQuery(String field) {
}
}

@Benchmark
public Object intTrieSet(
Blackhole blackhole,
BenchState benchState,
MiniClusterState.MiniClusterBenchState miniClusterState)
throws SolrServerException, IOException {
QueryResponse response =
benchState.intTrieSetQuery(false, false).process(miniClusterState.client, COLLECTION);
blackhole.consume(response);
return response;
}

@Benchmark
public Object intTrieDvSet(
Blackhole blackhole,
BenchState benchState,
MiniClusterState.MiniClusterBenchState miniClusterState)
throws SolrServerException, IOException {
QueryResponse response =
benchState.intTrieSetQuery(false, false).process(miniClusterState.client, COLLECTION);
blackhole.consume(response);
return response;
}

@Benchmark
public Object intSet(
Blackhole blackhole,
BenchState benchState,
MiniClusterState.MiniClusterBenchState miniClusterState)
throws SolrServerException, IOException {
QueryResponse response =
benchState.intSetQuery(false).process(miniClusterState.client, COLLECTION);
benchState.intSetQuery(false, false).process(miniClusterState.client, COLLECTION);
blackhole.consume(response);
return response;
}
Expand All @@ -194,7 +222,7 @@ public Object longSet(
MiniClusterState.MiniClusterBenchState miniClusterState)
throws SolrServerException, IOException {
QueryResponse response =
benchState.longSetQuery(false).process(miniClusterState.client, COLLECTION);
benchState.longSetQuery(false, false).process(miniClusterState.client, COLLECTION);
blackhole.consume(response);
return response;
}
Expand All @@ -206,7 +234,7 @@ public Object floatSet(
MiniClusterState.MiniClusterBenchState miniClusterState)
throws SolrServerException, IOException {
QueryResponse response =
benchState.floatSetQuery(false).process(miniClusterState.client, COLLECTION);
benchState.floatSetQuery(false, false).process(miniClusterState.client, COLLECTION);
blackhole.consume(response);
return response;
}
Expand All @@ -218,7 +246,7 @@ public Object doubleSet(
MiniClusterState.MiniClusterBenchState miniClusterState)
throws SolrServerException, IOException {
QueryResponse response =
benchState.doubleSetQuery(false).process(miniClusterState.client, COLLECTION);
benchState.doubleSetQuery(false, false).process(miniClusterState.client, COLLECTION);
blackhole.consume(response);
return response;
}
Expand All @@ -230,7 +258,7 @@ public Object intDvSet(
MiniClusterState.MiniClusterBenchState miniClusterState)
throws SolrServerException, IOException {
QueryResponse response =
benchState.intSetQuery(true).process(miniClusterState.client, COLLECTION);
benchState.intSetQuery(true, false).process(miniClusterState.client, COLLECTION);
blackhole.consume(response);
return response;
}
Expand All @@ -242,7 +270,7 @@ public Object longDvSet(
MiniClusterState.MiniClusterBenchState miniClusterState)
throws SolrServerException, IOException {
QueryResponse response =
benchState.longSetQuery(true).process(miniClusterState.client, COLLECTION);
benchState.longSetQuery(true, false).process(miniClusterState.client, COLLECTION);
blackhole.consume(response);
return response;
}
Expand All @@ -254,7 +282,7 @@ public Object floatDvSet(
MiniClusterState.MiniClusterBenchState miniClusterState)
throws SolrServerException, IOException {
QueryResponse response =
benchState.floatSetQuery(true).process(miniClusterState.client, COLLECTION);
benchState.floatSetQuery(true, false).process(miniClusterState.client, COLLECTION);
blackhole.consume(response);
return response;
}
Expand All @@ -266,7 +294,103 @@ public Object doubleDvSet(
MiniClusterState.MiniClusterBenchState miniClusterState)
throws SolrServerException, IOException {
QueryResponse response =
benchState.doubleSetQuery(true).process(miniClusterState.client, COLLECTION);
benchState.doubleSetQuery(true, false).process(miniClusterState.client, COLLECTION);
blackhole.consume(response);
return response;
}

@Benchmark
public Object intEnhancedSet(
Blackhole blackhole,
BenchState benchState,
MiniClusterState.MiniClusterBenchState miniClusterState)
throws SolrServerException, IOException {
QueryResponse response =
benchState.intSetQuery(false, true).process(miniClusterState.client, COLLECTION);
blackhole.consume(response);
return response;
}

@Benchmark
public Object longEnhancedSet(
Blackhole blackhole,
BenchState benchState,
MiniClusterState.MiniClusterBenchState miniClusterState)
throws SolrServerException, IOException {
QueryResponse response =
benchState.longSetQuery(false, true).process(miniClusterState.client, COLLECTION);
blackhole.consume(response);
return response;
}

@Benchmark
public Object floatEnhancedSet(
Blackhole blackhole,
BenchState benchState,
MiniClusterState.MiniClusterBenchState miniClusterState)
throws SolrServerException, IOException {
QueryResponse response =
benchState.floatSetQuery(false, true).process(miniClusterState.client, COLLECTION);
blackhole.consume(response);
return response;
}

@Benchmark
public Object doubleEnhancedSet(
Blackhole blackhole,
BenchState benchState,
MiniClusterState.MiniClusterBenchState miniClusterState)
throws SolrServerException, IOException {
QueryResponse response =
benchState.doubleSetQuery(false, true).process(miniClusterState.client, COLLECTION);
blackhole.consume(response);
return response;
}

@Benchmark
public Object intDvEnhancedSet(
Blackhole blackhole,
BenchState benchState,
MiniClusterState.MiniClusterBenchState miniClusterState)
throws SolrServerException, IOException {
QueryResponse response =
benchState.intSetQuery(true, true).process(miniClusterState.client, COLLECTION);
blackhole.consume(response);
return response;
}

@Benchmark
public Object longDvEnhancedSet(
Blackhole blackhole,
BenchState benchState,
MiniClusterState.MiniClusterBenchState miniClusterState)
throws SolrServerException, IOException {
QueryResponse response =
benchState.longSetQuery(true, true).process(miniClusterState.client, COLLECTION);
blackhole.consume(response);
return response;
}

@Benchmark
public Object floatDvEnhancedSet(
Blackhole blackhole,
BenchState benchState,
MiniClusterState.MiniClusterBenchState miniClusterState)
throws SolrServerException, IOException {
QueryResponse response =
benchState.floatSetQuery(true, true).process(miniClusterState.client, COLLECTION);
blackhole.consume(response);
return response;
}

@Benchmark
public Object doubleDvEnhancedSet(
Blackhole blackhole,
BenchState benchState,
MiniClusterState.MiniClusterBenchState miniClusterState)
throws SolrServerException, IOException {
QueryResponse response =
benchState.doubleSetQuery(true, true).process(miniClusterState.client, COLLECTION);
blackhole.consume(response);
return response;
}
Expand Down
20 changes: 17 additions & 3 deletions solr/benchmark/src/resources/configs/cloud-minimal/conf/schema.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,16 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
<schema name="minimal" version="1.7">
<schema name="minimal" version="1.6">
<fieldType name="boolean" class="solr.BoolField" sortMissingLast="true"/>
<fieldType name="string" class="solr.StrField"/>
<fieldType name="int" class="org.apache.solr.schema.IntPointField" docValues="false" omitNorms="true"
positionIncrementGap="0"/>
positionIncrementGap="0"/>
<fieldType name="inttrie" class="org.apache.solr.schema.TrieIntField" docValues="false" omitNorms="true"
positionIncrementGap="0"/>
<fieldType name="long" class="org.apache.solr.schema.LongPointField" docValues="false" omitNorms="true"
positionIncrementGap="0"/>
<fieldType name="float" class="org.apache.solr.schema.FloatPointField" docValues="false" omitNorms="true"
<fieldType name="float" class="org.apache.solr.schema.FloatField" docValues="false" omitNorms="true"
positionIncrementGap="0"/>
<fieldType name="double" class="org.apache.solr.schema.DoublePointField" docValues="false" omitNorms="true"
positionIncrementGap="0"/>
Expand All @@ -45,17 +47,29 @@
<dynamicField name="*_s" type="string" indexed="true" stored="false"/>
<dynamicField name="*_t" type="text" indexed="true" stored="false"/>
<dynamicField name="*_ts" type="text" indexed="true" stored="true"/>
<dynamicField name="*_it" type="inttrie" indexed="true" stored="false"/>
<dynamicField name="*_it_dv" type="inttrie" indexed="true" docValues="true" stored="false"/>
<dynamicField name="*_i" type="int" indexed="true" stored="false"/>
<dynamicField name="*_i_dv" type="int" indexed="true" docValues="true" stored="false"/>
<dynamicField name="*_i_e" type="int" indexed="true" stored="false" enhancedIndex="true"/>
<dynamicField name="*_i_dv_e" type="int" indexed="true" docValues="true" stored="false" enhancedIndex="true"/>
<dynamicField name="*_is" type="int" indexed="false" stored="true"/>
<dynamicField name="*_l" type="long" indexed="true" stored="false"/>
<dynamicField name="*_l_dv" type="long" indexed="true" docValues="true" stored="false"/>
<dynamicField name="*_l_e" type="long" indexed="true" stored="false" enhancedIndex="true"/>
<dynamicField name="*_l_dv_e" type="long" indexed="true" docValues="true" stored="false" enhancedIndex="true"/>
<dynamicField name="*_f" type="float" indexed="true" stored="false"/>
<dynamicField name="*_f_dv" type="float" indexed="true" docValues="true" stored="false"/>
<dynamicField name="*_f_e" type="float" indexed="true" stored="false" enhancedIndex="true"/>
<dynamicField name="*_f_dv_e" type="float" indexed="true" docValues="true" stored="false" enhancedIndex="true"/>
<dynamicField name="*_d" type="double" indexed="true" stored="false"/>
<dynamicField name="*_d_dv" type="double" indexed="true" docValues="true" stored="false"/>
<dynamicField name="*_d_e" type="double" indexed="true" stored="false" enhancedIndex="true"/>
<dynamicField name="*_d_dv_e" type="double" indexed="true" docValues="true" stored="false" enhancedIndex="true"/>
<dynamicField name="*_dt" type="date" indexed="true" stored="false"/>
<dynamicField name="*_dt_dv" type="date" indexed="true" docValues="true" stored="false"/>
<dynamicField name="*_dt_e" type="date" indexed="true" stored="false" enhancedIndex="true"/>
<dynamicField name="*_dt_dv_e" type="date" indexed="true" docValues="true" stored="false" enhancedIndex="true"/>

<uniqueKey>id</uniqueKey>
</schema>
Loading
Loading