Result-Sorting Fulltext on AppEngine Java on a Date Field. How to? using SDK 1.6.6 deployed. (all this works on local machine but not when deployed)
ERROR: g-(IndexImpl.java:277)com.google.appengine.api.search.IndexImpl$3.wrap> null
-
No results using this: sorting by date with defaultvalue “2000-01-01”
SortOptions sortOptions = SortOptions.newBuilder().addSortExpression(SortExpression.newBuilder().setExpression(“date”).setDirection(SortExpression.SortDirection.DESCENDING).setDefaultValue(“2000-01-01”)).set`Limit(limit).build();
-
No results using this: sorting by date with defaultvalue “”
SortOptions sortOptions = SortOptions.newBuilder().addSortExpression(SortExpression.newBuilder().setExpression(“date”).setDirection(SortExpression.SortDirection.DESCENDING).setDefaultValue(“”)).setLimit(limit).build();
-
YES– results using this: sorting by subject
SortOptions sortOptions = SortOptions.newBuilder().addSortExpression(SortExpression.newBuilder().setExpression(“subject”).setDirection(SortExpression.SortDirection.DESCENDING).setDefaultValue(“”)).setLimit(limit).build();
If you use
.setDefaultValueNumeric()in a date field sort expression, this should work, e.g..setDefaultValueNumeric(0.0).This is a workaround– there should be a ‘set default value’ method for sorting on date fields, in addition to the existing methods for string and number fields. An internal issue has been filed to add this to the API.