Return-Path: X-Original-To: apmail-lucene-general-archive@www.apache.org Delivered-To: apmail-lucene-general-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 1AC606E10 for ; Fri, 24 Jun 2011 20:45:57 +0000 (UTC) Received: (qmail 92656 invoked by uid 500); 24 Jun 2011 20:45:56 -0000 Delivered-To: apmail-lucene-general-archive@lucene.apache.org Received: (qmail 92615 invoked by uid 500); 24 Jun 2011 20:45:56 -0000 Mailing-List: contact general-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: general@lucene.apache.org Delivered-To: mailing list general@lucene.apache.org Received: (qmail 92605 invoked by uid 99); 24 Jun 2011 20:45:56 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 24 Jun 2011 20:45:56 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (nike.apache.org: local policy) Received: from [74.125.83.176] (HELO mail-pv0-f176.google.com) (74.125.83.176) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 24 Jun 2011 20:45:47 +0000 Received: by pve37 with SMTP id 37so2800347pve.35 for ; Fri, 24 Jun 2011 13:45:25 -0700 (PDT) Received: by 10.68.4.129 with SMTP id k1mr1887382pbk.72.1308948325328; Fri, 24 Jun 2011 13:45:25 -0700 (PDT) Received: from bester.local ([65.78.136.75]) by mx.google.com with ESMTPS id m7sm2305886pbk.42.2011.06.24.13.45.23 (version=SSLv3 cipher=OTHER); Fri, 24 Jun 2011 13:45:23 -0700 (PDT) Date: Fri, 24 Jun 2011 13:45:21 -0700 (PDT) From: Chris Hostetter To: general@lucene.apache.org Subject: Re: Inconsistent Sort order for empty and null fields In-Reply-To: <1308758220846-3096175.post@n3.nabble.com> Message-ID: References: <1308758220846-3096175.post@n3.nabble.com> User-Agent: Alpine 2.00 (DEB 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Checked: Checked by ClamAV on apache.org : When I query solr and sort by a given field in ASCENDING order, the records : which do not have a value for this field (i.e. null) appear AFTER the valued : records. The records that have an empty string for the field appear BEFORE : the valued records. This produces a visually inconsistent result. a field containing the empty string (ie: "") is not the same as no field existing. regardless of how else you deal with your sorting problem, it's important to make sure you udnerstand that, because they are fundementally different. for instance: "field:[* TO *]" will match documents where you've indexed the empty string as a term, but it won't match documents where you haven't indexed any field value at all. -Hoss