Return-Path: X-Original-To: apmail-lucene-solr-user-archive@minotaur.apache.org Delivered-To: apmail-lucene-solr-user-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id EFA24171D3 for ; Tue, 20 Jan 2015 22:17:53 +0000 (UTC) Received: (qmail 4856 invoked by uid 500); 20 Jan 2015 22:17:50 -0000 Delivered-To: apmail-lucene-solr-user-archive@lucene.apache.org Received: (qmail 4789 invoked by uid 500); 20 Jan 2015 22:17:50 -0000 Mailing-List: contact solr-user-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: solr-user@lucene.apache.org Delivered-To: mailing list solr-user@lucene.apache.org Received: (qmail 4777 invoked by uid 99); 20 Jan 2015 22:17:49 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 20 Jan 2015 22:17:49 +0000 X-ASF-Spam-Status: No, hits=2.8 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS,URI_HEX,WEIRD_PORT X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of toporniz@gmail.com designates 74.125.82.44 as permitted sender) Received: from [74.125.82.44] (HELO mail-wg0-f44.google.com) (74.125.82.44) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 20 Jan 2015 22:17:45 +0000 Received: by mail-wg0-f44.google.com with SMTP id z12so3782061wgg.3 for ; Tue, 20 Jan 2015 14:17:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=wuhbREQd9fCu81pY/udexesunyG1BLYCkoLec/V74GU=; b=jplk+jtwC9DyccPLIeY6B/ATDzqIOUjiFX/elikNE15EU544KesiYthjWaHN4Neghs nr+UyOJMx8E88Xt0WsRK+ClNkiKVUpzG5lMfK6FxYxOCJMUyxprIG0CXJjo2IYCgLgTH GJV81aUaDainv4P88q6eMjjw5d3ME7DaA7cWA+r/vfomHp1AcCnaWqecfyDdbEpH1gTc cRBKdKafWpcEZKmdSuyd1CJyY4/ipgloOd3TE9o5sbF82wMdv7DDSGGJh7s1+ZseeQCO SZ6898yLbr40Y18/waWgOj5XJIKRyTKmfg8hGN51lrEywQqgRE5ydAu+U+H0wm9cYEzs UZHw== MIME-Version: 1.0 X-Received: by 10.180.182.8 with SMTP id ea8mr51270452wic.48.1421792244130; Tue, 20 Jan 2015 14:17:24 -0800 (PST) Received: by 10.194.15.37 with HTTP; Tue, 20 Jan 2015 14:17:24 -0800 (PST) In-Reply-To: <1421774249517-4180653.post@n3.nabble.com> References: <1421774249517-4180653.post@n3.nabble.com> Date: Tue, 20 Jan 2015 23:17:24 +0100 Message-ID: Subject: Re: Filter Solr multivalued fields to be able to add pagination From: Alvaro Cabrerizo To: "solr-user@lucene.apache.org" Content-Type: multipart/alternative; boundary=047d7b66f93ba7e7ff050d1ccdcb X-Virus-Checked: Checked by ClamAV on apache.org --047d7b66f93ba7e7ff050d1ccdcb Content-Type: text/plain; charset=UTF-8 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 and extending the FieldValueSubsetUpdateProcessorFactory which will extract the last element of the lastreviewdate field (Your LastFieldValueUpdateProcessorFactory). Thus part of your solrconfig.xml should look like this: ... ... reviewdate lastreviewdate lastreviewdate ... Regards. p.d. Not clear if LastFieldValueUpdateProcessorFactory 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 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. > > > > > > > 0 > 0 > > true > name="fl">reviewtitle,overallscore,service,reviewdate,rating > 1 > on > *:* > id:315 > > > > > 8.78 > > 8 > 10 > 10 > 10 > 5 > 8 > 9 > 10 > 10 > 10 > 10 > 9 > 9 > 9 > 9 > 6 > 1 > 10 > > > 8 > 10 > 10 > 10 > 8 > 8 > 9 > 10 > 9 > 10 > 10 > 9 > 10 > 9 > 9 > 8 > 1 > 10 > > > 2014-11-26T17:18:50.367Z > 2014-10-10T16:54:07.397Z > 2014-08-18T14:21:17.807Z > 2014-08-17T00:20:41.877Z > 2014-08-14T15:30:44.963Z > 2014-08-14T15:23:36.29Z > 2014-08-13T16:25:38.327Z > 2014-08-13T13:54:47.847Z > 2014-08-13T13:20:20.753Z > 2014-06-16T23:29:37.093Z > 2012-11-23T21:54:07.897Z > 2012-11-21T17:40:01.11Z > 2012-11-17T01:58:53.15Z > 2012-11-14T02:17:30.677Z > 2012-11-13T23:22:14.613Z > 2012-11-13T19:09:25.563Z > 2012-08-01T18:09:33.243Z > 2012-07-09T20:37:39.837Z > > > > > > > > > > > > > > > -- > 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. > --047d7b66f93ba7e7ff050d1ccdcb--