You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ho...@apache.org on 2017/06/13 02:16:07 UTC
[7/8] lucene-solr:jira/SOLR-10834: a bunch of straight forward manual
cleanup for tests that assumed id would be an int
a bunch of straight forward manual cleanup for tests that assumed id would be an int
Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/e18e2e77
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/e18e2e77
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/e18e2e77
Branch: refs/heads/jira/SOLR-10834
Commit: e18e2e771fb4678cb911a62bbc7c74a873466bf0
Parents: 134e210
Author: Chris Hostetter <ho...@apache.org>
Authored: Mon Jun 12 17:03:56 2017 -0700
Committer: Chris Hostetter <ho...@apache.org>
Committed: Mon Jun 12 17:03:56 2017 -0700
----------------------------------------------------------------------
.../collection1/conf/schema-custom-field.xml | 4 +
.../conf/schema-distributed-missing-sort.xml | 4 +
.../test-files/solr/collection1/conf/schema.xml | 1 +
.../solr/collection1/conf/schema11.xml | 4 +-
.../test/org/apache/solr/CursorPagingTest.java | 58 ++++----
.../apache/solr/TestDistributedMissingSort.java | 60 ++++----
.../org/apache/solr/TestTolerantSearch.java | 4 +-
.../solr/cloud/DistribCursorPagingTest.java | 10 +-
.../cloud/DistribJoinFromCollectionTest.java | 8 +-
.../apache/solr/cloud/HttpPartitionTest.java | 2 +-
.../cloud/SegmentTerminateEarlyTestState.java | 30 ++--
...DistributedQueryComponentCustomSortTest.java | 38 ++---
.../handler/component/StatsComponentTest.java | 20 +--
...estDistributedStatsComponentCardinality.java | 4 +-
.../apache/solr/request/SimpleFacetsTest.java | 144 +++++++++----------
.../org/apache/solr/schema/TestBinaryField.java | 6 +-
.../org/apache/solr/search/TestCustomSort.java | 20 +--
.../apache/solr/search/TestFieldSortValues.java | 10 +-
.../solr/search/stats/TestDistribIDF.java | 14 +-
19 files changed, 231 insertions(+), 210 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/e18e2e77/solr/core/src/test-files/solr/collection1/conf/schema-custom-field.xml
----------------------------------------------------------------------
diff --git a/solr/core/src/test-files/solr/collection1/conf/schema-custom-field.xml b/solr/core/src/test-files/solr/collection1/conf/schema-custom-field.xml
index af6dc9c..23999e4 100644
--- a/solr/core/src/test-files/solr/collection1/conf/schema-custom-field.xml
+++ b/solr/core/src/test-files/solr/collection1/conf/schema-custom-field.xml
@@ -34,6 +34,10 @@
stored="true" multiValued="false" docValues="true" required="true"/>
<dynamicField name="*_sS" type="string" indexed="false" stored="true"/>
+ <!-- int varient of id, adding this here simplifies some indexing to do numeric sorting -->
+ <field name="id_i" type="int" indexed="true" stored="true" multiValued="false" />
+ <copyField source="id" dest="id_i" />
+
<!-- catchall wildcard to help ensure we aren't breaking function sorting -->
<dynamicField name="*" type="string" indexed="true" stored="true"/>
<uniqueKey>id</uniqueKey>
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/e18e2e77/solr/core/src/test-files/solr/collection1/conf/schema-distributed-missing-sort.xml
----------------------------------------------------------------------
diff --git a/solr/core/src/test-files/solr/collection1/conf/schema-distributed-missing-sort.xml b/solr/core/src/test-files/solr/collection1/conf/schema-distributed-missing-sort.xml
index 3c1f589..13daf46 100644
--- a/solr/core/src/test-files/solr/collection1/conf/schema-distributed-missing-sort.xml
+++ b/solr/core/src/test-files/solr/collection1/conf/schema-distributed-missing-sort.xml
@@ -77,6 +77,10 @@
<dynamicField name="*_mfacet" type="string_ml" indexed="true" stored="false" multiValued="true"/>
<dynamicField name="*_sS" type="string_ml" indexed="false" stored="true"/>
+
+ <!-- int varient of id, adding this here simplifies some indexing and test assertions -->
+ <field name="id_i" type="int" indexed="true" stored="true" multiValued="false" />
+ <copyField source="id" dest="id_i" />
<uniqueKey>id</uniqueKey>
</schema>
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/e18e2e77/solr/core/src/test-files/solr/collection1/conf/schema.xml
----------------------------------------------------------------------
diff --git a/solr/core/src/test-files/solr/collection1/conf/schema.xml b/solr/core/src/test-files/solr/collection1/conf/schema.xml
index 446e1e3..7ad3f59 100644
--- a/solr/core/src/test-files/solr/collection1/conf/schema.xml
+++ b/solr/core/src/test-files/solr/collection1/conf/schema.xml
@@ -792,6 +792,7 @@
<copyField source="*_t" dest="text"/>
<copyField source="id" dest="range_facet_l"/>
+ <copyField source="id" dest="id_i1"/>
<copyField source="range_facet_f" dest="range_facet_d"/>
<copyField source="range_facet_f1" dest="range_facet_f1_dv"/>
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/e18e2e77/solr/core/src/test-files/solr/collection1/conf/schema11.xml
----------------------------------------------------------------------
diff --git a/solr/core/src/test-files/solr/collection1/conf/schema11.xml b/solr/core/src/test-files/solr/collection1/conf/schema11.xml
index efdad8c..330c5db 100644
--- a/solr/core/src/test-files/solr/collection1/conf/schema11.xml
+++ b/solr/core/src/test-files/solr/collection1/conf/schema11.xml
@@ -319,8 +319,10 @@ valued. -->
best performance.
-->
- <!-- for testing, a type that does a transform to see if it's correctly done everywhere -->
<field name="id" type="string" indexed="true" stored="true" required="true" />
+ <!-- int varient of id, adding this here simplifies some indexing to do numeric sorting -->
+ <field name="id_i" type="int" indexed="true" stored="true" multiValued="false" />
+ <copyField source="id" dest="id_i" />
<field name="text" type="text" indexed="true" stored="false" />
<!-- Test a point field for distances -->
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/e18e2e77/solr/core/src/test/org/apache/solr/CursorPagingTest.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/CursorPagingTest.java b/solr/core/src/test/org/apache/solr/CursorPagingTest.java
index eb1c6bc..dfaddea 100644
--- a/solr/core/src/test/org/apache/solr/CursorPagingTest.java
+++ b/solr/core/src/test/org/apache/solr/CursorPagingTest.java
@@ -191,17 +191,17 @@ public class CursorPagingTest extends SolrTestCaseJ4 {
cursorMark = assertCursor(req(params, CURSOR_MARK_PARAM, cursorMark)
,"/response/numFound==9"
,"/response/start==0"
- ,"/response/docs==[{'id':9},{'id':8},{'id':7},{'id':6}]"
+ ,"/response/docs==[{'id':'9'},{'id':'8'},{'id':'7'},{'id':'6'}]"
);
cursorMark = assertCursor(req(params, CURSOR_MARK_PARAM, cursorMark)
,"/response/numFound==9"
,"/response/start==0"
- ,"/response/docs==[{'id':5},{'id':3},{'id':2},{'id':1}]"
+ ,"/response/docs==[{'id':'5'},{'id':'3'},{'id':'2'},{'id':'1'}]"
);
cursorMark = assertCursor(req(params, CURSOR_MARK_PARAM, cursorMark)
,"/response/numFound==9"
,"/response/start==0"
- ,"/response/docs==[{'id':0}]"
+ ,"/response/docs==[{'id':'0'}]"
);
// no more, so no change to cursorMark, and no new docs
assertEquals(cursorMark,
@@ -223,13 +223,13 @@ public class CursorPagingTest extends SolrTestCaseJ4 {
cursorMark = assertCursor(req(params, CURSOR_MARK_PARAM, cursorMark)
,"/response/numFound==7"
,"/response/start==0"
- ,"/response/docs==[{'id':6},{'id':1},{'id':8},{'id':5}]"
+ ,"/response/docs==[{'id':'6'},{'id':'1'},{'id':'8'},{'id':'5'}]"
,"/facet_counts/facet_fields/str=={'a':4,'b':3,'c':0}"
);
cursorMark = assertCursor(req(params, CURSOR_MARK_PARAM, cursorMark)
,"/response/numFound==7"
,"/response/start==0"
- ,"/response/docs==[{'id':4},{'id':3},{'id':0}]"
+ ,"/response/docs==[{'id':'4'},{'id':'3'},{'id':'0'}]"
,"/facet_counts/facet_fields/str=={'a':4,'b':3,'c':0}"
);
// no more, so no change to cursorMark, and no new docs
@@ -253,19 +253,19 @@ public class CursorPagingTest extends SolrTestCaseJ4 {
cursorMark = assertCursor(req(params, CURSOR_MARK_PARAM, cursorMark)
,"/response/numFound==8"
,"/response/start==0"
- ,"/response/docs==[{'id':7},{'id':0},{'id':3}]"
+ ,"/response/docs==[{'id':'7'},{'id':'0'},{'id':'3'}]"
,"/facet_counts/facet_fields/str=={'a':4,'b':1,'c':3}"
);
cursorMark = assertCursor(req(params, CURSOR_MARK_PARAM, cursorMark)
,"/response/numFound==8"
,"/response/start==0"
- ,"/response/docs==[{'id':4},{'id':1},{'id':6}]"
+ ,"/response/docs==[{'id':'4'},{'id':'1'},{'id':'6'}]"
,"/facet_counts/facet_fields/str=={'a':4,'b':1,'c':3}"
);
cursorMark = assertCursor(req(params, CURSOR_MARK_PARAM, cursorMark)
,"/response/numFound==8"
,"/response/start==0"
- ,"/response/docs==[{'id':9},{'id':2}]"
+ ,"/response/docs==[{'id':'9'},{'id':'2'}]"
,"/facet_counts/facet_fields/str=={'a':4,'b':1,'c':3}"
);
// no more, so no change to cursorMark, and no new docs
@@ -287,17 +287,17 @@ public class CursorPagingTest extends SolrTestCaseJ4 {
cursorMark = assertCursor(req(params, CURSOR_MARK_PARAM, cursorMark)
,"/response/numFound==8"
,"/response/start==0"
- ,"/response/docs==[{'id':3},{'id':7},{'id':0}]"
+ ,"/response/docs==[{'id':'3'},{'id':'7'},{'id':'0'}]"
);
cursorMark = assertCursor(req(params, CURSOR_MARK_PARAM, cursorMark)
,"/response/numFound==8"
,"/response/start==0"
- ,"/response/docs==[{'id':4},{'id':1},{'id':6}]"
+ ,"/response/docs==[{'id':'4'},{'id':'1'},{'id':'6'}]"
);
cursorMark = assertCursor(req(params, CURSOR_MARK_PARAM, cursorMark)
,"/response/numFound==8"
,"/response/start==0"
- ,"/response/docs==[{'id':9},{'id':2}]"
+ ,"/response/docs==[{'id':'9'},{'id':'2'}]"
);
// no more, so no change to cursorMark, and no new docs
assertEquals(cursorMark,
@@ -317,17 +317,17 @@ public class CursorPagingTest extends SolrTestCaseJ4 {
cursorMark = assertCursor(req(params, CURSOR_MARK_PARAM, cursorMark)
,"/response/numFound==8"
,"/response/start==0"
- ,"/response/docs==[{'id':7},{'id':0},{'id':4}]"
+ ,"/response/docs==[{'id':'7'},{'id':'0'},{'id':'4'}]"
);
cursorMark = assertCursor(req(params, CURSOR_MARK_PARAM, cursorMark)
,"/response/numFound==8"
,"/response/start==0"
- ,"/response/docs==[{'id':1},{'id':6},{'id':9}]"
+ ,"/response/docs==[{'id':'1'},{'id':'6'},{'id':'9'}]"
);
cursorMark = assertCursor(req(params, CURSOR_MARK_PARAM, cursorMark)
,"/response/numFound==8"
,"/response/start==0"
- ,"/response/docs==[{'id':2},{'id':3}]"
+ ,"/response/docs==[{'id':'2'},{'id':'3'}]"
);
// no more, so no change to cursorMark, and no new docs
assertEquals(cursorMark,
@@ -346,12 +346,12 @@ public class CursorPagingTest extends SolrTestCaseJ4 {
cursorMark = assertCursor(req(params, CURSOR_MARK_PARAM, cursorMark)
,"/response/numFound==10"
,"/response/start==0"
- ,"/response/docs==[{'id':6},{'id':4},{'id':3},{'id':1},{'id':8},{'id':5}]"
+ ,"/response/docs==[{'id':'6'},{'id':'4'},{'id':'3'},{'id':'1'},{'id':'8'},{'id':'5'}]"
);
cursorMark = assertCursor(req(params, CURSOR_MARK_PARAM, cursorMark)
,"/response/numFound==10"
,"/response/start==0"
- ,"/response/docs==[{'id':0},{'id':9},{'id':7},{'id':2}]"
+ ,"/response/docs==[{'id':'0'},{'id':'9'},{'id':'7'},{'id':'2'}]"
);
// no more, so no change to cursorMark, and no new docs
assertEquals(cursorMark,
@@ -370,27 +370,27 @@ public class CursorPagingTest extends SolrTestCaseJ4 {
cursorMark = assertCursor(req(params, CURSOR_MARK_PARAM, cursorMark)
,"/response/numFound==10"
,"/response/start==0"
- ,"/response/docs==[{'id':2},{'id':9}]"
+ ,"/response/docs==[{'id':'2'},{'id':'9'}]"
);
cursorMark = assertCursor(req(params, CURSOR_MARK_PARAM, cursorMark)
,"/response/numFound==10"
,"/response/start==0"
- ,"/response/docs==[{'id':7},{'id':4}]"
+ ,"/response/docs==[{'id':'7'},{'id':'4'}]"
);
cursorMark = assertCursor(req(params, CURSOR_MARK_PARAM, cursorMark)
,"/response/numFound==10"
,"/response/start==0"
- ,"/response/docs==[{'id':3},{'id':8}]"
+ ,"/response/docs==[{'id':'3'},{'id':'8'}]"
);
cursorMark = assertCursor(req(params, CURSOR_MARK_PARAM, cursorMark)
,"/response/numFound==10"
,"/response/start==0"
- ,"/response/docs==[{'id':5},{'id':6}]"
+ ,"/response/docs==[{'id':'5'},{'id':'6'}]"
);
cursorMark = assertCursor(req(params, CURSOR_MARK_PARAM, cursorMark)
,"/response/numFound==10"
,"/response/start==0"
- ,"/response/docs==[{'id':1},{'id':0}]"
+ ,"/response/docs==[{'id':'1'},{'id':'0'}]"
);
// we've exactly exhausted all the results, but solr had no way of know that
// no more, so no change to cursorMark, and no new docs
@@ -410,7 +410,7 @@ public class CursorPagingTest extends SolrTestCaseJ4 {
cursorMark = assertCursor(req(params, CURSOR_MARK_PARAM, cursorMark)
,"/response/numFound==2"
,"/response/start==0"
- ,"/response/docs==[{'id':7},{'id':3}]"
+ ,"/response/docs==[{'id':'7'},{'id':'3'}]"
);
// no more, so no change to cursorMark, and no new docs
assertEquals(cursorMark,
@@ -455,7 +455,7 @@ public class CursorPagingTest extends SolrTestCaseJ4 {
cursorMark = assertCursor(req(params, CURSOR_MARK_PARAM, cursorMark)
,"/response/numFound==10"
,"/response/start==0"
- ,"/response/docs==[{'id':1},{'id':3}]"
+ ,"/response/docs==[{'id':'1'},{'id':'3'}]"
);
// delete the last guy we got
assertU(delI("3"));
@@ -463,7 +463,7 @@ public class CursorPagingTest extends SolrTestCaseJ4 {
cursorMark = assertCursor(req(params, CURSOR_MARK_PARAM, cursorMark)
,"/response/numFound==9"
,"/response/start==0"
- ,"/response/docs==[{'id':4},{'id':6}]"
+ ,"/response/docs==[{'id':'4'},{'id':'6'}]"
);
// delete the next guy we expect
assertU(delI("0"));
@@ -471,7 +471,7 @@ public class CursorPagingTest extends SolrTestCaseJ4 {
cursorMark = assertCursor(req(params, CURSOR_MARK_PARAM, cursorMark)
,"/response/numFound==8"
,"/response/start==0"
- ,"/response/docs==[{'id':5},{'id':8}]"
+ ,"/response/docs==[{'id':'5'},{'id':'8'}]"
);
// update a doc we've already seen so it repeats
assertU(adoc("id", "5", "str", "c"));
@@ -479,7 +479,7 @@ public class CursorPagingTest extends SolrTestCaseJ4 {
cursorMark = assertCursor(req(params, CURSOR_MARK_PARAM, cursorMark)
,"/response/numFound==8"
,"/response/start==0"
- ,"/response/docs==[{'id':2},{'id':5}]"
+ ,"/response/docs==[{'id':'2'},{'id':'5'}]"
);
// update the next doc we expect so it's now in the past
assertU(adoc("id", "7", "str", "a"));
@@ -487,7 +487,7 @@ public class CursorPagingTest extends SolrTestCaseJ4 {
cursorMark = assertCursor(req(params, CURSOR_MARK_PARAM, cursorMark)
,"/response/numFound==8"
,"/response/start==0"
- ,"/response/docs==[{'id':9}]"
+ ,"/response/docs==[{'id':'9'}]"
);
// no more, so no change to cursorMark, and no new docs
assertEquals(cursorMark,
@@ -684,7 +684,7 @@ public class CursorPagingTest extends SolrTestCaseJ4 {
cursorMark, nextCursorMark);
}
for (Map<Object,Object> doc : docs) {
- int id = ((Long)doc.get("id")).intValue();
+ int id = Integer.parseInt(doc.get("id").toString());
assertFalse("walk already seen: " + id, ids.exists(id));
ids.put(id);
assertFalse("id set bigger then max allowed ("+maxSize+"): " + ids.size(),
@@ -773,7 +773,7 @@ public class CursorPagingTest extends SolrTestCaseJ4 {
cursorMark, nextCursorMark);
}
for (Map<Object,Object> doc : docs) {
- int id = ((Long)doc.get("id")).intValue();
+ int id = Integer.parseInt(doc.get("id").toString());
assertFalse("walk already seen: " + id, ids.exists(id));
ids.put(id);
assertFalse("id set bigger then max allowed ("+maxSize+"): " + ids.size(),
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/e18e2e77/solr/core/src/test/org/apache/solr/TestDistributedMissingSort.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/TestDistributedMissingSort.java b/solr/core/src/test/org/apache/solr/TestDistributedMissingSort.java
index 7a91c83..378ad0d 100644
--- a/solr/core/src/test/org/apache/solr/TestDistributedMissingSort.java
+++ b/solr/core/src/test/org/apache/solr/TestDistributedMissingSort.java
@@ -104,13 +104,13 @@ public class TestDistributedMissingSort extends BaseDistributedSearchTestCase {
// sint1_ml desc sort pos: 7 8 10 11 3 12 6 2 9 1 13 4 5
QueryResponse rsp = query("q","*:*", "sort", sint1_ml + " desc", "rows", "13");
- assertFieldValues(rsp.getResults(), id, 10, 8, 5, 12, 13, 7, 1, 2, 9, 3, 4, 6, 11);
+ assertFieldValues(rsp.getResults(), "id_i", 10, 8, 5, 12, 13, 7, 1, 2, 9, 3, 4, 6, 11);
rsp = query("q","*:*", "sort", sint1_ml + " asc", "rows", "13");
- assertFieldValues(rsp.getResults(), id, 11, 6, 4, 3, 9, 2, 1, 7, 13, 12, 5, 8, 10);
+ assertFieldValues(rsp.getResults(), "id_i", 11, 6, 4, 3, 9, 2, 1, 7, 13, 12, 5, 8, 10);
- rsp = query("q","*:*", "sort", sint1_ml + " desc," + id + " asc", "rows", "200");
- assertFieldValues(rsp.getResults(), id,
+ rsp = query("q","*:*", "sort", sint1_ml + " desc, id_i asc", "rows", "200");
+ assertFieldValues(rsp.getResults(), "id_i",
10, 8, 5, 12, 13, 7, 1, 2, 9, 3, 4, 6, 11,
14, 15, 16, 17,
100, 101, 102, 103, 104, 105, 106, 107, 108, 109,
@@ -119,8 +119,8 @@ public class TestDistributedMissingSort extends BaseDistributedSearchTestCase {
130, 131, 132, 133, 134, 135, 136, 137, 138, 139,
140, 141, 142, 143, 144, 145, 146, 147, 148, 149);
- rsp = query("q","*:*", "sort", sint1_ml + " asc," + id + " desc", "rows", "200");
- assertFieldValues(rsp.getResults(), id,
+ rsp = query("q","*:*", "sort", sint1_ml + " asc, id_i desc", "rows", "200");
+ assertFieldValues(rsp.getResults(), "id_i",
11, 6, 4, 3, 9, 2, 1, 7, 13, 12, 5, 8, 10,
149, 148, 147, 146, 145, 144, 143, 142, 141, 140,
139, 138, 137, 136, 135, 134, 133, 132, 131, 130,
@@ -135,13 +135,13 @@ public class TestDistributedMissingSort extends BaseDistributedSearchTestCase {
// long1_ml desc sort pos: 7 8 10 11 3 12 6 2 9 1 13 4 5
rsp = query("q","*:*", "sort", long1_ml + " desc", "rows", "13");
- assertFieldValues(rsp.getResults(), id, 10, 8, 5, 12, 13, 7, 1, 2, 9, 3, 4, 6, 11);
+ assertFieldValues(rsp.getResults(), "id_i", 10, 8, 5, 12, 13, 7, 1, 2, 9, 3, 4, 6, 11);
rsp = query("q","*:*", "sort", long1_ml + " asc", "rows", "13");
- assertFieldValues(rsp.getResults(), id, 11, 6, 4, 3, 9, 2, 1, 7, 13, 12, 5, 8, 10);
+ assertFieldValues(rsp.getResults(), "id_i", 11, 6, 4, 3, 9, 2, 1, 7, 13, 12, 5, 8, 10);
- rsp = query("q","*:*", "sort", long1_ml + " desc," + id + " asc", "rows", "200");
- assertFieldValues(rsp.getResults(), id,
+ rsp = query("q","*:*", "sort", long1_ml + " desc, id_i asc", "rows", "200");
+ assertFieldValues(rsp.getResults(), "id_i",
10, 8, 5, 12, 13, 7, 1, 2, 9, 3, 4, 6, 11,
14, 15, 16, 17,
100, 101, 102, 103, 104, 105, 106, 107, 108, 109,
@@ -150,8 +150,8 @@ public class TestDistributedMissingSort extends BaseDistributedSearchTestCase {
130, 131, 132, 133, 134, 135, 136, 137, 138, 139,
140, 141, 142, 143, 144, 145, 146, 147, 148, 149);
- rsp = query("q","*:*", "sort", long1_ml + " asc," + id + " desc", "rows", "200");
- assertFieldValues(rsp.getResults(), id,
+ rsp = query("q","*:*", "sort", long1_ml + " asc, id_i desc", "rows", "200");
+ assertFieldValues(rsp.getResults(), "id_i",
11, 6, 4, 3, 9, 2, 1, 7, 13, 12, 5, 8, 10,
149, 148, 147, 146, 145, 144, 143, 142, 141, 140,
139, 138, 137, 136, 135, 134, 133, 132, 131, 130,
@@ -167,13 +167,13 @@ public class TestDistributedMissingSort extends BaseDistributedSearchTestCase {
// string1_ml desc sort pos: 12 13 10 9 1 3 8 5 6 7 2 4 11
rsp = query("q","*:*", "sort", string1_ml + " desc", "rows", "13");
- assertFieldValues(rsp.getResults(), id, 5, 11, 6, 12, 8, 9, 10, 7, 4, 3, 13, 1, 2);
+ assertFieldValues(rsp.getResults(), "id_i", 5, 11, 6, 12, 8, 9, 10, 7, 4, 3, 13, 1, 2);
rsp = query("q","*:*", "sort", string1_ml + " asc", "rows", "13");
- assertFieldValues(rsp.getResults(), id, 2, 1, 13, 3, 4, 7, 10, 9, 8, 12, 6, 11, 5);
+ assertFieldValues(rsp.getResults(), "id_i", 2, 1, 13, 3, 4, 7, 10, 9, 8, 12, 6, 11, 5);
- rsp = query("q","*:*", "sort", string1_ml + " desc," + id + " asc", "rows", "200");
- assertFieldValues(rsp.getResults(), id,
+ rsp = query("q","*:*", "sort", string1_ml + " desc, id_i asc", "rows", "200");
+ assertFieldValues(rsp.getResults(), "id_i",
5, 11, 6, 12, 8, 9, 10, 7, 4, 3, 13, 1, 2,
// missing field string1_ml="a_s1", ascending id sort
14, 15, 16, 17,
@@ -183,8 +183,8 @@ public class TestDistributedMissingSort extends BaseDistributedSearchTestCase {
130, 131, 132, 133, 134, 135, 136, 137, 138, 139,
140, 141, 142, 143, 144, 145, 146, 147, 148, 149);
- rsp = query("q","*:*", "sort", string1_ml + " asc," + id + " desc", "rows", "200");
- assertFieldValues(rsp.getResults(), id,
+ rsp = query("q","*:*", "sort", string1_ml + " asc, id_i desc", "rows", "200");
+ assertFieldValues(rsp.getResults(), "id_i",
2, 1, 13, 3, 4, 7, 10, 9, 8, 12, 6, 11, 5,
// missing field string1_ml="a_s1", descending id sort
149, 148, 147, 146, 145, 144, 143, 142, 141, 140,
@@ -201,8 +201,8 @@ public class TestDistributedMissingSort extends BaseDistributedSearchTestCase {
// sint1_mf asc sort pos: 7 6 4 3 11 2 8 12 5 13 1 10 9
// sint1_mf desc sort pos: 7 8 10 11 3 12 6 2 9 1 13 4 5
- QueryResponse rsp = query("q","*:*", "sort", sint1_mf + " desc," + id + " asc", "rows", "200");
- assertFieldValues(rsp.getResults(), id,
+ QueryResponse rsp = query("q","*:*", "sort", sint1_mf + " desc, id_i asc", "rows", "200");
+ assertFieldValues(rsp.getResults(), "id_i",
14, 15, 16, 17,
100, 101, 102, 103, 104, 105, 106, 107, 108, 109,
110, 111, 112, 113, 114, 115, 116, 117, 118, 119,
@@ -211,8 +211,8 @@ public class TestDistributedMissingSort extends BaseDistributedSearchTestCase {
140, 141, 142, 143, 144, 145, 146, 147, 148, 149,
10, 8, 5, 12, 13, 7, 1, 2, 9, 3, 4, 6, 11);
- rsp = query("q","*:*", "sort", sint1_mf + " asc," + id + " desc", "rows", "200");
- assertFieldValues(rsp.getResults(), id,
+ rsp = query("q","*:*", "sort", sint1_mf + " asc, id_i desc", "rows", "200");
+ assertFieldValues(rsp.getResults(), "id_i",
149, 148, 147, 146, 145, 144, 143, 142, 141, 140,
139, 138, 137, 136, 135, 134, 133, 132, 131, 130,
129, 128, 127, 126, 125, 124, 123, 122, 121, 120,
@@ -227,8 +227,8 @@ public class TestDistributedMissingSort extends BaseDistributedSearchTestCase {
// long1_mf asc sort pos: 7 6 4 3 11 2 8 12 5 13 1 10 9
// long1_mf desc sort pos: 7 8 10 11 3 12 6 2 9 1 13 4 5
- rsp = query("q","*:*", "sort", long1_mf + " desc," + id + " asc", "rows", "200");
- assertFieldValues(rsp.getResults(), id,
+ rsp = query("q","*:*", "sort", long1_mf + " desc, id_i asc", "rows", "200");
+ assertFieldValues(rsp.getResults(), "id_i",
14, 15, 16, 17,
100, 101, 102, 103, 104, 105, 106, 107, 108, 109,
110, 111, 112, 113, 114, 115, 116, 117, 118, 119,
@@ -237,8 +237,8 @@ public class TestDistributedMissingSort extends BaseDistributedSearchTestCase {
140, 141, 142, 143, 144, 145, 146, 147, 148, 149,
10, 8, 5, 12, 13, 7, 1, 2, 9, 3, 4, 6, 11);
- rsp = query("q","*:*", "sort", long1_mf + " asc," + id + " desc", "rows", "200");
- assertFieldValues(rsp.getResults(), id,
+ rsp = query("q","*:*", "sort", long1_mf + " asc, id_i desc", "rows", "200");
+ assertFieldValues(rsp.getResults(), "id_i",
149, 148, 147, 146, 145, 144, 143, 142, 141, 140,
139, 138, 137, 136, 135, 134, 133, 132, 131, 130,
129, 128, 127, 126, 125, 124, 123, 122, 121, 120,
@@ -253,8 +253,8 @@ public class TestDistributedMissingSort extends BaseDistributedSearchTestCase {
// string1_mf asc sort pos: 2 1 4 5 13 11 6 9 8 7 12 10 3
// string1_mf desc sort pos: 12 13 10 9 1 3 8 5 6 7 2 4 11
- rsp = query("q","*:*", "sort", string1_mf + " desc," + id + " asc", "rows", "200");
- assertFieldValues(rsp.getResults(), id,
+ rsp = query("q","*:*", "sort", string1_mf + " desc, id_i asc", "rows", "200");
+ assertFieldValues(rsp.getResults(), "id_i",
// missing field string1_mf="a_s1_mf", ascending id sort
14, 15, 16, 17,
100, 101, 102, 103, 104, 105, 106, 107, 108, 109,
@@ -264,8 +264,8 @@ public class TestDistributedMissingSort extends BaseDistributedSearchTestCase {
140, 141, 142, 143, 144, 145, 146, 147, 148, 149,
5, 11, 6, 12, 8, 9, 10, 7, 4, 3, 13, 1, 2);
- rsp = query("q","*:*", "sort", string1_mf + " asc," + id + " desc", "rows", "200");
- assertFieldValues(rsp.getResults(), id,
+ rsp = query("q","*:*", "sort", string1_mf + " asc, id_i desc", "rows", "200");
+ assertFieldValues(rsp.getResults(), "id_i",
// missing field string1_mf="a_s1_mf", descending id sort
149, 148, 147, 146, 145, 144, 143, 142, 141, 140,
139, 138, 137, 136, 135, 134, 133, 132, 131, 130,
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/e18e2e77/solr/core/src/test/org/apache/solr/TestTolerantSearch.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/TestTolerantSearch.java b/solr/core/src/test/org/apache/solr/TestTolerantSearch.java
index cb485d0..ec1f16c 100644
--- a/solr/core/src/test/org/apache/solr/TestTolerantSearch.java
+++ b/solr/core/src/test/org/apache/solr/TestTolerantSearch.java
@@ -150,7 +150,7 @@ public class TestTolerantSearch extends SolrJettyTestBase {
}
}
assertTrue(foundError);
- assertEquals(1, response.getResults().get(0).getFieldValue("id"));
+ assertEquals("1", response.getResults().get(0).getFieldValue("id"));
assertEquals("batman", response.getResults().get(0).getFirstValue("subject"));
unIgnoreException("Dummy exception in BadResponseWriter");
}
@@ -199,7 +199,7 @@ public class TestTolerantSearch extends SolrJettyTestBase {
}
assertTrue(foundError);
- assertEquals(1, response.getResults().get(0).getFieldValue("id"));
+ assertEquals("1", response.getResults().get(0).getFieldValue("id"));
assertEquals("batman", response.getResults().get(0).getFirstValue("subject"));
unIgnoreException("Dummy exception in BadResponseWriter");
}
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/e18e2e77/solr/core/src/test/org/apache/solr/cloud/DistribCursorPagingTest.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/cloud/DistribCursorPagingTest.java b/solr/core/src/test/org/apache/solr/cloud/DistribCursorPagingTest.java
index 0742ac7..5de766f 100644
--- a/solr/core/src/test/org/apache/solr/cloud/DistribCursorPagingTest.java
+++ b/solr/core/src/test/org/apache/solr/cloud/DistribCursorPagingTest.java
@@ -556,7 +556,7 @@ public class DistribCursorPagingTest extends AbstractFullDistribZkTestBase {
if (ids.size() < numInitialDocs) {
message.append("Missing doc(s): ");
for (SolrInputDocument doc : initialDocs) {
- int id = ((Integer)doc.get("id").getValue()).intValue();
+ int id = Integer.parseInt(doc.getFieldValue("id").toString());
if ( ! ids.exists(id)) {
QueryResponse rsp = cloudClient.query(params("q", "id:" + id,
"rows", "1"));
@@ -664,12 +664,12 @@ public class DistribCursorPagingTest extends AbstractFullDistribZkTestBase {
* "id" of the list of documents returned matches the expected list
* @see org.apache.solr.client.solrj.SolrClient#query
*/
- private void assertDocList(QueryResponse rsp, Object... ids) {
+ private void assertDocList(QueryResponse rsp, int... ids) {
SolrDocumentList docs = extractDocList(rsp);
assertEquals("Wrong number of docs in response", ids.length, docs.size());
int i = 0;
- for (Object id : ids) {
- assertEquals(rsp.toString(), id, docs.get(i).get("id"));
+ for (int id : ids) {
+ assertEquals(rsp.toString(), ""+id, docs.get(i).get("id"));
i++;
}
}
@@ -730,7 +730,7 @@ public class DistribCursorPagingTest extends AbstractFullDistribZkTestBase {
}
for (SolrDocument doc : docs) {
- int id = ((Integer)doc.get("id")).intValue();
+ int id = Integer.parseInt(doc.getFieldValue("id").toString());
if (ids.exists(id)) {
String msg = "(" + p + ") walk already seen: " + id;
try {
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/e18e2e77/solr/core/src/test/org/apache/solr/cloud/DistribJoinFromCollectionTest.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/cloud/DistribJoinFromCollectionTest.java b/solr/core/src/test/org/apache/solr/cloud/DistribJoinFromCollectionTest.java
index cfebef2..383c1ae 100644
--- a/solr/core/src/test/org/apache/solr/cloud/DistribJoinFromCollectionTest.java
+++ b/solr/core/src/test/org/apache/solr/cloud/DistribJoinFromCollectionTest.java
@@ -62,7 +62,7 @@ public class DistribJoinFromCollectionTest extends SolrCloudTestCase{
private static String toColl = "to_2x2";
private static String fromColl = "from_1x4";
- private static Integer toDocId;
+ private static String toDocId;
@BeforeClass
public static void setupCluster() throws Exception {
@@ -140,7 +140,7 @@ public class DistribJoinFromCollectionTest extends SolrCloudTestCase{
log.info("DistribJoinFromCollectionTest succeeded ... shutting down now!");
}
- private void testJoins(String toColl, String fromColl, Integer toDocId, boolean isScoresTest)
+ private void testJoins(String toColl, String fromColl, String toDocId, boolean isScoresTest)
throws SolrServerException, IOException {
// verify the join with fromIndex works
final String fromQ = "match_s:c^2";
@@ -219,12 +219,12 @@ public class DistribJoinFromCollectionTest extends SolrCloudTestCase{
}
}
- protected static Integer indexDoc(String collection, int id, String joinField, String matchField, String getField) throws Exception {
+ protected static String indexDoc(String collection, int id, String joinField, String matchField, String getField) throws Exception {
UpdateRequest up = new UpdateRequest();
up.setCommitWithin(50);
up.setParam("collection", collection);
SolrInputDocument doc = new SolrInputDocument();
- Integer docId = new Integer(id);
+ String docId = "" + id;
doc.addField("id", docId);
doc.addField("join_s", joinField);
if (matchField != null)
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/e18e2e77/solr/core/src/test/org/apache/solr/cloud/HttpPartitionTest.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/cloud/HttpPartitionTest.java b/solr/core/src/test/org/apache/solr/cloud/HttpPartitionTest.java
index 6c7de88..2f2ccb4 100644
--- a/solr/core/src/test/org/apache/solr/cloud/HttpPartitionTest.java
+++ b/solr/core/src/test/org/apache/solr/cloud/HttpPartitionTest.java
@@ -598,7 +598,7 @@ public class HttpPartitionTest extends AbstractFullDistribZkTestBase {
@SuppressWarnings("rawtypes")
protected void assertDocExists(HttpSolrClient solr, String coll, String docId) throws Exception {
NamedList rsp = realTimeGetDocId(solr, docId);
- String match = JSONTestUtil.matchObj("/id", rsp.get("doc"), new Integer(docId));
+ String match = JSONTestUtil.matchObj("/id", rsp.get("doc"), docId);
assertTrue("Doc with id=" + docId + " not found in " + solr.getBaseURL()
+ " due to: " + match + "; rsp="+rsp, match == null);
}
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/e18e2e77/solr/core/src/test/org/apache/solr/cloud/SegmentTerminateEarlyTestState.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/cloud/SegmentTerminateEarlyTestState.java b/solr/core/src/test/org/apache/solr/cloud/SegmentTerminateEarlyTestState.java
index 9824e3d..118d5ed 100644
--- a/solr/core/src/test/org/apache/solr/cloud/SegmentTerminateEarlyTestState.java
+++ b/solr/core/src/test/org/apache/solr/cloud/SegmentTerminateEarlyTestState.java
@@ -106,8 +106,10 @@ class SegmentTerminateEarlyTestState {
// check correctness of the first result
if (rsp.getResults().getNumFound() > 0) {
final SolrDocument solrDocument0 = rsp.getResults().get(0);
- TestMiniSolrCloudCluster.assertTrue(KEY_FIELD +" of ("+solrDocument0+") is not in maxTimestampDocKeys("+maxTimestampDocKeys+")",
- maxTimestampDocKeys.contains(solrDocument0.getFieldValue(KEY_FIELD)));
+ final Integer idAsInt = Integer.parseInt(solrDocument0.getFieldValue(KEY_FIELD).toString());
+ TestMiniSolrCloudCluster.assertTrue
+ (KEY_FIELD +"="+idAsInt+" of ("+solrDocument0+") is not in maxTimestampDocKeys("+maxTimestampDocKeys+")",
+ maxTimestampDocKeys.contains(idAsInt));
TestMiniSolrCloudCluster.assertEquals(ODD_FIELD, oddFieldValue, solrDocument0.getFieldValue(ODD_FIELD));
}
// check segmentTerminatedEarly flag
@@ -136,8 +138,10 @@ class SegmentTerminateEarlyTestState {
// check correctness of the first result
if (rsp.getResults().getNumFound() > 0) {
final SolrDocument solrDocument0 = rsp.getResults().get(0);
- TestMiniSolrCloudCluster.assertTrue(KEY_FIELD +" of ("+solrDocument0+") is not in maxTimestampDocKeys("+maxTimestampDocKeys+")",
- maxTimestampDocKeys.contains(solrDocument0.getFieldValue(KEY_FIELD)));
+ final Integer idAsInt = Integer.parseInt(solrDocument0.getFieldValue(KEY_FIELD).toString());
+ TestMiniSolrCloudCluster.assertTrue
+ (KEY_FIELD +"="+idAsInt+" of ("+solrDocument0+") is not in maxTimestampDocKeys("+maxTimestampDocKeys+")",
+ maxTimestampDocKeys.contains(idAsInt));
TestMiniSolrCloudCluster.assertEquals(ODD_FIELD, oddFieldValue, rsp.getResults().get(0).getFieldValue(ODD_FIELD));
}
// check segmentTerminatedEarly flag
@@ -182,8 +186,10 @@ class SegmentTerminateEarlyTestState {
// check correctness of the first result
if (rsp.getResults().getNumFound() > 0) {
final SolrDocument solrDocument0 = rsp.getResults().get(0);
- TestMiniSolrCloudCluster.assertTrue(KEY_FIELD +" of ("+solrDocument0+") is not in maxTimestampDocKeys("+maxTimestampDocKeys+")",
- maxTimestampDocKeys.contains(solrDocument0.getFieldValue(KEY_FIELD)));
+ final Integer idAsInt = Integer.parseInt(solrDocument0.getFieldValue(KEY_FIELD).toString());
+ TestMiniSolrCloudCluster.assertTrue
+ (KEY_FIELD +"="+idAsInt+" of ("+solrDocument0+") is not in maxTimestampDocKeys("+maxTimestampDocKeys+")",
+ maxTimestampDocKeys.contains(idAsInt));
TestMiniSolrCloudCluster.assertEquals(ODD_FIELD, oddFieldValue, rsp.getResults().get(0).getFieldValue(ODD_FIELD));
}
// check segmentTerminatedEarly flag
@@ -226,8 +232,10 @@ class SegmentTerminateEarlyTestState {
// check correctness of the first result
if (rsp.getGroupResponse().getValues().get(0).getMatches() > 0) {
final SolrDocument solrDocument = rsp.getGroupResponse().getValues().get(0).getValues().get(0).getResult().get(0);
- TestMiniSolrCloudCluster.assertTrue(KEY_FIELD +" of ("+solrDocument+") is not in maxTimestampDocKeys("+maxTimestampDocKeys+")",
- maxTimestampDocKeys.contains(solrDocument.getFieldValue(KEY_FIELD)));
+ final Integer idAsInt = Integer.parseInt(solrDocument.getFieldValue(KEY_FIELD).toString());
+ TestMiniSolrCloudCluster.assertTrue
+ (KEY_FIELD +"="+idAsInt+" of ("+solrDocument+") is not in maxTimestampDocKeys("+maxTimestampDocKeys+")",
+ maxTimestampDocKeys.contains(idAsInt));
TestMiniSolrCloudCluster.assertEquals(ODD_FIELD, oddFieldValue, solrDocument.getFieldValue(ODD_FIELD));
}
// check segmentTerminatedEarly flag
@@ -251,8 +259,10 @@ class SegmentTerminateEarlyTestState {
// check correctness of the first result
if (rsp.getResults().getNumFound() > 0) {
final SolrDocument solrDocument0 = rsp.getResults().get(0);
- TestMiniSolrCloudCluster.assertTrue(KEY_FIELD +" of ("+solrDocument0+") is not in minTimestampDocKeys("+minTimestampDocKeys+")",
- minTimestampDocKeys.contains(solrDocument0.getFieldValue(KEY_FIELD)));
+ final Integer idAsInt = Integer.parseInt(solrDocument0.getFieldValue(KEY_FIELD).toString());
+ TestMiniSolrCloudCluster.assertTrue
+ (KEY_FIELD +"="+idAsInt+" of ("+solrDocument0+") is not in minTimestampDocKeys("+minTimestampDocKeys+")",
+ minTimestampDocKeys.contains(idAsInt));
TestMiniSolrCloudCluster.assertEquals(ODD_FIELD, oddFieldValue, solrDocument0.getFieldValue(ODD_FIELD));
}
// check segmentTerminatedEarly flag
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/e18e2e77/solr/core/src/test/org/apache/solr/handler/component/DistributedQueryComponentCustomSortTest.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/handler/component/DistributedQueryComponentCustomSortTest.java b/solr/core/src/test/org/apache/solr/handler/component/DistributedQueryComponentCustomSortTest.java
index 4b3e92a..7efde0c 100644
--- a/solr/core/src/test/org/apache/solr/handler/component/DistributedQueryComponentCustomSortTest.java
+++ b/solr/core/src/test/org/apache/solr/handler/component/DistributedQueryComponentCustomSortTest.java
@@ -64,44 +64,44 @@ public class DistributedQueryComponentCustomSortTest extends BaseDistributedSear
QueryResponse rsp;
rsp = query("q", "*:*", "fl", "id", "sort", "payload asc", "rows", "20");
- assertFieldValues(rsp.getResults(), id, 7, 1, 6, 4, 2, 10, 12, 3, 5, 9, 8, 13, 11);
+ assertFieldValues(rsp.getResults(), id, "7", "1", "6", "4", "2", "10", "12", "3", "5", "9", "8", "13", "11");
rsp = query("q", "*:*", "fl", "id", "sort", "payload desc", "rows", "20");
- assertFieldValues(rsp.getResults(), id, 11, 13, 8, 9, 5, 3, 12, 10, 2, 4, 6, 1, 7);
+ assertFieldValues(rsp.getResults(), id, "11", "13", "8", "9", "5", "3", "12", "10", "2", "4", "6", "1", "7");
// SOLR-6744
rsp = query("q", "*:*", "fl", "key:id", "sort", "payload asc", "rows", "20");
- assertFieldValues(rsp.getResults(), "key", 7, 1, 6, 4, 2, 10, 12, 3, 5, 9, 8, 13, 11);
+ assertFieldValues(rsp.getResults(), "key", "7", "1", "6", "4", "2", "10", "12", "3", "5", "9", "8", "13", "11");
rsp = query("q", "*:*", "fl", "key:id,id:text", "sort", "payload asc", "rows", "20");
- assertFieldValues(rsp.getResults(), "key", 7, 1, 6, 4, 2, 10, 12, 3, 5, 9, 8, 13, 11);
+ assertFieldValues(rsp.getResults(), "key", "7", "1", "6", "4", "2", "10", "12", "3", "5", "9", "8", "13", "11");
rsp = query("q", "text:a", "fl", "id", "sort", "payload asc", "rows", "20");
- assertFieldValues(rsp.getResults(), id, 1, 3, 5, 9);
+ assertFieldValues(rsp.getResults(), id, "1", "3", "5", "9");
rsp = query("q", "text:a", "fl", "id", "sort", "payload desc", "rows", "20");
- assertFieldValues(rsp.getResults(), id, 9, 5, 3, 1);
+ assertFieldValues(rsp.getResults(), id, "9", "5", "3", "1");
rsp = query("q", "text:b", "fl", "id", "sort", "payload asc", "rows", "20");
- assertFieldValues(rsp.getResults(), id, 4, 2, 10);
+ assertFieldValues(rsp.getResults(), id, "4", "2", "10");
rsp = query("q", "text:b", "fl", "id", "sort", "payload desc", "rows", "20");
- assertFieldValues(rsp.getResults(), id, 10, 2, 4);
+ assertFieldValues(rsp.getResults(), id, "10", "2", "4");
// SOLR-6744
rsp = query("q", "text:b", "fl", "key:id", "sort", "payload asc", "rows", "20");
assertFieldValues(rsp.getResults(), id, null, null, null);
rsp = query("q", "text:c", "fl", "id", "sort", "payload asc", "rows", "20");
- assertFieldValues(rsp.getResults(), id, 7, 6, 8);
+ assertFieldValues(rsp.getResults(), id, "7", "6", "8");
rsp = query("q", "text:c", "fl", "id", "sort", "payload desc", "rows", "20");
- assertFieldValues(rsp.getResults(), id, 8, 6, 7);
+ assertFieldValues(rsp.getResults(), id, "8", "6", "7");
rsp = query("q", "text:d", "fl", "id", "sort", "payload asc", "rows", "20");
- assertFieldValues(rsp.getResults(), id, 12, 13, 11);
+ assertFieldValues(rsp.getResults(), id, "12", "13", "11");
rsp = query("q", "text:d", "fl", "id", "sort", "payload desc", "rows", "20");
- assertFieldValues(rsp.getResults(), id, 11, 13, 12);
+ assertFieldValues(rsp.getResults(), id, "11", "13", "12");
// sanity check function sorting
- rsp = query("q", "id:[1 TO 10]", "fl", "id", "rows", "20",
- "sort", "abs(sub(5,id)) asc, id desc");
- assertFieldValues(rsp.getResults(), id, 5 , 6,4 , 7,3 , 8,2 , 9,1 , 10 );
+ rsp = query("q", "id_i:[1 TO 10]", "fl", "id", "rows", "20",
+ "sort", "abs(sub(5,id_i)) asc, id desc");
+ assertFieldValues(rsp.getResults(), id, "5", "6","4", "7","3" , "8","2" , "9","1" , "10" );
// Add two more docs with same payload as in doc #4
index(id, "14", "text", "b", "payload", ByteBuffer.wrap(new byte[] { 0x25, 0x21, 0x15 }));
@@ -114,9 +114,9 @@ public class DistributedQueryComponentCustomSortTest extends BaseDistributedSear
commit();
- rsp = query("q", "*:*", "fl", "id", "sort", "payload asc, id desc", "rows", "20");
- assertFieldValues(rsp.getResults(), id, 7, 1, 6, 15,14,4, 2, 18,17,16,10, 12, 3, 5, 9, 8, 13, 11);
- rsp = query("q", "*:*", "fl", "id", "sort", "payload desc, id asc", "rows", "20");
- assertFieldValues(rsp.getResults(), id, 11, 13, 8, 9, 5, 3, 12, 10,16,17,18, 2, 4,14,15, 6, 1, 7);
+ rsp = query("q", "*:*", "fl", "id", "sort", "payload asc, id_i desc", "rows", "20");
+ assertFieldValues(rsp.getResults(), id, "7", "1", "6", "15","14","4", "2", "18","17","16","10", "12", "3", "5", "9", "8", "13", "11");
+ rsp = query("q", "*:*", "fl", "id", "sort", "payload desc, id_i asc", "rows", "20");
+ assertFieldValues(rsp.getResults(), id, "11", "13", "8", "9", "5", "3", "12", "10","16","17","18", "2", "4","14","15", "6", "1", "7");
}
}
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/e18e2e77/solr/core/src/test/org/apache/solr/handler/component/StatsComponentTest.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/handler/component/StatsComponentTest.java b/solr/core/src/test/org/apache/solr/handler/component/StatsComponentTest.java
index 1798ae5..568676c 100644
--- a/solr/core/src/test/org/apache/solr/handler/component/StatsComponentTest.java
+++ b/solr/core/src/test/org/apache/solr/handler/component/StatsComponentTest.java
@@ -94,8 +94,8 @@ public class StatsComponentTest extends AbstractSolrTestCase {
// NOTE: doTestFieldStatisticsResult needs the full list of possible tags to exclude
params("stats.field", f, "stats", "true"),
params("stats.field", "{!ex=fq1,fq2}"+f, "stats", "true",
- "fq", "{!tag=fq1}-id:[0 TO 2]",
- "fq", "{!tag=fq2}-id:[2 TO 1000]"),
+ "fq", "{!tag=fq1}-id_i:[0 TO 2]",
+ "fq", "{!tag=fq2}-id_i:[2 TO 1000]"),
params("stats.field", "{!ex=fq1}"+f, "stats", "true",
"fq", "{!tag=fq1}id:1")
};
@@ -299,8 +299,8 @@ public class StatsComponentTest extends AbstractSolrTestCase {
params("stats.field", "{!ex=fq1}"+f, "stats", "true",
"fq", "{!tag=fq1}id:1"),
params("stats.field", "{!ex=fq1,fq2}"+f, "stats", "true",
- "fq", "{!tag=fq1}-id:[0 TO 2]",
- "fq", "{!tag=fq2}-id:[2 TO 1000]") }) {
+ "fq", "{!tag=fq1}-id_i:[0 TO 2]",
+ "fq", "{!tag=fq2}-id_i:[2 TO 1000]") }) {
assertQ("test statistics values",
@@ -878,19 +878,19 @@ public class StatsComponentTest extends AbstractSolrTestCase {
Map<String, String> args = new HashMap<String, String>();
args.put(CommonParams.Q, "*:*");
args.put(StatsParams.STATS, "true");
- args.put(StatsParams.STATS_FIELD, "{!ex=id}id");
- args.put("fq", "{!tag=id}id:[2 TO 3]");
+ args.put(StatsParams.STATS_FIELD, "{!ex=id}id_i");
+ args.put("fq", "{!tag=id}id_i:[2 TO 3]");
SolrQueryRequest req = new LocalSolrQueryRequest(core, new MapSolrParams(args));
assertQ("test exluding filter query", req
- , "//lst[@name='id']/double[@name='min'][.='1.0']"
- , "//lst[@name='id']/double[@name='max'][.='4.0']");
+ , "//lst[@name='id_i']/double[@name='min'][.='1.0']"
+ , "//lst[@name='id_i']/double[@name='max'][.='4.0']");
args = new HashMap<String, String>();
args.put(CommonParams.Q, "*:*");
args.put(StatsParams.STATS, "true");
- args.put(StatsParams.STATS_FIELD, "{!key=id2}id");
- args.put("fq", "{!tag=id}id:[2 TO 3]");
+ args.put(StatsParams.STATS_FIELD, "{!key=id2}id_i");
+ args.put("fq", "{!tag=id}id_i:[2 TO 3]");
req = new LocalSolrQueryRequest(core, new MapSolrParams(args));
assertQ("test rename field", req
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/e18e2e77/solr/core/src/test/org/apache/solr/handler/component/TestDistributedStatsComponentCardinality.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/handler/component/TestDistributedStatsComponentCardinality.java b/solr/core/src/test/org/apache/solr/handler/component/TestDistributedStatsComponentCardinality.java
index c703683..dca45dc 100644
--- a/solr/core/src/test/org/apache/solr/handler/component/TestDistributedStatsComponentCardinality.java
+++ b/solr/core/src/test/org/apache/solr/handler/component/TestDistributedStatsComponentCardinality.java
@@ -244,7 +244,7 @@ public class TestDistributedStatsComponentCardinality extends BaseDistributedSea
final int highId,
final int log2m,
final int regwidth) {
- ModifiableSolrParams p = params("q", "id:["+lowId+" TO "+highId+"]",
+ ModifiableSolrParams p = params("q", "id_i1:["+lowId+" TO "+highId+"]",
"rows", "0", "stats", "true");
final String prefix = "{!cardinality=true hllLog2m="+log2m+" hllRegwidth="+regwidth;
for (String f : STAT_FIELDS) {
@@ -267,7 +267,7 @@ public class TestDistributedStatsComponentCardinality extends BaseDistributedSea
final int highId,
final double lowAccuracy,
final double highAccuracy) {
- ModifiableSolrParams p = params("q", "id:["+lowId+" TO "+highId+"]",
+ ModifiableSolrParams p = params("q", "id_i1:["+lowId+" TO "+highId+"]",
"rows", "0", "stats", "true");
final String[] prefixes = new String[] {
"{!cardinality=" + lowAccuracy + " key=low_",
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/e18e2e77/solr/core/src/test/org/apache/solr/request/SimpleFacetsTest.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/request/SimpleFacetsTest.java b/solr/core/src/test/org/apache/solr/request/SimpleFacetsTest.java
index fd8d6ec..8f4a24d 100644
--- a/solr/core/src/test/org/apache/solr/request/SimpleFacetsTest.java
+++ b/solr/core/src/test/org/apache/solr/request/SimpleFacetsTest.java
@@ -236,7 +236,7 @@ public class SimpleFacetsTest extends SolrTestCaseJ4 {
@Test
public void testCachingBigTerms() throws Exception {
- assertQ( req("indent","true", "q", "id:[42 TO 47]",
+ assertQ( req("indent","true", "q", "id_i1:[42 TO 47]",
"facet", "true",
"facet.field", "foo_s" // big terms should cause foo_s:A to be cached
),
@@ -270,7 +270,7 @@ public class SimpleFacetsTest extends SolrTestCaseJ4 {
assertQ(
req(
"q", "*:*",
- "fq", "id:[2000 TO 2004]",
+ "fq", "id_i1:[2000 TO 2004]",
"group", "true",
"group.facet", "true",
"group.field", "hotel_s1",
@@ -284,7 +284,7 @@ public class SimpleFacetsTest extends SolrTestCaseJ4 {
assertQ(
req(
"q", "*:*",
- "fq", "id:[2000 TO 2004]",
+ "fq", "id_i1:[2000 TO 2004]",
"fq", "{!tag=dus}airport_s1:dus",
"group", "true",
"group.facet", "true",
@@ -298,7 +298,7 @@ public class SimpleFacetsTest extends SolrTestCaseJ4 {
assertQ(
req(
"q", "*:*",
- "fq", "id:[2000 TO 2004]",
+ "fq", "id_i1:[2000 TO 2004]",
"group", "true",
"group.facet", "true",
"group.field", "hotel_s1",
@@ -320,7 +320,7 @@ public class SimpleFacetsTest extends SolrTestCaseJ4 {
assertQ(
req(
"q", "*:*",
- "fq", "id:[2000 TO 2004]",
+ "fq", "id_i1:[2000 TO 2004]",
"fq", "{!tag=dus}airport_s1:dus",
"group", "true",
"group.facet", "true",
@@ -344,7 +344,7 @@ public class SimpleFacetsTest extends SolrTestCaseJ4 {
assertQ(
req(
"q", "*:*",
- "fq", "id:[2000 TO 2004]",
+ "fq", "id_i1:[2000 TO 2004]",
"fq", "{!tag=dus}airport_s1:dus",
"group", "true",
"group.facet", "true",
@@ -380,14 +380,14 @@ public class SimpleFacetsTest extends SolrTestCaseJ4 {
private void testSimpleGroupedFacets(String facetLimit) throws Exception {
assertQ(
"Return 5 docs with id range 1937 till 1940",
- req("id:[2000 TO 2004]"),
+ req("id_i1:[2000 TO 2004]"),
"*[count(//doc)=5]"
);
assertQ(
"Return two facet counts for field airport_a and duration_i1",
req(
"q", "*:*",
- "fq", "id:[2000 TO 2004]",
+ "fq", "id_i1:[2000 TO 2004]",
"group", "true",
"group.facet", "true",
"group.field", "hotel_s1",
@@ -410,7 +410,7 @@ public class SimpleFacetsTest extends SolrTestCaseJ4 {
"Return one facet count for field airport_a using facet.offset",
req(
"q", "*:*",
- "fq", "id:[2000 TO 2004]",
+ "fq", "id_i1:[2000 TO 2004]",
"group", "true",
"group.facet", "true",
"group.field", "hotel_s1",
@@ -427,7 +427,7 @@ public class SimpleFacetsTest extends SolrTestCaseJ4 {
"Return two facet counts for field airport_a with fq",
req(
"q", "*:*",
- "fq", "id:[2000 TO 2004]",
+ "fq", "id_i1:[2000 TO 2004]",
"fq", "duration_i1:5",
"group", "true",
"group.facet", "true",
@@ -445,7 +445,7 @@ public class SimpleFacetsTest extends SolrTestCaseJ4 {
"Return one facet count for field airport_s1 with prefix a",
req(
"q", "*:*",
- "fq", "id:[2000 TO 2004]",
+ "fq", "id_i1:[2000 TO 2004]",
"group", "true",
"group.facet", "true",
"group.field", "hotel_s1",
@@ -463,7 +463,7 @@ public class SimpleFacetsTest extends SolrTestCaseJ4 {
h.query(
req(
"q", "*:*",
- "fq", "id:[2000 TO 2004]",
+ "fq", "id_i1:[2000 TO 2004]",
"group.facet", "true",
"facet", "true",
"facet.field", "airport_s1",
@@ -541,26 +541,26 @@ public class SimpleFacetsTest extends SolrTestCaseJ4 {
public void testSimpleFacetCounts() {
assertQ("standard request handler returns all matches",
- req("id:[42 TO 47]"),
+ req("id_i1:[42 TO 47]"),
"*[count(//doc)=6]"
);
assertQ("filter results using fq",
- req("q","id:[42 TO 46]",
- "fq", "id:[43 TO 47]"),
+ req("q","id_i1:[42 TO 46]",
+ "fq", "id_i1:[43 TO 47]"),
"*[count(//doc)=4]"
);
assertQ("don't filter results using blank fq",
- req("q","id:[42 TO 46]",
+ req("q","id_i1:[42 TO 46]",
"fq", " "),
"*[count(//doc)=5]"
);
assertQ("filter results using multiple fq params",
- req("q","id:[42 TO 46]",
+ req("q","id_i1:[42 TO 46]",
"fq", "trait_s:Obnoxious",
- "fq", "id:[43 TO 47]"),
+ "fq", "id_i1:[43 TO 47]"),
"*[count(//doc)=1]"
);
@@ -570,19 +570,19 @@ public class SimpleFacetsTest extends SolrTestCaseJ4 {
for(String[] methodParam : new String[][]{ none, uifSwitch}){
assertQ("check counts for facet queries",
req(methodParam
- ,"q", "id:[42 TO 47]"
+ ,"q", "id_i1:[42 TO 47]"
,"facet", "true"
,"facet.query", "trait_s:Obnoxious"
- ,"facet.query", "id:[42 TO 45]"
- ,"facet.query", "id:[43 TO 47]"
+ ,"facet.query", "id_i1:[42 TO 45]"
+ ,"facet.query", "id_i1:[43 TO 47]"
,"facet.field", "trait_s"
)
,"*[count(//doc)=6]"
,"//lst[@name='facet_counts']/lst[@name='facet_queries']"
,"//lst[@name='facet_queries']/int[@name='trait_s:Obnoxious'][.='2']"
- ,"//lst[@name='facet_queries']/int[@name='id:[42 TO 45]'][.='4']"
- ,"//lst[@name='facet_queries']/int[@name='id:[43 TO 47]'][.='5']"
+ ,"//lst[@name='facet_queries']/int[@name='id_i1:[42 TO 45]'][.='4']"
+ ,"//lst[@name='facet_queries']/int[@name='id_i1:[43 TO 47]'][.='5']"
,"//lst[@name='facet_counts']/lst[@name='facet_fields']"
,"//lst[@name='facet_fields']/lst[@name='trait_s']"
@@ -593,11 +593,11 @@ public class SimpleFacetsTest extends SolrTestCaseJ4 {
);
assertQ("check multi-select facets with naming",
- req(methodParam, "q", "id:[42 TO 47]"
+ req(methodParam, "q", "id_i1:[42 TO 47]"
,"facet", "true"
,"facet.query", "{!ex=1}trait_s:Obnoxious"
- ,"facet.query", "{!ex=2 key=foo}id:[42 TO 45]" // tag=2 same as 1
- ,"facet.query", "{!ex=3,4 key=bar}id:[43 TO 47]" // tag=3,4 don't exist
+ ,"facet.query", "{!ex=2 key=foo}id_i1:[42 TO 45]" // tag=2 same as 1
+ ,"facet.query", "{!ex=3,4 key=bar}id_i1:[43 TO 47]" // tag=3,4 don't exist
,"facet.field", "{!ex=3,1}trait_s" // 3,1 same as 1
,"fq", "{!tag=1,2}id:47" // tagged as 1 and 2
)
@@ -629,17 +629,17 @@ public class SimpleFacetsTest extends SolrTestCaseJ4 {
for(String[] methodParam : new String[][]{ none, uifSwitch}){
assertQ("check counts for applied facet queries using filtering (fq)",
req(methodParam
- ,"q", "id:[42 TO 47]"
+ ,"q", "id_i1:[42 TO 47]"
,"facet", "true"
- ,"fq", "id:[42 TO 45]"
+ ,"fq", "id_i1:[42 TO 45]"
,"facet.field", "trait_s"
- ,"facet.query", "id:[42 TO 45]"
- ,"facet.query", "id:[43 TO 47]"
+ ,"facet.query", "id_i1:[42 TO 45]"
+ ,"facet.query", "id_i1:[43 TO 47]"
)
,"*[count(//doc)=4]"
,"//lst[@name='facet_counts']/lst[@name='facet_queries']"
- ,"//lst[@name='facet_queries']/int[@name='id:[42 TO 45]'][.='4']"
- ,"//lst[@name='facet_queries']/int[@name='id:[43 TO 47]'][.='3']"
+ ,"//lst[@name='facet_queries']/int[@name='id_i1:[42 TO 45]'][.='4']"
+ ,"//lst[@name='facet_queries']/int[@name='id_i1:[43 TO 47]'][.='3']"
,"*[count(//lst[@name='trait_s']/int)=4]"
,"//lst[@name='trait_s']/int[@name='Tool'][.='2']"
,"//lst[@name='trait_s']/int[@name='Obnoxious'][.='1']"
@@ -649,11 +649,11 @@ public class SimpleFacetsTest extends SolrTestCaseJ4 {
assertQ("check counts with facet.zero=false&facet.missing=true using fq",
req(methodParam
- ,"q", "id:[42 TO 47]"
+ ,"q", "id_i1:[42 TO 47]"
,"facet", "true"
,"facet.zeros", "false"
,"f.trait_s.facet.missing", "true"
- ,"fq", "id:[42 TO 45]"
+ ,"fq", "id_i1:[42 TO 45]"
,"facet.field", "trait_s"
)
,"*[count(//doc)=4]"
@@ -666,11 +666,11 @@ public class SimpleFacetsTest extends SolrTestCaseJ4 {
assertQ("check counts with facet.mincount=1&facet.missing=true using fq",
req(methodParam
- ,"q", "id:[42 TO 47]"
+ ,"q", "id_i1:[42 TO 47]"
,"facet", "true"
,"facet.mincount", "1"
,"f.trait_s.facet.missing", "true"
- ,"fq", "id:[42 TO 45]"
+ ,"fq", "id_i1:[42 TO 45]"
,"facet.field", "trait_s"
)
,"*[count(//doc)=4]"
@@ -683,11 +683,11 @@ public class SimpleFacetsTest extends SolrTestCaseJ4 {
assertQ("check counts with facet.mincount=2&facet.missing=true using fq",
req(methodParam
- ,"q", "id:[42 TO 47]"
+ ,"q", "id_i1:[42 TO 47]"
,"facet", "true"
,"facet.mincount", "2"
,"f.trait_s.facet.missing", "true"
- ,"fq", "id:[42 TO 45]"
+ ,"fq", "id_i1:[42 TO 45]"
,"facet.field", "trait_s"
)
,"*[count(//doc)=4]"
@@ -698,9 +698,9 @@ public class SimpleFacetsTest extends SolrTestCaseJ4 {
assertQ("check sorted paging",
req(methodParam
- ,"q", "id:[42 TO 47]"
+ ,"q", "id_i1:[42 TO 47]"
,"facet", "true"
- ,"fq", "id:[42 TO 45]"
+ ,"fq", "id_i1:[42 TO 45]"
,"facet.field", "trait_s"
,"facet.mincount","0"
,"facet.offset","0"
@@ -715,9 +715,9 @@ public class SimpleFacetsTest extends SolrTestCaseJ4 {
// check that the default sort is by count
assertQ("check sorted paging",
- req(methodParam, "q", "id:[42 TO 47]"
+ req(methodParam, "q", "id_i1:[42 TO 47]"
,"facet", "true"
- ,"fq", "id:[42 TO 45]"
+ ,"fq", "id_i1:[42 TO 45]"
,"facet.field", "trait_s"
,"facet.mincount","0"
,"facet.offset","0"
@@ -732,9 +732,9 @@ public class SimpleFacetsTest extends SolrTestCaseJ4 {
//
// check that legacy facet.sort=true/false works
//
- assertQ(req(methodParam, "q", "id:[42 TO 47]"
+ assertQ(req(methodParam, "q", "id_i1:[42 TO 47]"
,"facet", "true"
- ,"fq", "id:[42 TO 45]"
+ ,"fq", "id_i1:[42 TO 45]"
,"facet.field", "trait_s"
,"facet.mincount","0"
,"facet.offset","0"
@@ -747,9 +747,9 @@ public class SimpleFacetsTest extends SolrTestCaseJ4 {
,"//int[3][@name='Obnoxious'][.='1']"
);
- assertQ(req(methodParam, "q", "id:[42 TO 47]"
+ assertQ(req(methodParam, "q", "id_i1:[42 TO 47]"
,"facet", "true"
- ,"fq", "id:[42 TO 45]"
+ ,"fq", "id_i1:[42 TO 45]"
,"facet.field", "trait_s"
,"facet.mincount","1"
,"facet.offset","0"
@@ -764,9 +764,9 @@ public class SimpleFacetsTest extends SolrTestCaseJ4 {
}
for(String method : new String[]{ "fc","uif"}){
- assertQ(req("q", "id:[42 TO 47]"
+ assertQ(req("q", "id_i1:[42 TO 47]"
,"facet", "true"
- ,"fq", "id:[42 TO 45]"
+ ,"fq", "id_i1:[42 TO 45]"
,"facet.field", "zerolen_s"
,(random().nextBoolean() ? "":"f.zerolen_s.")+"facet.method", method
)
@@ -1475,7 +1475,7 @@ public class SimpleFacetsTest extends SolrTestCaseJ4 {
String mid = (new Double( ((double)Float.MAX_VALUE) * 2D )).toString();
assertQ(f+": checking counts for lower",
- req( "q", "id:[30 TO 60]"
+ req( "q", "id_i1:[30 TO 60]"
,"rows", "0"
,"facet", "true"
,"facet.range", f
@@ -1714,7 +1714,7 @@ public class SimpleFacetsTest extends SolrTestCaseJ4 {
@Test
public void testNumericRangeFacetsTrieInt() {
- helpTestWholeNumberRangeFacets("id");
+ helpTestWholeNumberRangeFacets("id_i1");
}
@Test
public void testNumericRangeFacetsTrieLong() {
@@ -1723,7 +1723,7 @@ public class SimpleFacetsTest extends SolrTestCaseJ4 {
@Test
public void testNumericRangeFacetsTrieIntDocValues() {
- helpTestWholeNumberRangeFacets("id", FacetRangeMethod.DV);
+ helpTestWholeNumberRangeFacets("id_i1", FacetRangeMethod.DV);
}
@Test
@@ -1752,7 +1752,7 @@ public class SimpleFacetsTest extends SolrTestCaseJ4 {
String mid = (new Long( ((long)Integer.MAX_VALUE) * 2L )).toString();
assertQ(f+": checking counts for lower",
- req( "q", "id:[30 TO 60]"
+ req( "q", "id_i1:[30 TO 60]"
,"rows", "0"
,"facet", "true"
,"facet.range", f
@@ -1788,7 +1788,7 @@ public class SimpleFacetsTest extends SolrTestCaseJ4 {
final String meta = pre + "/../";
assertQ(f+": checking counts for lower",
- req( "q", "id:[30 TO 60]"
+ req( "q", "id_i1:[30 TO 60]"
,"rows", "0"
,"facet", "true"
,"facet.range", f
@@ -1810,7 +1810,7 @@ public class SimpleFacetsTest extends SolrTestCaseJ4 {
);
assertQ(f + ":checking counts for upper",
- req( "q", "id:[30 TO 60]"
+ req( "q", "id_i1:[30 TO 60]"
,"rows", "0"
,"facet", "true"
,"facet.range", f
@@ -2847,7 +2847,7 @@ public class SimpleFacetsTest extends SolrTestCaseJ4 {
private void doTestRangeQueryHardEndParam(String field, FacetRangeMethod method) {
assertQ("Test facet.range.hardend",
- req("q", "id:[42 TO 47]"
+ req("q", "id_i1:[42 TO 47]"
,"facet","true"
,"fl","id," + field
,"facet.range", field
@@ -2868,7 +2868,7 @@ public class SimpleFacetsTest extends SolrTestCaseJ4 {
);
assertQ("Test facet.range.hardend",
- req("q", "id:[42 TO 47]"
+ req("q", "id_i1:[42 TO 47]"
,"facet","true"
,"fl","id," + field
,"facet.range", field
@@ -2901,7 +2901,7 @@ public class SimpleFacetsTest extends SolrTestCaseJ4 {
private void doTestRangeQueryOtherParam(String field, FacetRangeMethod method) {
assertQ("Test facet.range.other",
- req("q", "id:[42 TO 47]"
+ req("q", "id_i1:[42 TO 47]"
,"facet","true"
,"fl","id," + field
,"facet.range", field
@@ -2921,7 +2921,7 @@ public class SimpleFacetsTest extends SolrTestCaseJ4 {
);
assertQ("Test facet.range.other",
- req("q", "id:[42 TO 47]"
+ req("q", "id_i1:[42 TO 47]"
,"facet","true"
,"fl","id," + field
,"facet.range", field
@@ -2941,7 +2941,7 @@ public class SimpleFacetsTest extends SolrTestCaseJ4 {
);
assertQ("Test facet.range.other",
- req("q", "id:[42 TO 47]"
+ req("q", "id_i1:[42 TO 47]"
,"facet","true"
,"fl","id," + field
,"facet.range", field
@@ -2961,7 +2961,7 @@ public class SimpleFacetsTest extends SolrTestCaseJ4 {
);
assertQ("Test facet.range.other",
- req("q", "id:[42 TO 47]"
+ req("q", "id_i1:[42 TO 47]"
,"facet","true"
,"fl","id," + field
,"facet.range", field
@@ -2982,7 +2982,7 @@ public class SimpleFacetsTest extends SolrTestCaseJ4 {
// these should have equivilent behavior (multivalued 'other' param: top level vs local)
for (SolrQueryRequest req : new SolrQueryRequest[] {
- req("q", "id:[42 TO 47]"
+ req("q", "id_i1:[42 TO 47]"
,"facet","true"
,"fl","id," + field
,"facet.range", field
@@ -2992,7 +2992,7 @@ public class SimpleFacetsTest extends SolrTestCaseJ4 {
,"facet.range.gap","1"
,"facet.range.other",FacetRangeOther.BEFORE.toString()
,"facet.range.other",FacetRangeOther.AFTER.toString()),
- req("q", "id:[42 TO 47]"
+ req("q", "id_i1:[42 TO 47]"
,"facet","true"
,"fl","id," + field
,"facet.range", "{!facet.range.other=before facet.range.other=after}" + field
@@ -3013,7 +3013,7 @@ public class SimpleFacetsTest extends SolrTestCaseJ4 {
}
assertQ("Test facet.range.other",
- req("q", "id:[42 TO 47]"
+ req("q", "id_i1:[42 TO 47]"
,"facet","true"
,"fl","id," + field
,"facet.range", field
@@ -3035,7 +3035,7 @@ public class SimpleFacetsTest extends SolrTestCaseJ4 {
);
assertQ("Test facet.range.other",
- req("q", "id:[42 TO 47]"
+ req("q", "id_i1:[42 TO 47]"
,"facet","true"
,"fl","id," + field
,"facet.range", field
@@ -3056,7 +3056,7 @@ public class SimpleFacetsTest extends SolrTestCaseJ4 {
);
assertQ("Test facet.range.other",
- req("q", "id:[42 TO 47]"
+ req("q", "id_i1:[42 TO 47]"
,"facet","true"
,"fl","id," + field
,"facet.range", field
@@ -3077,7 +3077,7 @@ public class SimpleFacetsTest extends SolrTestCaseJ4 {
);
assertQ("Test facet.range.other",
- req("q", "id:[42 TO 47]"
+ req("q", "id_i1:[42 TO 47]"
,"facet","true"
,"fl","id," + field
,"facet.range", field
@@ -3098,7 +3098,7 @@ public class SimpleFacetsTest extends SolrTestCaseJ4 {
);
assertQ("Test facet.range.other",
- req("q", "id:[42 TO 47]"
+ req("q", "id_i1:[42 TO 47]"
,"facet","true"
,"fl","id," + field
,"facet.range", field
@@ -3119,7 +3119,7 @@ public class SimpleFacetsTest extends SolrTestCaseJ4 {
);
assertQ("Test facet.range.other",
- req("q", "id:[12345 TO 12345]"
+ req("q", "id_i1:[12345 TO 12345]"
,"facet","true"
,"fl","id," + field
,"facet.range", field
@@ -3138,7 +3138,7 @@ public class SimpleFacetsTest extends SolrTestCaseJ4 {
);
assertQ("Test facet.range.other",
- req("q", "id:[42 TO 47]"
+ req("q", "id_i1:[42 TO 47]"
,"facet","true"
,"fl","id," + field
,"facet.range", field
@@ -3332,7 +3332,7 @@ public class SimpleFacetsTest extends SolrTestCaseJ4 {
public void testFacetPrefixWithFacetThreads() throws Exception {
assertQ("Test facet.prefix with facet.thread",
- req("q", "id:[101 TO 102]"
+ req("q", "id_i1:[101 TO 102]"
,"facet","true"
,"facet.field", "{!key=key1 facet.prefix=foo}myfield_s"
,"facet.field", "{!key=key2 facet.prefix=bar}myfield_s"
@@ -3352,7 +3352,7 @@ public class SimpleFacetsTest extends SolrTestCaseJ4 {
values[0] = random().nextInt(3000);
values[1] = random().nextInt(3000);
Arrays.sort(values);
- return String.format(Locale.ROOT, "id: [%d TO %d]", values[0], values[1]);
+ return String.format(Locale.ROOT, "id_i1:[%d TO %d]", values[0], values[1]);
}
@@ -3375,7 +3375,7 @@ public class SimpleFacetsTest extends SolrTestCaseJ4 {
}
private ModifiableSolrParams getRandomParamsInt() {
- String field = new String[]{"range_facet_l_dv", "range_facet_i_dv", "range_facet_l", "duration_i1", "id"}[random().nextInt(5)];
+ String field = new String[]{"range_facet_l_dv", "range_facet_i_dv", "range_facet_l", "duration_i1", "id_i1"}[random().nextInt(5)];
ModifiableSolrParams params = new ModifiableSolrParams();
Integer[] values = new Integer[2];
do {
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/e18e2e77/solr/core/src/test/org/apache/solr/schema/TestBinaryField.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/schema/TestBinaryField.java b/solr/core/src/test/org/apache/solr/schema/TestBinaryField.java
index 9b42749..b3376c8 100644
--- a/solr/core/src/test/org/apache/solr/schema/TestBinaryField.java
+++ b/solr/core/src/test/org/apache/solr/schema/TestBinaryField.java
@@ -105,7 +105,7 @@ public class TestBinaryField extends SolrJettyTestBase {
assertEquals(3, beans.size());
for (SolrDocument d : res) {
- Integer id = (Integer) d.getFieldValue("id");
+ Integer id = Integer.parseInt(d.getFieldValue("id").toString());
byte[] data = (byte[]) d.getFieldValue("data");
if (id == 1) {
assertEquals(5, data.length);
@@ -133,7 +133,7 @@ public class TestBinaryField extends SolrJettyTestBase {
}
for (Bean d : beans) {
- Integer id = d.id;
+ Integer id = Integer.parseInt(d.id);
byte[] data = d.data;
if (id == 1) {
assertEquals(5, data.length);
@@ -165,7 +165,7 @@ public class TestBinaryField extends SolrJettyTestBase {
}
public static class Bean{
@Field
- int id;
+ String id;
@Field
byte [] data;
}
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/e18e2e77/solr/core/src/test/org/apache/solr/search/TestCustomSort.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/search/TestCustomSort.java b/solr/core/src/test/org/apache/solr/search/TestCustomSort.java
index ca33ea0..74b8301 100644
--- a/solr/core/src/test/org/apache/solr/search/TestCustomSort.java
+++ b/solr/core/src/test/org/apache/solr/search/TestCustomSort.java
@@ -49,7 +49,7 @@ public class TestCustomSort extends SolrTestCaseJ4 {
assertU(adoc(sdoc("id", "13", "text", "d", "payload", ByteBuffer.wrap(new byte[] { (byte)0x80, 0x11, 0x33 })))); // 12
assertU(commit());
- assertQ(req("q", "*:*", "fl", "id", "sort", "payload asc", "rows", "20")
+ assertQ(req("q", "*:*", "fl", "id_i", "sort", "payload asc", "rows", "20")
, "//result[@numFound='13']" // <result name="response" numFound="13" start="0">
, "//result/doc[int='7' and position()=1]" // <doc><int name="id">7</int></doc> 00 3c 73
, "//result/doc[int='1' and position()=2]" // <doc><int name="id">1</int></doc> 12 62 15
@@ -64,7 +64,7 @@ public class TestCustomSort extends SolrTestCaseJ4 {
, "//result/doc[int='8' and position()=11]" // <doc><int name="id">8</int></doc> 59 2d 4d
, "//result/doc[int='13' and position()=12]" // <doc><int name="id">13</int></doc> 80 11 33
, "//result/doc[int='11' and position()=13]"); // <doc><int name="id">11</int></doc> ff af 9c
- assertQ(req("q", "*:*", "fl", "id", "sort", "payload desc", "rows", "20")
+ assertQ(req("q", "*:*", "fl", "id_i", "sort", "payload desc", "rows", "20")
, "//result[@numFound='13']" // <result name="response" numFound="13" start="0">
, "//result/doc[int='11' and position()=1]" // <doc><int name="id">11</int></doc> ff af 9c
, "//result/doc[int='13' and position()=2]" // <doc><int name="id">13</int></doc> 80 11 33
@@ -79,44 +79,44 @@ public class TestCustomSort extends SolrTestCaseJ4 {
, "//result/doc[int='6' and position()=11]" // <doc><int name="id">6</int></doc> 1a 2b 3c 00 00 03
, "//result/doc[int='1' and position()=12]" // <doc><int name="id">1</int></doc> 12 62 15
, "//result/doc[int='7' and position()=13]"); // <doc><int name="id">7</int></doc> 00 3c 73
- assertQ(req("q", "text:a", "fl", "id", "sort", "payload asc", "rows", "20")
+ assertQ(req("q", "text:a", "fl", "id_i", "sort", "payload asc", "rows", "20")
, "//result[@numFound='4']" // <result name="response" numFound="4" start="0">
, "//result/doc[int='1' and position()=1]" // <doc><int name="id">1</int></doc> 12 62 15
, "//result/doc[int='3' and position()=2]" // <doc><int name="id">3</int></doc> 35 32 58
, "//result/doc[int='5' and position()=3]" // <doc><int name="id">5</int></doc> 35 35 10 00
, "//result/doc[int='9' and position()=4]"); // <doc><int name="id">9</int></doc> 39 79 7a
- assertQ(req("q", "text:a", "fl", "id", "sort", "payload desc", "rows", "20")
+ assertQ(req("q", "text:a", "fl", "id_i", "sort", "payload desc", "rows", "20")
, "//result[@numFound='4']" // <result name="response" numFound="4" start="0">
, "//result/doc[int='9' and position()=1]" // <doc><int name="id">9</int></doc> 39 79 7a
, "//result/doc[int='5' and position()=2]" // <doc><int name="id">5</int></doc> 35 35 10 00
, "//result/doc[int='3' and position()=3]" // <doc><int name="id">3</int></doc> 35 32 58
, "//result/doc[int='1' and position()=4]"); // <doc><int name="id">1</int></doc> 12 62 15
- assertQ(req("q", "text:b", "fl", "id", "sort", "payload asc", "rows", "20")
+ assertQ(req("q", "text:b", "fl", "id_i", "sort", "payload asc", "rows", "20")
, "//result[@numFound='3']" // <result name="response" numFound="3" start="0">
, "//result/doc[int='4' and position()=1]" // <doc><int name="id">4</int></doc> 25 21 15
, "//result/doc[int='2' and position()=2]" // <doc><int name="id">2</int></doc> 25 21 16
, "//result/doc[int='10' and position()=3]"); // <doc><int name="id">10</int></doc> 31 39 7c
- assertQ(req("q", "text:b", "fl", "id", "sort", "payload desc", "rows", "20")
+ assertQ(req("q", "text:b", "fl", "id_i", "sort", "payload desc", "rows", "20")
, "//result[@numFound='3']" // <result name="response" numFound="3" start="0">
, "//result/doc[int='10' and position()=1]" // <doc><int name="id">10</int></doc> 31 39 7c
, "//result/doc[int='2' and position()=2]" // <doc><int name="id">2</int></doc> 25 21 16
, "//result/doc[int='4' and position()=3]"); // <doc><int name="id">4</int></doc> 25 21 15
- assertQ(req("q", "text:c", "fl", "id", "sort", "payload asc", "rows", "20")
+ assertQ(req("q", "text:c", "fl", "id_i", "sort", "payload asc", "rows", "20")
, "//result[@numFound='3']" // <result name="response" numFound="3" start="0">
, "//result/doc[int='7' and position()=1]" // <doc><int name="id">7</int></doc> 00 3c 73
, "//result/doc[int='6' and position()=2]" // <doc><int name="id">6</int></doc> 1a 2b 3c 00 00 03
, "//result/doc[int='8' and position()=3]"); // <doc><int name="id">8</int></doc> 59 2d 4d
- assertQ(req("q", "text:c", "fl", "id", "sort", "payload desc", "rows", "20")
+ assertQ(req("q", "text:c", "fl", "id_i", "sort", "payload desc", "rows", "20")
, "//result[@numFound='3']" // <result name="response" numFound="3" start="0">
, "//result/doc[int='8' and position()=1]" // <doc><int name="id">8</int></doc> 59 2d 4d
, "//result/doc[int='6' and position()=2]" // <doc><int name="id">6</int></doc> 1a 2b 3c 00 00 03
, "//result/doc[int='7' and position()=3]"); // <doc><int name="id">7</int></doc> 00 3c 73
- assertQ(req("q", "text:d", "fl", "id", "sort", "payload asc", "rows", "20")
+ assertQ(req("q", "text:d", "fl", "id_i", "sort", "payload asc", "rows", "20")
, "//result[@numFound='3']" // <result name="response" numFound="3" start="0">
, "//result/doc[int='12' and position()=1]" // <doc><int name="id">12</int></doc> 34 dd 4d
, "//result/doc[int='13' and position()=2]" // <doc><int name="id">13</int></doc> 80 11 33
, "//result/doc[int='11' and position()=3]"); // <doc><int name="id">11</int></doc> ff af 9c
- assertQ(req("q", "text:d", "fl", "id", "sort", "payload desc", "rows", "20")
+ assertQ(req("q", "text:d", "fl", "id_i", "sort", "payload desc", "rows", "20")
, "//result[@numFound='3']" // <result name="response" numFound="3" start="0">
, "//result/doc[int='11' and position()=1]" // <doc><int name="id">11</int></doc> ff af 9c
, "//result/doc[int='13' and position()=2]" // <doc><int name="id">13</int></doc> 80 11 33
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/e18e2e77/solr/core/src/test/org/apache/solr/search/TestFieldSortValues.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/search/TestFieldSortValues.java b/solr/core/src/test/org/apache/solr/search/TestFieldSortValues.java
index 781127b..3e07bf3 100644
--- a/solr/core/src/test/org/apache/solr/search/TestFieldSortValues.java
+++ b/solr/core/src/test/org/apache/solr/search/TestFieldSortValues.java
@@ -41,10 +41,10 @@ public class TestFieldSortValues extends SolrTestCaseJ4 {
// payload is backed by a custom sort field which returns the payload value mod 3
assertQ(req("q", "*:*", "fl", "id", "sort", "payload asc, id asc", "fsv", "true")
- , "//result/doc[int='2' and position()=1]"
- , "//result/doc[int='3' and position()=2]"
- , "//result/doc[int='5' and position()=3]"
- , "//result/doc[int='1' and position()=4]"
- , "//result/doc[int='4' and position()=5]");
+ , "//result/doc[str='2' and position()=1]"
+ , "//result/doc[str='3' and position()=2]"
+ , "//result/doc[str='5' and position()=3]"
+ , "//result/doc[str='1' and position()=4]"
+ , "//result/doc[str='4' and position()=5]");
}
}
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/e18e2e77/solr/core/src/test/org/apache/solr/search/stats/TestDistribIDF.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/search/stats/TestDistribIDF.java b/solr/core/src/test/org/apache/solr/search/stats/TestDistribIDF.java
index c355932..cac2dc5 100644
--- a/solr/core/src/test/org/apache/solr/search/stats/TestDistribIDF.java
+++ b/solr/core/src/test/org/apache/solr/search/stats/TestDistribIDF.java
@@ -78,14 +78,14 @@ public class TestDistribIDF extends SolrTestCaseJ4 {
createCollection("onecollection_local", "conf2", ImplicitDocRouter.NAME);
SolrInputDocument doc = new SolrInputDocument();
- doc.setField("id", 1);
+ doc.setField("id", "1");
doc.setField("cat", "football");
doc.addField(ShardParams._ROUTE_, "a");
solrCluster.getSolrClient().add("onecollection", doc);
solrCluster.getSolrClient().add("onecollection_local", doc);
doc = new SolrInputDocument();
- doc.setField("id", 2);
+ doc.setField("id", "2");
doc.setField("cat", "football");
doc.addField(ShardParams._ROUTE_, "b");
solrCluster.getSolrClient().add("onecollection", doc);
@@ -94,7 +94,7 @@ public class TestDistribIDF extends SolrTestCaseJ4 {
int nDocs = TestUtil.nextInt(random(), 10, 100);
for (int i=0; i<nDocs; i++) {
doc = new SolrInputDocument();
- doc.setField("id", 3 + i);
+ doc.setField("id", "" + (3 + i));
String cat = TestUtil.randomSimpleString(random());
if (!cat.equals("football")) { //Making sure no other document has the query term in it.
doc.setField("cat", cat);
@@ -129,8 +129,8 @@ public class TestDistribIDF extends SolrTestCaseJ4 {
query.setFields("*,score");
queryResponse = solrClient_local.query("onecollection_local", query);
assertEquals(2, queryResponse.getResults().getNumFound());
- assertEquals(2, queryResponse.getResults().get(0).get("id"));
- assertEquals(1, queryResponse.getResults().get(1).get("id"));
+ assertEquals("2", queryResponse.getResults().get(0).get("id"));
+ assertEquals("1", queryResponse.getResults().get(1).get("id"));
float score1_local = (float) queryResponse.getResults().get(0).get("score");
float score2_local = (float) queryResponse.getResults().get(1).get("score");
assertEquals("Doc1 score=" + score1_local + " Doc2 score=" + score2_local, 1,
@@ -176,8 +176,8 @@ public class TestDistribIDF extends SolrTestCaseJ4 {
query.setFields("*,score").add("collection", "collection1_local,collection2_local");
queryResponse = solrClient_local.query("collection1_local", query);
assertEquals(2, queryResponse.getResults().getNumFound());
- assertEquals(2, queryResponse.getResults().get(0).get("id"));
- assertEquals(1, queryResponse.getResults().get(1).get("id"));
+ assertEquals("2", queryResponse.getResults().get(0).get("id"));
+ assertEquals("1", queryResponse.getResults().get(1).get("id"));
float score1_local = (float) queryResponse.getResults().get(0).get("score");
float score2_local = (float) queryResponse.getResults().get(1).get("score");
assertEquals("Doc1 score=" + score1_local + " Doc2 score=" + score2_local, 1,