@@ -232,12 +232,40 @@ public static SolrInputDocument createDocument(List<LuceneField> luceneFields) {
232
232
continue ;
233
233
}
234
234
235
- // Do not pass a boost value because starting with Solr 3.6, adding an index-time boost to primitive field types will cause
236
- // the commit to fail
237
- doc .addField (luceneField .getField (), luceneField .getValue ());
235
+ // Explicitly use numeric value in doc, where applicable
236
+ switch (luceneField .getField ()) {
237
+ case SolrConstants .CENTURY :
238
+ case SolrConstants .CURRENTNOSORT :
239
+ case SolrConstants .MONTHDAY :
240
+ case SolrConstants .DATECREATED :
241
+ case SolrConstants .DATEINDEXED :
242
+ case SolrConstants .DATEUPDATED :
243
+ case SolrConstants .NUMVOLUMES :
244
+ case SolrConstants .YEAR :
245
+ case SolrConstants .YEARMONTH :
246
+ case SolrConstants .YEARMONTHDAY :
247
+ doc .addField (luceneField .getField (), Long .parseLong (luceneField .getValue ()));
248
+ break ;
249
+ case SolrConstants .HEIGHT :
250
+ case SolrConstants .NUMPAGES :
251
+ case SolrConstants .ORDER :
252
+ case SolrConstants .THUMBPAGENO :
253
+ case SolrConstants .WIDTH :
254
+ doc .addField (luceneField .getField (), Integer .parseInt (luceneField .getValue ()));
255
+ break ;
256
+ default :
257
+ if (luceneField .getField ().startsWith (SolrConstants .PREFIX_MDNUM ) || luceneField .getField ().startsWith ("SORTNUM_" )) {
258
+ doc .addField (luceneField .getField (), Long .parseLong (luceneField .getValue ()));
259
+ } else if (luceneField .getField ().startsWith ("GROUPORDER_" )) {
260
+ doc .addField (luceneField .getField (), Integer .parseInt (luceneField .getValue ()));
261
+ } else {
262
+ doc .addField (luceneField .getField (), luceneField .getValue ());
263
+ }
264
+ }
238
265
}
239
266
240
267
return doc ;
268
+
241
269
}
242
270
243
271
/**
@@ -637,9 +665,9 @@ public SolrInputDocument checkAndCreateGroupDoc(String groupIdField, String grou
637
665
doc .setField (SolrConstants .GROUPFIELD , oldDoc .getFieldValue (SolrConstants .IDDOC ));
638
666
}
639
667
doc .setField (SolrConstants .DOCTYPE , DocType .GROUP .name ());
640
- doc .setField (SolrConstants .DATECREATED , oldDoc .getFieldValue (SolrConstants .DATECREATED ));
668
+ doc .setField (SolrConstants .DATECREATED , Long . parseLong ( String . valueOf ( oldDoc .getFieldValue (SolrConstants .DATECREATED )) ));
641
669
}
642
- doc .setField (SolrConstants .DATEUPDATED , now );
670
+ doc .setField (SolrConstants .DATEUPDATED , Long . valueOf ( now ) );
643
671
doc .setField (SolrConstants .PI , groupId );
644
672
doc .setField (SolrConstants .PI_TOPSTRUCT , groupId );
645
673
doc .setField (SolrConstants .GROUPTYPE , groupIdField );
0 commit comments