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 02F5F200CC6 for ; Tue, 18 Jul 2017 14:45:54 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 014C7166C29; Tue, 18 Jul 2017 12:45:54 +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 20EFA166C26 for ; Tue, 18 Jul 2017 14:45:52 +0200 (CEST) Received: (qmail 39276 invoked by uid 500); 18 Jul 2017 12:45:46 -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 39263 invoked by uid 99); 18 Jul 2017 12:45:45 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 18 Jul 2017 12:45:45 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id 73CA1180313 for ; Tue, 18 Jul 2017 12:45:45 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -0.151 X-Spam-Level: X-Spam-Status: No, score=-0.151 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, HTML_MESSAGE=2, 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: spamd3-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id zq3Ia3DwFRWD for ; Tue, 18 Jul 2017 12:45:43 +0000 (UTC) Received: from mail-wr0-f182.google.com (mail-wr0-f182.google.com [209.85.128.182]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTPS id A90715F477 for ; Tue, 18 Jul 2017 12:45:42 +0000 (UTC) Received: by mail-wr0-f182.google.com with SMTP id y43so27746547wrd.3 for ; Tue, 18 Jul 2017 05:45:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=JFg4vX6kCA7j4aRV47vNx7YEiiVHgvKy7G64bWgiayc=; b=QjWYYvR90NQFkHPf3sZF8deDeGEv9Em+c16A6C4j5d74c7w6M5V4EX51scAROUP4dg k9Bk2gQitEhpeYAG85UNHHPQzUTyV55253DNWjIFTLKIz3+52F8U31YC85QdFIqTWcam 6ILPKZryuxIJqrAsGqVYgz20iG52pqogBvSGBsjVKDertPYnOEk79As9+S+WXeVyqtqh 94qx7aI3ql0pKVdwAv4HssUZ0Fhtc4DTc8wZyfSvYG8cwlKR51JsEOn5kScj05uQCWNV YOkXPmMDxAAJy1LuBhHwG/THZm1yjnjh+mlwWDiMLJrv3I/Ht5X/039KPn+NF4MHr3ZV Mwig== 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=JFg4vX6kCA7j4aRV47vNx7YEiiVHgvKy7G64bWgiayc=; b=hLuAbQDp5UFfTWzhEUajFU7c9nOLXiygh8SoCpw96FCIKTBgiE/XShlBUy/wsUO7zs 6O7o5NBf1R+UXLFJ82ETmQbtixmVQZgHWIFEk5aXUM3vkph572xBo93FgmABqed+4CsF AWJ+mp756o7aqvYjynvsCZ94RIJ+kdQdSttt/27qh5Qcg3HUMI4nN3nRZaLhxw+cGa8r WxzzIUp3YaFZF4hME2rxbUocCtCVtq9ePGaZcFnPb9KGrbFJGfnRfCkxuKRfIS2d5Ivi 1CT9HiTNbcvMi0oGD0i9Z4cr01g9VTHqnSOT9TGS5jjk/XGUnsHRB+ENfxs3MYr7YnIf jWcg== X-Gm-Message-State: AIVw112OAdquFNYD6UDDgKtHvLYR9+KuRgcmjWYLqynTIAmbAtcihnsY 4JUjk2fje4tE3v4wLfjjFA/LKyjlGw== X-Received: by 10.80.176.162 with SMTP id j31mr1785156edd.186.1500381941548; Tue, 18 Jul 2017 05:45:41 -0700 (PDT) MIME-Version: 1.0 Received: by 10.80.166.145 with HTTP; Tue, 18 Jul 2017 05:45:41 -0700 (PDT) In-Reply-To: <1304362935.3773660.1500373401847@mail.yahoo.com> References: <1304362935.3773660.1500373401847.ref@mail.yahoo.com> <1304362935.3773660.1500373401847@mail.yahoo.com> From: Susheel Kumar Date: Tue, 18 Jul 2017 08:45:41 -0400 Message-ID: Subject: Re: Get results in multiple orders (multiple boosts) To: solr-user@lucene.apache.org, "Luca Dall'Osto" Content-Type: multipart/alternative; boundary="94eb2c1952f0a74d5a055496e4d2" archived-at: Tue, 18 Jul 2017 12:45:54 -0000 --94eb2c1952f0a74d5a055496e4d2 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable As Eric suggested, its possible by sorting using custom function. You may have to use if, sum and exists function etc. to come up with custom score field and sort using this field. The if condition would check for the conditions mentioned and keep adding the score etc. Thanks, Susheel On Tue, Jul 18, 2017 at 6:23 AM, Luca Dall'Osto < tenaciousd93@yahoo.it.invalid> wrote: > Hello everyone,thanks for the prompt reply! > In response to Florian, I can get correct score only when boost for 1 > filed (for example category): the score are correctly increased by the > factor.But when I try to make a double boost, the score are not great as > expected (for example, if the greatest boost factor for category is 3 and > for source is 3, sometimes I've got documents boosted with category^3 an= d > source^1 **before** documents boosted with category^3 and source^3). > I tired you snippet code "^=3D[boost]" instead of "^[factor]" but seems n= ot > work for me: SyntaxError: Cannot parse 'category:9500^': Encountered > \"\" at line 1 (...) > In response to Erik, I have different "sort preferences", so I can't buil= d > a index and use for sorting.Maybe I have to sort by category then by sour= ce > and by language or by source, then by category and by date.The sort > function that you are talking is a custom sort function of Solr?I build a > custom PHP method that sort documents queried from Solr and it works good= : > the problem is that if I choose this way I have to get **all** the result= s > in a single query and I can't paginate.Today I have millions of record an= d > query could be very large, I would like to paginate results.To paginate > results I need that Solr give me the results query in the correct > order.Thank you very much > > Luca > > > > On Monday, July 17, 2017 6:04 PM, Erick Erickson < > erickerickson@gmail.com> wrote: > > > I don't think boosting is really what you want here. Boosting > _influences_ the score, it does not impose an ordering. > > Sorting _does_ impose an ordering, the question is how to sort and the > answer depends on how fixed (or not) the sorting criteria are. Do they > change with different queries? If not, the very simplest thing to do > is to index a field with a pre-computed sort value. IOW, if your > ordering is _always_ source 5, 9, 7 index a source_sort field that > orders things that way and sort on that. Then I'd have a secondary > sort by score as a tie-breaker. > > If that's not the case, perhaps sorting by function (perhaps a custom > function) would work. > > Best, > Erick > > On Mon, Jul 17, 2017 at 4:30 AM, Florian Waltersdorfer > wrote: > > Hi, > > > > I am quite the SolR newbie myself, but have you looked at the resulting > scores, e.g. via fl=3D*,score (that way, you can see/test how your boosti= ng > affects the results)? > > In a similar scenario, I am using fixed value boosts for specific field > values; "^=3D[boost]" instead of "^[factor]", for example: > > > > category:9500^=3D20 source:(5^=3D20 OR 9^=3D10 OR 7^=3D5) > > > > (Actual fixed values open for experimentation.) > > > > Regards, > > Florian > > > > -----Urspr=C3=BCngliche Nachricht----- > > Von: Luca Dall'Osto [mailto:tenaciousd93@yahoo.it.INVALID] > > Gesendet: Montag, 17. Juli 2017 12:20 > > An: solr-user@lucene.apache.org > > Betreff: Get results in multiple orders (multiple boosts) > > > > Hello, > > I'm new in Solr (and in mailing lists..), and I have a question about > querying contents in multiple custom orders. > > I 'm trying to query some documents boosted by 2 (or more) fields: I'm > able to make a search of 2 day and return results boosted by category > field, like this: > > > > ?indent=3Don > > &defType=3Dedismax > > &q=3D(date:[2017-06-16T00:00:00Z TO 2017-06-18T23:59:59Z]) > > &bq=3Dcategory:9500^2 > > &bq=3Dcategory:1100^1 > > &rows=3D40 > > &wt=3DjsonThis will return all documents of category 9500 first, and 11= 00 > in after.Now I would like to get this documents with a second boost based > on another field, called source.I would like to have documents in this > order:1) category:9500 AND source:5 > > 2) category:9500 AND source:9 > > 3) category:9500 AND source:7 > > 4) category:1100 AND source:5 > > 5) category:1100 AND source:9 > > 6) category:1100 AND source:7 > > To get this order, I tied with this query:?indent=3Don &defType=3Dedism= ax > &q=3D(date:[2017-06-16T00:00:00Z TO 2017-06-18T23:59:59Z]) > > &bq=3Dcategory:9500^2+source:(5^3 OR 9^2 OR 7^1) > > &bq=3Dcategory:1100^1+source:(5^3 OR 9^2 OR 7^1) > > &rows=3D40 > > &wt=3Djson > > How can I apply a double boosts to get the documents in my correct > order? Is boost the correct tool for my purpose?Any help will be greatly > appreciated. Thanks Luca > > > --94eb2c1952f0a74d5a055496e4d2--