Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id B13D9200CED for ; Fri, 18 Aug 2017 11:06:26 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id AFBEB16A643; Fri, 18 Aug 2017 09:06:26 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 0ED5516BC44 for ; Fri, 18 Aug 2017 11:06:25 +0200 (CEST) Received: (qmail 49798 invoked by uid 500); 18 Aug 2017 09:06:23 -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 49776 invoked by uid 99); 18 Aug 2017 09:06:23 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 18 Aug 2017 09:06:23 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id 15F05C008F for ; Fri, 18 Aug 2017 09:06:23 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -2.401 X-Spam-Level: X-Spam-Status: No, score=-2.401 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-2.8, RCVD_IN_SORBS_SPAM=0.5, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd4-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=googlemail.com Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id 1kjhUpw75Hge for ; Fri, 18 Aug 2017 09:06:21 +0000 (UTC) Received: from mail-wr0-f175.google.com (mail-wr0-f175.google.com [209.85.128.175]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTPS id 7C77461C5C for ; Fri, 18 Aug 2017 08:58:09 +0000 (UTC) Received: by mail-wr0-f175.google.com with SMTP id b65so64446507wrd.0 for ; Fri, 18 Aug 2017 01:58:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=qtKNhojRJN1Ut4M0QEgt0z9A2h19DIwtwOCeF+rmj5k=; b=f7XX+mBab4KKIcw3o2QYaeKZyTsoc17BrgedFZQa99eJxwnsE71Z/yX4KeYVLBtZF6 4OonSH5sh1ivtN3YNr7z8pnkKx/EEz0GYWzwIaA8lWmztCSjYgNze5XZ8gFNZ4ZeF3cS LADx12DE7x4qO49PxMQtBPLNj4LPDagwqj8iD+MUfSLkuF78685q7uwiCogN3OlPWQ+3 mwEx43Q7uULnRCJJarAhioLcpm6FKE3bfCaWUXfImCDNPKZW3EhMo1IhAXmWsBJmeqC0 +5rRC3UWXQBbKrgz543j+/mtASimuFeaqqzyU7gC7oor2nrdTmelSNZRzaKyOao14Tyq +awg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=qtKNhojRJN1Ut4M0QEgt0z9A2h19DIwtwOCeF+rmj5k=; b=JJvJGH+ZEu3eJYuAPZyLdrJl5HABJOe5bqvQ5sps7PVwAVJTfQTQUd49rjmJ5BWXTi CXLYHiT+vYyoPFO3+Yyj1+SVw1EJfUdHUQHmL/mzE7/jQfXF+0v16r3P00iTAEequsp5 hzefjIzHj/MvAvVW/ZRUj51wGVCNZTcsApNNqbVourJdpCYq64B0JzPZSf7vYtZZ8o5J lGjHIjrOtJVf4XYeUdT83sAu4iWH+OL17Ky8pvBL1XzbRTgQrnvWkpkgdYHOHCL6NhIZ GCxvfORq3HuQIGQqM9BOTlND7JQ0VBuc1yQscdyt0XTIgnbnrnGfFNPjOaYwt4uWD9uK l6/g== X-Gm-Message-State: AHYfb5g3CaAYRaz+kZ66ouh/a/1iBCdGD5up+lU+cEGSR6vxmRBNjM+h Ll9sw7fkaUQmXAzkYZTBAFG1KIY7t6Cl8HM= X-Received: by 10.80.182.168 with SMTP id d37mr4252425ede.287.1503046688920; Fri, 18 Aug 2017 01:58:08 -0700 (PDT) MIME-Version: 1.0 Received: by 10.80.174.33 with HTTP; Fri, 18 Aug 2017 01:58:08 -0700 (PDT) In-Reply-To: <263426032.110609.1503040910589@mail.yahoo.com> References: <263426032.110609.1503040910589.ref@mail.yahoo.com> <263426032.110609.1503040910589@mail.yahoo.com> From: Tom Evans Date: Fri, 18 Aug 2017 09:58:08 +0100 Message-ID: Subject: Re: Get results in multiple orders (multiple boosts) To: solr-user@lucene.apache.org, "Luca Dall'Osto" Content-Type: text/plain; charset="UTF-8" archived-at: Fri, 18 Aug 2017 09:06:26 -0000 On Fri, Aug 18, 2017 at 8:21 AM, Luca Dall'Osto wrote: > > Yes, of course, and excuse me for the misunderstanding. > > > In my scenario I have to display a list with hundreds of documents. > An user can show this documents in a particular order, this order is decided by user in a settings view. > > > Order levels are for example: > 1) Order by category, as most important. > 2) Order by source, as second level. > 3) Order by date (ascending or descending). > 4) Order by title (ascending or descending). > > > For category order, in settings view, user has an box with a list of all categories available for him/her. > User drag&drop elements of the list to set in the favorite order. > Same thing for sources. > Solr can only sort by indexed fields, it needs to be able to compare one document to another document, and the only information available at that point are the indexed fields. This would be untenable in your scenario, because you cannot add a category..sort_order field to every document for every user. If this custom sorting is a hard requirement, the only feasible solution I see is to write a custom sorting plugin, that provides a function that you can sort on. This blog post describes how this can be achieved: https://medium.com/culture-wavelabs/sorting-based-on-a-custom-function-in-solr-c94ddae99a12 I would imagine that you would need one sort function, maybe called usersortorder(), to which you would provide the users preferred sort ordering (which you would retrieve from wherever you store such information) and the field that you want sorted. It would look something like this: usersortorder("category_id", "3,5,1,7,2,12,14,58") DESC, usersortorder("source_id", "5,2,1,4,3") DESC, date DESC, title DESC Cheers Tom