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 D1DED200AE2 for ; Fri, 27 May 2016 09:14:21 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id D0447160A12; Fri, 27 May 2016 07:14:21 +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 22D5216099F for ; Fri, 27 May 2016 09:14:20 +0200 (CEST) Received: (qmail 11284 invoked by uid 500); 27 May 2016 07:14:19 -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 11271 invoked by uid 99); 27 May 2016 07:14:19 -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, 27 May 2016 07:14:19 +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 A9E05C0856 for ; Fri, 27 May 2016 07:14:18 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.179 X-Spam-Level: * X-Spam-Status: No, score=1.179 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=2, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd4-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx2-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 F66-8T0in66v for ; Fri, 27 May 2016 07:14:16 +0000 (UTC) Received: from mail-vk0-f42.google.com (mail-vk0-f42.google.com [209.85.213.42]) by mx2-lw-eu.apache.org (ASF Mail Server at mx2-lw-eu.apache.org) with ESMTPS id 5BD455F368 for ; Fri, 27 May 2016 07:14:16 +0000 (UTC) Received: by mail-vk0-f42.google.com with SMTP id r140so132804522vkf.0 for ; Fri, 27 May 2016 00:14:16 -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=X33tPkiTBp/unywHvIhqN3lx5nPwhmHLjdTam6GjI50=; b=bgViYCYOinuE2NKZjlywTd+2p55uhFzJDNHYZrmR8gKNM8aKAibwyRO3t7mk6qxbKF rElhNq+AA8GZHkpkdrp+cv497ut2NpSlcvoU7vxbY/6N6eUziqpW5wLN7372mTkyyrr9 IPC3hrsSzX9EDQy3khGE4hIuv8akw/zvJzKg2yZPw6yzf4WvkXA/DkpdTeqnXJQv2VUi CCX2bxRBNLZ7rHmZeltgEvGIHlji1/1XEtyxsE3zlbZkDakafNajcN67UdSAFrCHn4Jy VUGCcqyL0pT1787nFMjV80hZnJnzJ0eQ5PS7qkVARB8lCmqvoVl1oIpG73yarvnueWKD 9xDw== 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=X33tPkiTBp/unywHvIhqN3lx5nPwhmHLjdTam6GjI50=; b=NkvVxxxTt4yzz0bFBqoGSaMRAomMHxuUERHAVRpRzudGHwRupl61+awNCfGltWTF7i tJOjNrhcl4Ah1PNbvuM4oERVu8krV3q0IxZHp/achS8K8dOxiuSA68mntFhxvXNu2YA/ Lr4Gvy+HmDKMCU/NJBANX2T/ERN/YaiHNIqQVgr1f72LeruzpE0x4PwXSoj+w3o6Ivg5 EleMiZhtaY7+GTp2pFyWcdvs9i1HmJxnFH2cWuDfdMZoejK7zauV+zqf3ajAQ8+2vxTR 7Wb4GzAuOOZTcQtS3pBLX5Nl+5cF7Tk06en5pvgJ68OlgHjeCXElhoZR1RdZrdCl3XFt H8bA== X-Gm-Message-State: ALyK8tLQB5aoBnTN1ny0wdXyRKziIey7u7qcmvo88TCSDCZYLqFMNqJBt1CV5VQy5hbhr+J4q0n0FaFdQ5raxg== X-Received: by 10.31.76.198 with SMTP id z189mr7946782vka.111.1464333249365; Fri, 27 May 2016 00:14:09 -0700 (PDT) MIME-Version: 1.0 Received: by 10.176.69.5 with HTTP; Fri, 27 May 2016 00:13:29 -0700 (PDT) In-Reply-To: <1bfbc120-7571-d11a-3b29-27817af1dc60@elyograg.org> References: <1bfbc120-7571-d11a-3b29-27817af1dc60@elyograg.org> From: Anil Date: Fri, 27 May 2016 12:43:29 +0530 Message-ID: Subject: Re: Not (!) operator To: solr-user@lucene.apache.org Content-Type: multipart/alternative; boundary=001a114dd6d8294d550533cda747 archived-at: Fri, 27 May 2016 07:14:22 -0000 --001a114dd6d8294d550533cda747 Content-Type: text/plain; charset=UTF-8 Hi Shawn, Thanks for reply. i am also worried wither performance. I will check if there is another way to design the documents in case of parent and child relationship. Regards, Anil On 27 May 2016 at 12:39, Shawn Heisey wrote: > On 5/26/2016 11:13 PM, Anil wrote: > > We have status text field in our solr document and it is optional. > > search query status: !Closed returning documents with no status as > > well. how to get only documents having status and it is !Closed ? one > > way is status:* AND status:!Closed . any other way ? Thanks > > If you use status:* then you are doing a wildcard query. If the status > field has a large number of unique values, this will be VERY slow. > Avoid wildcard queries unless they are the only way to accomplish what > you need. > > If the status field has more than a few possible values, the most > compact way to do this query efficiently would be: > > status:[* TO *]-status:Closed > > This could be written as: > > status:[* TO *] AND NOT status:Closed > > See this article about why this may not be the best way to write queries: > > https://lucidworks.com/blog/2011/12/28/why-not-and-or-and-not/ > > The [] syntax is a range query. By starting and ending the range with > the * character, it means "all documents where status has a value". > > Thanks, > Shawn > > --001a114dd6d8294d550533cda747--