Return-Path: Delivered-To: apmail-lucene-dev-archive@www.apache.org Received: (qmail 21957 invoked from network); 10 Nov 2010 16:36:11 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 10 Nov 2010 16:36:11 -0000 Received: (qmail 93817 invoked by uid 500); 10 Nov 2010 16:36:42 -0000 Delivered-To: apmail-lucene-dev-archive@lucene.apache.org Received: (qmail 93642 invoked by uid 500); 10 Nov 2010 16:36:41 -0000 Mailing-List: contact dev-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@lucene.apache.org Delivered-To: mailing list dev@lucene.apache.org Received: (qmail 93635 invoked by uid 99); 10 Nov 2010 16:36:41 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 10 Nov 2010 16:36:41 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.22] (HELO thor.apache.org) (140.211.11.22) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 10 Nov 2010 16:36:39 +0000 Received: from thor (localhost [127.0.0.1]) by thor.apache.org (8.13.8+Sun/8.13.8) with ESMTP id oAAGaHZJ026993 for ; Wed, 10 Nov 2010 16:36:17 GMT Message-ID: <28297318.7901289406977457.JavaMail.jira@thor> Date: Wed, 10 Nov 2010 11:36:17 -0500 (EST) From: "Simon Willnauer (JIRA)" To: dev@lucene.apache.org Subject: [jira] Commented: (LUCENE-2742) Enable native per-field codec support In-Reply-To: <31407393.29411288961261969.JavaMail.jira@thor> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/LUCENE-2742?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12930645#action_12930645 ] Simon Willnauer commented on LUCENE-2742: ----------------------------------------- bq. +1 to commit - great work Simon! I should note that this patch changes the index file format and it is not compatible with indexes build with previous TRUNK version. Indexes build with previous lucene versions will still work like a charm I will go ahead and commit > Enable native per-field codec support > -------------------------------------- > > Key: LUCENE-2742 > URL: https://issues.apache.org/jira/browse/LUCENE-2742 > Project: Lucene - Java > Issue Type: Improvement > Components: Index, Store > Affects Versions: 4.0 > Reporter: Simon Willnauer > Assignee: Simon Willnauer > Fix For: 4.0 > > Attachments: LUCENE-2742.patch, LUCENE-2742.patch, LUCENE-2742.patch, LUCENE-2742.patch, LUCENE-2742.patch > > > Currently the codec name is stored for every segment and PerFieldCodecWrapper is used to enable codecs per fields which has recently brought up some issues (LUCENE-2740 and LUCENE-2741). When a codec name is stored lucene does not respect the actual codec used to encode a fields postings but rather the "top-level" Codec in such a case the name of the top-level codec is "PerField" instead of "Pulsing" or "Standard" etc. The way this composite pattern works make the indexing part of codecs simpler but also limits its capabilities. By recoding the top-level codec in the segments file we rely on the user to "configure" the PerFieldCodecWrapper correctly to open a SegmentReader. If a fields codec has changed in the meanwhile we won't be able to open the segment. > The issues LUCENE-2741 and LUCENE-2740 are actually closely related to the way PFCW is implemented right now. PFCW blindly creates codecs per field on request and at the same time doesn't have any control over the file naming nor if a two codec instances are created for two distinct fields even if the codec instance is the same. If so FieldsConsumer will throw an exception since the files it relies on are already created. > Having PerFieldCodecWrapper AND a CodecProvider overcomplicates things IMO. In order to use per field codec a user should on the one hand register its custom codecs AND needs to build a PFCW which needs to be maintained in the "user-land" an must not change incompatible once a new IW of IR is created. What I would expect from Lucene is to enable me to register a codec in a provider and then tell the Field which codec it should use for indexing. For reading lucene should determ the codec automatically once a segment is opened. if the codec is not available in the provider that is a different story. Once we instantiate the composite codec in SegmentsReader we only have the codecs which are really used in this segment for free which in turn solves LUCENE-2740. > Yet, instead of relying on the user to configure PFCW I suggest to move composite codec functionality inside the core an record the distinct codecs per segment in the segments info. We only really need the distinct codecs used in that segment since the codec instance should be reused to prevent additional files to be created. Lets say we have the follwing codec mapping : > {noformat} > field_a:Pulsing > field_b:Standard > field_c:Pulsing > {noformat} > then we create the following mapping: > {noformat} > SegmentInfo: > [Pulsing, Standard] > PerField: > [field_a:0, field_b:1, field_c:0] > {noformat} > that way we can easily determ which codec is used for which field an build the composite - codec internally on opening SegmentsReader. This ordering has another advantage, if like in that case pulsing and standard use really the same type of files we need a way to distinguish the used files per codec within a segment. We can in turn pass the codec's ord (implicit in the SegmentInfo) to the FieldConsumer on creation to create files with segmentname_ord.ext (or something similar). This solvel LUCENE-2741). -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org For additional commands, e-mail: dev-help@lucene.apache.org