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 E3CF417C99 for ; Mon, 26 Jan 2015 21:46:13 +0000 (UTC) Received: (qmail 87092 invoked by uid 500); 26 Jan 2015 21:46:10 -0000 Delivered-To: apmail-lucene-solr-user-archive@lucene.apache.org Received: (qmail 87027 invoked by uid 500); 26 Jan 2015 21:46:10 -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 87015 invoked by uid 99); 26 Jan 2015 21:46:09 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 26 Jan 2015 21:46:09 +0000 X-ASF-Spam-Status: No, hits=2.8 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS,URI_HEX X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of mkhludnev@griddynamics.com designates 209.85.213.169 as permitted sender) Received: from [209.85.213.169] (HELO mail-ig0-f169.google.com) (209.85.213.169) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 26 Jan 2015 21:46:05 +0000 Received: by mail-ig0-f169.google.com with SMTP id hl2so6373172igb.0 for ; Mon, 26 Jan 2015 13:45:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=griddynamics.com; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=4RNDQedUFJA3G4by2AQNIbmvfmkyH6EeRk3QTfN8wn4=; b=aMDuzDGbmwRgEkN9ZY2EoZc235KgGuqcNZ4noCGsiqUa9nAiGIuJrgcWX890/AS2/X arcAInUC9jDfL4L+22XlqVbtRYc7nBjp53yhpwrPA3S6pT1r6pR8b3t1n55CzRsD7RkG UNtZl+9HaDruqjsobNSSssVBz4SD9wZZho3RM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:content-type; bh=4RNDQedUFJA3G4by2AQNIbmvfmkyH6EeRk3QTfN8wn4=; b=lw3rfAUTMxfTJ9jjNLW5RTVOpVoKtfcYHUpc2leFSHOUCNJXNIbWydpOD8xUFUIq2/ kU5i8PUSp2EEf0zuRUzZ505nga8w59S8kwbwyPTpyF/LpDXwxAT1DDe+rXRV8oGfs6Gv 0AKpXL0WvyA8JcStSyfOkKEywQXfNz/pVg0HqDGKWle8wEspFMe/Zrt+/PeMIr/7BUEk ynmTA1GBm0XVL0QfsqB/KMMY/c9FpHerycqmRNozk29e9ZC24/8S1uo8eyOfOcLU/mRJ f8YtCt3i5SM7eoJxxhrG5AyjQgBDPVuOSuossUiX/KM+xjM4xc824IMnRxFvWdR2JexF 4YJQ== X-Gm-Message-State: ALoCoQmNB2Nwn1kO4HAHoc0hkoqdP9v3zlq+93x/BVbfUDgTrKgoK9t0YuveKYNnxz0CpT0TrkpV X-Received: by 10.50.117.68 with SMTP id kc4mr18857440igb.25.1422308699957; Mon, 26 Jan 2015 13:44:59 -0800 (PST) MIME-Version: 1.0 Received: by 10.36.78.203 with HTTP; Mon, 26 Jan 2015 13:44:19 -0800 (PST) In-Reply-To: <1422307857223-4182060.post@n3.nabble.com> References: <1422227603981-4181875.post@n3.nabble.com> <54C6378B.1090509@elyograg.org> <1422307857223-4182060.post@n3.nabble.com> From: Mikhail Khludnev Date: Tue, 27 Jan 2015 00:44:19 +0300 Message-ID: Subject: Re: Sorting on a computed value To: solr-user Content-Type: multipart/alternative; boundary=089e0111aed2d280cc050d950cba X-Virus-Checked: Checked by ClamAV on apache.org --089e0111aed2d280cc050d950cba Content-Type: text/plain; charset=UTF-8 I'm sorry for spoiling, but it's a fabulous FakeScorer pattern in Lucene. e.g. look at https://github.com/apache/lucene-solr/blob/trunk/lucene/grouping/src/java/org/apache/lucene/search/grouping/BlockGroupingCollector.java#L355 when your delegating collector is provided by scorer via setScorer(), it shouldn't just pass it to the delegate as is, but pass a FakeScorer instance instead (copy-paste your own and make it private, absolutely!), which your collector can set docNum and application calculated score into before delegating collect() notification. here is. On Tue, Jan 27, 2015 at 12:30 AM, tedsolr wrote: > That's an interesting link Shawn. Especially since it mentions the > possibility of sorting on pseudo-fields. > > My delegating collector computes the customs stats and stores them in the > request context. I have a doc transformer that then grabs the stats for > each > doc and inserts the data in the output. Here's a sample return doc: > > { > "ITEM_DESCRIPTION": "FREIGHT PAY AMT FOR ITEM - 30934014", > "SUPPLIER_NAME": "JESUS ACOSTA MORENO", > "GL_ACCOUNT_NAME": "-", > "PART_NUMBER": "-", > "MCC_CODE": "SDBHAULER.NA", > "[AggregationStats]": { > "count": 1, > "spend": 8402.39 > } > }, > > My stats are in the [AggregationStats] "field". I don't know if this > qualifies as a pseudo-field. Sorting happens before my doc transformer is > called, so I don't think this data is available for sort. Like you said, > I'm > not using a function query to create this data, so maybe this idea won't > work. > > I'm going to try to use doc scoring. If I can make the score match my > pseudo > fields then it might work. > > > > -- > View this message in context: > http://lucene.472066.n3.nabble.com/Sorting-on-a-computed-value-tp4181875p4182060.html > Sent from the Solr - User mailing list archive at Nabble.com. > -- Sincerely yours Mikhail Khludnev Principal Engineer, Grid Dynamics --089e0111aed2d280cc050d950cba--