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 CC883200B49 for ; Wed, 3 Aug 2016 22:58:44 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id CAE7A160A86; Wed, 3 Aug 2016 20:58:44 +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 ED01A160A5D for ; Wed, 3 Aug 2016 22:58:43 +0200 (CEST) Received: (qmail 26351 invoked by uid 500); 3 Aug 2016 20:58:41 -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 26339 invoked by uid 99); 3 Aug 2016 20:58:41 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 03 Aug 2016 20:58:41 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 2F50ECB7BB for ; Wed, 3 Aug 2016 20:58:41 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 0.492 X-Spam-Level: X-Spam-Status: No, score=0.492 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001, URI_HEX=1.313] autolearn=disabled Authentication-Results: spamd1-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 (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id hVqA_OHh0ybe for ; Wed, 3 Aug 2016 20:58:40 +0000 (UTC) Received: from mail-it0-f51.google.com (mail-it0-f51.google.com [209.85.214.51]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTPS id EE2845F2C5 for ; Wed, 3 Aug 2016 20:58:39 +0000 (UTC) Received: by mail-it0-f51.google.com with SMTP id f6so307146459ith.1 for ; Wed, 03 Aug 2016 13:58:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=zsNzCw8sECPeSfLpb2YDwVUXvmjK0mh+eaDv/qCQ/t8=; b=SYwwRnrBVstWxf2rhSTZCzv/trC8yujBBwAm5Vpca9UPAJJCPqz0dCtvG+TViNmJ4b bNn4rgbSnQrNbnz7NW0cv93EIztsqPyrC9jSyS1eEIqIw7yuTl+uuLOrzd2cnCYo5pXl jforFQScecH/2z/IzaD23tqiRtf9d4Nxb8uVxGiB6D3cDn/qZH98LKPJXYmPbg/hfTTD Ub8t8d3hFGd6CWU8jDkvuBFdkD62gRKOItlY3H+8+4OOV8fmhCJVvz4AdWVRqU1sSgvy 1opYyRvoRId3yXlkz6bXUpI6uqcq3O31CgfpXmPHWUtx3cjAjI/dDRfObPj2GDxA7C10 qxZg== 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; bh=zsNzCw8sECPeSfLpb2YDwVUXvmjK0mh+eaDv/qCQ/t8=; b=EjMmPmQZ87N6AmnsdQblyt2+d2pcWwK8ZKNFGshf8JR4wxTlDA8uPg1EMnbklhn4hQ MJwT/dzRkQbS0PRhohgVoJMddw+pjNwux9jwu52KyCQ8ib2rWQiRUZB6iMoWf8lKj1x9 Sw0jglyGNTxiAkcFKlvIucnU6Pqp9i4jgqLHb+69H32Njwc4QxrcmZiXfMkw6cmlkWZt Wx1u/Uei0/RII0NoC769MYk0rvo1IUb1QwoF9Ay/Xz11DcgGzx/jvIKrysN7bYlGBY5z rneT9lRlshk7HY/wfvQsTsmvHDf23EIpMX/aFo8mOyyxRWlLyBkYMnTf1f11lF1q4bLx KKPQ== X-Gm-Message-State: AEkooutKKl1Fn0POZvLCBQLCmyQC1PamGEC1GSXsKXddNGLlt+9b5Zv0sq4byaq0vLaCcKRnaUc6AK99DEt0nQ== X-Received: by 10.36.70.193 with SMTP id j184mr24163319itb.39.1470257913194; Wed, 03 Aug 2016 13:58:33 -0700 (PDT) MIME-Version: 1.0 Received: by 10.107.150.19 with HTTP; Wed, 3 Aug 2016 13:57:52 -0700 (PDT) In-Reply-To: <1470242571844-4290249.post@n3.nabble.com> References: <1470242571844-4290249.post@n3.nabble.com> From: Erick Erickson Date: Wed, 3 Aug 2016 13:57:52 -0700 Message-ID: Subject: Re: QParsePlugin not working on sharded collection To: solr-user Content-Type: text/plain; charset=UTF-8 archived-at: Wed, 03 Aug 2016 20:58:45 -0000 Right, I don't have the code in front of me right now, but I think your issue is at the "aggregation" point. You also have to put some code in the aggregation bits that pull your custom parts from the sub-request packets and puts in the final packet, "doing the right thing" in terms of assembling them into something meaningful along the way (e.g. averaging "myvar" or putting it in a list identified by shard or......). I think if you fire the query at one of your shards with &distrib=false you'll see your additions, which would demonstrate that your filter is being found. I assume your custom jar is on the shards or you'd get an exception (assuming you've pushed your solrconfig to ZK). Best, Erick On Wed, Aug 3, 2016 at 9:42 AM, tedsolr wrote: > I'm trying to verify that a very simple custom post filter will work on a > sharded collection. So far it doesn't. Here are the search results on my > single shard test collection: > > { > "responseHeader": { > "status": 0, > "QTime": 17 > }, > "thecountis": "946028", > "myvar": "hello", > "response": { > "numFound": 946028, > "start": 0, > "docs": [ > ...] > } > > When I run against a two shard collection (same data set) it's as though the > post filter doesn't exist. The results don't include my additions to the > response: > > { > "responseHeader": { > "status": 0, > "QTime": 17 > }, > "response": { > "numFound": 946028, > "start": 0, > "docs": [ > ...] > } > > Here's the solconfig.xml: > > ... > > > > {!TedFilter myvar=hello} > > > ... > > And here's the simplest plugin I could write: > > public class TedPlugin extends QParserPlugin { > @Override > public void init(NamedList arg0) { > } > > @Override > public QParser createParser(String arg0, final SolrParams arg1, final > SolrParams arg2, final SolrQueryRequest arg3) { > return new QParser(arg0, arg1, arg2, arg3) { > > @Override > public Query parse() throws SyntaxError { > return new TedQuery(arg1, arg2, arg3); > } > }; > } > } > > public class TedQuery extends AnalyticsQuery { > private final String myvar; > > TedQuery(SolrParams localParams, SolrParams params, SolrQueryRequest req) { > myvar = localParams.get("myvar"); > } > > @Override > public DelegatingCollector getAnalyticsCollector(ResponseBuilder rb, > IndexSearcher searcher) { > return new TedCollector(myvar, rb); > } > > @Override > public boolean equals(Object o) { > if (o instanceof TedQuery) { > TedQuery tq = (TedQuery) o; > return Objects.equals(this.myvar, tq.myvar); > } > return false; > } > > @Override > public int hashCode() { > return myvar == null ? 1 : myvar.hashCode(); > } > > > class TedCollector extends DelegatingCollector { > ResponseBuilder rb; > int count; > String myvar; > > public TedCollector(String myvar, ResponseBuilder rb) { > this.rb = rb; > this.myvar = myvar; > } > > @Override > public void collect(int doc) throws IOException { > count++; > super.collect(doc); > } > > @Override > public void finish() throws IOException { > rb.rsp.add("thecountis", String.valueOf(count)); > rb.rsp.add("myvar", myvar); > > if (super.delegate instanceof DelegatingCollector) { > ((DelegatingCollector) super.delegate).finish(); > } > } > } > } > > What am I doing wrong? Thanks! > Ted > v5.2.1 SolrCloud mode > > > > -- > View this message in context: http://lucene.472066.n3.nabble.com/QParsePlugin-not-working-on-sharded-collection-tp4290249.html > Sent from the Solr - User mailing list archive at Nabble.com.