Return-Path: X-Original-To: apmail-lucene-java-user-archive@www.apache.org Delivered-To: apmail-lucene-java-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 9E5BBF579 for ; Thu, 4 Apr 2013 18:23:32 +0000 (UTC) Received: (qmail 67162 invoked by uid 500); 4 Apr 2013 18:23:30 -0000 Delivered-To: apmail-lucene-java-user-archive@lucene.apache.org Received: (qmail 67120 invoked by uid 500); 4 Apr 2013 18:23:30 -0000 Mailing-List: contact java-user-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: java-user@lucene.apache.org Delivered-To: mailing list java-user@lucene.apache.org Received: (qmail 67110 invoked by uid 99); 4 Apr 2013 18:23:30 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 04 Apr 2013 18:23:30 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of jpountz@gmail.com designates 209.85.214.44 as permitted sender) Received: from [209.85.214.44] (HELO mail-bk0-f44.google.com) (209.85.214.44) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 04 Apr 2013 18:23:25 +0000 Received: by mail-bk0-f44.google.com with SMTP id jk13so1718719bkc.31 for ; Thu, 04 Apr 2013 11:23:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:mime-version:in-reply-to:references:from:date:message-id :subject:to:content-type; bh=exW410AamSp036PGawaIjks2F1ZyN1TXiTgqSFYSy94=; b=o1R8ts4u3Zeo+3SXbkNAmzc3gQBcVhvj0cXkUuai0P+xhN/amT+DXGVOLhopnBrzBn UV5OBZu1RwozRzSS+Xt7vZwR+uvlmXX8JvJcs8MU4uBe4IXAQkEgaHy+PNHUcMWrQa4b gR6I9NnHnsGp5oTqpDRHzBTORG07qro+CvFBg0GySelHtrydNJ+6d+3TQZdb9nh7Pp04 Ct/6YbLR3aFN0oT+9H7zsUQ13KAQv+MjXqg1k91KW8e6u1iutR80/7mHKTXYnWUhHuRw GuLLsIcgj7voiNqa/XbdTNzdLqvmar/vzibxHAefzr33C2EOXziGVKy4FGDzHCsOq0+g ikyA== X-Received: by 10.205.67.202 with SMTP id xv10mr1278574bkb.120.1365099783679; Thu, 04 Apr 2013 11:23:03 -0700 (PDT) MIME-Version: 1.0 Received: by 10.204.32.85 with HTTP; Thu, 4 Apr 2013 11:22:43 -0700 (PDT) In-Reply-To: References: From: Adrien Grand Date: Thu, 4 Apr 2013 20:22:43 +0200 Message-ID: Subject: Re: DocValues questions To: java-user@lucene.apache.org Content-Type: text/plain; charset=UTF-8 X-Virus-Checked: Checked by ClamAV on apache.org Hi, On Thu, Apr 4, 2013 at 10:30 AM, Wei Wang wrote: > A few quick questions about DocValues: > > 1. If only small number of documents have a ShortDocValueField defined, > should each document in the index has this field filled with some value? > The add() function of Document seems not enforce a DocValues field is > always added to each document. Given the name of the fied you are referring to, I assume that you are using Lucene 4.0 or 4.1. I would highly recommend to upgrade to Lucene 4.2 since the API has been completely refactored (but the disk format is compatible) and should hopefully be a little clearer. You are right that there is nothing that enforces that every document has a value : Lucene will give a default value to documents: 0 for numeric doc values and an empty byte array for binary doc values. > 2. Is there any examples to show how DocValues are stored and retrieved? It > seems JavaDoc only shows how to add it, and no complete examples are out > there. This should be transparent if you use doc values for eg. sorting. Otherwise, just call getNumericDocValues(field), getBinaryDocValues or getSortedDocValues on an AtomicReader. I hope this helps. -- Adrien --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org For additional commands, e-mail: java-user-help@lucene.apache.org