Return-Path: X-Original-To: apmail-lucene-solr-commits-archive@minotaur.apache.org Delivered-To: apmail-lucene-solr-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 1F0059BF3 for ; Sat, 19 Nov 2011 00:24:22 +0000 (UTC) Received: (qmail 64499 invoked by uid 500); 19 Nov 2011 00:24:22 -0000 Delivered-To: apmail-lucene-solr-commits-archive@lucene.apache.org Received: (qmail 64463 invoked by uid 500); 19 Nov 2011 00:24:22 -0000 Mailing-List: contact solr-commits-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: solr-dev@lucene.apache.org Delivered-To: mailing list solr-commits@lucene.apache.org Received: (qmail 64456 invoked by uid 99); 19 Nov 2011 00:24:22 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 19 Nov 2011 00:24:21 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.131] (HELO eos.apache.org) (140.211.11.131) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 19 Nov 2011 00:24:19 +0000 Received: from eos.apache.org (localhost [127.0.0.1]) by eos.apache.org (Postfix) with ESMTP id 7A037986; Sat, 19 Nov 2011 00:23:58 +0000 (UTC) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable From: Apache Wiki To: Apache Wiki Date: Sat, 19 Nov 2011 00:23:58 -0000 Message-ID: <20111119002358.83490.52107@eos.apache.org> Subject: =?utf-8?q?=5BSolr_Wiki=5D_Update_of_=22DIHCustomTransformer=22_by_Gustavo?= =?utf-8?q?Munoz?= Auto-Submitted: auto-generated X-Virus-Checked: Checked by ClamAV on apache.org Dear Wiki user, You have subscribed to a wiki page or wiki category on "Solr Wiki" for chan= ge notification. The "DIHCustomTransformer" page has been changed by GustavoMunoz: http://wiki.apache.org/solr/DIHCustomTransformer?action=3Ddiff&rev1=3D7&rev= 2=3D8 = ---- =3D=3D=3D What about returning values like null or an empty List? =3D=3D= =3D - Let TS =3D {t=C2=AB0=C2=BB, t=C2=AB1=C2=BB, t=C2=AB2=C2=BB, ..., t=C2=ABn= =C2=BB} is the transformer (ordered) list configured for a particular entit= y and say t=C2=ABi=C2=BB, with i <=3D n and i >=3D 0, returns null for a pa= rticular row (or for all the rows that a previous Transformer that creates = multiple rows from the original one), then there are two cases. + Let {{{TS =3D {t=C2=AB0=C2=BB, t=C2=AB1=C2=BB, t=C2=AB2=C2=BB, ..., t=C2= =ABn=C2=BB} }}}be the transformer (ordered) list configured for a particula= r entity and say {{{t=C2=ABi=C2=BB}}}, with {{{i <=3D n}}} and {{{i >=3D 0}= }}, returns {{{null}}} for a particular row (or for all the rows that a pre= vious Transformer that creates multiple rows from the original one), then t= here are two cases. - If no transformer t=C2=ABk=C2=BB, with k < i, returns a List of rows, the= n that particular row is ignored, that means, it won't be inserted, deleted= or updated. Additionally no transformer t=C2=ABj=C2=BB, with j > i, will b= e invoked. + If no transformer {{{t=C2=ABk=C2=BB}}}, with {{{k < i}}}, returns a {{{ja= va.util.List}}} of rows, then that particular row is ignored, that means, i= t won't be inserted, deleted or updated. Additionally no transformer {{{t= =C2=ABj=C2=BB}}}, with {{{j > i}}}, will be invoked. - If there is a transformer t=C2=ABk=C2=BB, with k < i, that returns a List= of rows for that particular row, an t=C2=ABi=C2=BB returns null for all th= ose recently created rows, then a java.lang.!IndexOutBoundsException will b= e thrown. + If there is a transformer {{{t=C2=ABk=C2=BB}}}, with {{{k < i}}}, that re= turns a {{{java.util.List}}} of rows for that particular row, and {{{t=C2= =ABi=C2=BB}}} returns {{{null}}} for all those recently created rows, then = a {{{ java.lang.IndexOutBoundsException }}} will be thrown. = - Now, if at any time a transformRow call returns an empty List, a java.lan= g.!IndexOutBoundsException will be thrown. + Now, if at any time a transformRow call returns an empty {{{java.util.Lis= t}}}, a {{{ java.lang.IndexOutBoundsException }}} will be thrown. So you sh= ould never return an empty {{{java.util.List}}}. ---- =3D=3D A General TrimTransformer =3D=3D Suppose you want to write a general !TrimTransformer without hardcoding t= he column on which it needs to operate. Now we'd need to have a flag on the= field in data-config.xml to indicate that the !TrimTransformer should appl= y itself on this field.