Skip to content

Commit

Permalink
Schema.xml: updated indexstamp to be tdate and fixed parsing of date …
Browse files Browse the repository at this point in the history
…ranges
  • Loading branch information
romanchyla committed Oct 6, 2015
1 parent 70e4f8f commit ef389cd
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ public AqpAdsabsQParser(AqpQueryParser parser, String qstr, SolrParams localPara
}

ncm.put("date", new NumericConfig(6, new NumberDateFormat(sdf), NumericType.LONG));
ncm.put("indexstamp", new NumericConfig(6, new NumberDateFormat(sdf), NumericType.LONG));

// when precision step=0 (ie use the default solr value), then it is Integer.MAX_VALUE
for (String field: new String[]{"recid", "pubdate_sort", "citation_count", "classic_factor", "simbid"}) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,16 @@ public void test() throws Exception {
"defType", "aqp", "qf", "title keyword"),
"+date:[1356998400000 TO 1388534400000} +title:foo",
BooleanQuery.class);



// indexstamp range queries were not properly parsed
assertQueryEquals(req("q", "indexstamp:[\"2012-10-01T00:00:00\" TO \"2021-12-01T00:00:00Z\"]",
"defType", "aqp"),
"indexstamp:[1349049600000 TO 1638316800000]",
NumericRangeQuery.class);
assertQ(req("q", "indexstamp:[\"2012-10-01T00:00:00\" TO \"2021-12-01T00:00:00Z\"]", "indent", "true"),
"//*[@numFound='16']"
);
}

}
6 changes: 2 additions & 4 deletions contrib/examples/adsabs/solr/collection1/conf/schema.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1420,11 +1420,9 @@
complete and correct
Example query:
indexstamp:[2013-03-04T22:01:32.809Z TO *]
indexstamp:["2013-03-04T22:01:32.809Z" TO "2023-03-04T22:01:32.809Z"]
-->
<field name="indexstamp" type="date" indexed="true" stored="true"
<field name="indexstamp" type="tdate" indexed="true" stored="true"
default="NOW" multiValued="false" />

<field name="_version_" type="long" indexed="true" stored="true" />
Expand Down

0 comments on commit ef389cd

Please sign in to comment.