Hi, Currently, there is no way to sort by a multi-value field within solr (first the system should sort the content of the field, then sort documents...). Anyway, if you have a clear idea on how the sort should be done try to accomodate your data to your needs (in case it is posible).
One option could be to copy the last value of the original field (i.e. reviewdate) into a new single-value field (e.g. name it lastreviewdate) and then sort by this new field (lastreviewdate). The copy could be done using your own update chain. For example, reusing CloneFieldUpdateProcessorFactory <https://lucene.apache.org/solr/4_4_0/solr-core/org/apache/solr/update/processor/CloneFieldUpdateProcessorFactory.html> and extending the FieldValueSubsetUpdateProcessorFactory <https://lucene.apache.org/solr/4_4_0/solr-core/org/apache/solr/update/processor/FieldValueSubsetUpdateProcessorFactory.html> which will extract the last element of the lastreviewdate field (Your LastFieldValueUpdateProcessorFactory). Thus part of your solrconfig.xml should look like this: ... <updateRequestProcessorChain name="yourProcessorChain"> ... <processor class="solr.CloneFieldUpdateProcessorFactory"> <str name="source">reviewdate</str> <str name="dest">lastreviewdate</str> </processor> <processor class="yourpackage.YourLastFieldValueUpdateProcessorFactory"> <str name="fieldName">lastreviewdate</str> </processor> ... </updateResquestProcessorChain> Regards. p.d. Not clear if LastFieldValueUpdateProcessorFactory <https://lucene.apache.org/solr/4_4_0/solr-core/org/apache/solr/update/processor/LastFieldValueUpdateProcessorFactory.html> could copy the value you are interested in, thus avoiding the creation of the new class yourpackage.YourLastFieldValueUpdateProcessorFactory On Tue, Jan 20, 2015 at 6:17 PM, PeterKerk <petervdk...@hotmail.com> wrote: > I have the Solr XML response below using this query: > > http://localhost:8983/solr/tt/select/?indent=off&facet=false&wt=xml&fl=title,overallscore,service,reviewdate&q=*:*&fq=id:315&start=0&rows=4&sort=reviewdate%20desc > > I want to add paging on the multivalued fields, but the above query throws > the error `can not sort on multivalued field: reviewdate` > > How can I add paging (or put differenly select only a subset of the > response > based on a filter on a multivalued field)? In my case with a pagesize of 4 > and total results of 18 that would result in 5 pages. > > > > <?xml version="1.0" encoding="UTF-8"?> > <response> > <lst name="responseHeader"> > <int name="status">0</int> > <int name="QTime">0</int> > <lst name="params"> > <str name="facet">true</str> > <str > name="fl">reviewtitle,overallscore,service,reviewdate,rating</str> > <str name="facet.mincount">1</str> > <str name="indent">on</str> > <str name="q">*:*</str> > <str name="fq">id:315</str> > </lst> > </lst> > <result name="response" numFound="1" start="0"> > <doc> > <float name="rating">8.78</float> > <arr name="service"> > <int>8</int> > <int>10</int> > <int>10</int> > <int>10</int> > <int>5</int> > <int>8</int> > <int>9</int> > <int>10</int> > <int>10</int> > <int>10</int> > <int>10</int> > <int>9</int> > <int>9</int> > <int>9</int> > <int>9</int> > <int>6</int> > <int>1</int> > <int>10</int> > </arr> > <arr name="overallscore"> > <int>8</int> > <int>10</int> > <int>10</int> > <int>10</int> > <int>8</int> > <int>8</int> > <int>9</int> > <int>10</int> > <int>9</int> > <int>10</int> > <int>10</int> > <int>9</int> > <int>10</int> > <int>9</int> > <int>9</int> > <int>8</int> > <int>1</int> > <int>10</int> > </arr> > <arr name="reviewdate"> > <date>2014-11-26T17:18:50.367Z</date> > <date>2014-10-10T16:54:07.397Z</date> > <date>2014-08-18T14:21:17.807Z</date> > <date>2014-08-17T00:20:41.877Z</date> > <date>2014-08-14T15:30:44.963Z</date> > <date>2014-08-14T15:23:36.29Z</date> > <date>2014-08-13T16:25:38.327Z</date> > <date>2014-08-13T13:54:47.847Z</date> > <date>2014-08-13T13:20:20.753Z</date> > <date>2014-06-16T23:29:37.093Z</date> > <date>2012-11-23T21:54:07.897Z</date> > <date>2012-11-21T17:40:01.11Z</date> > <date>2012-11-17T01:58:53.15Z</date> > <date>2012-11-14T02:17:30.677Z</date> > <date>2012-11-13T23:22:14.613Z</date> > <date>2012-11-13T19:09:25.563Z</date> > <date>2012-08-01T18:09:33.243Z</date> > <date>2012-07-09T20:37:39.837Z</date> > </arr> > > </doc> > </result> > <lst name="facet_counts"> > <lst name="facet_queries" /> > <lst name="facet_fields" /> > <lst name="facet_dates" /> > <lst name="facet_ranges" /> > </lst> > </response> > > > > -- > View this message in context: > http://lucene.472066.n3.nabble.com/Filter-Solr-multivalued-fields-to-be-able-to-add-pagination-tp4180653.html > Sent from the Solr - User mailing list archive at Nabble.com. >