Return-Path: X-Original-To: apmail-lucene-pylucene-dev-archive@minotaur.apache.org Delivered-To: apmail-lucene-pylucene-dev-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 97315CDB6 for ; Mon, 30 Apr 2012 17:28:42 +0000 (UTC) Received: (qmail 55184 invoked by uid 500); 30 Apr 2012 17:28:42 -0000 Delivered-To: apmail-lucene-pylucene-dev-archive@lucene.apache.org Received: (qmail 55138 invoked by uid 500); 30 Apr 2012 17:28:42 -0000 Mailing-List: contact pylucene-dev-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: pylucene-dev@lucene.apache.org Delivered-To: mailing list pylucene-dev@lucene.apache.org Received: (qmail 55127 invoked by uid 99); 30 Apr 2012 17:28:42 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 30 Apr 2012 17:28:42 +0000 X-ASF-Spam-Status: No, hits=0.7 required=5.0 tests=SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (nike.apache.org: local policy) Received: from [173.228.80.32] (HELO ovaltofu.org) (173.228.80.32) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 30 Apr 2012 17:28:34 +0000 Received: from [192.168.148.210] ([216.239.55.138]) (authenticated bits=0) by ovaltofu.org (8.14.4/8.14.4) with ESMTP id q3UHS6o2017335 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Mon, 30 Apr 2012 10:28:09 -0700 (PDT) Date: Mon, 30 Apr 2012 10:29:23 -0700 (PDT) From: Andi Vajda X-X-Sender: vajda@yuzu.local Reply-To: Andi Vajda To: pylucene-dev@lucene.apache.org Subject: Re: AW: AW: PyLucene use JCC shared object by default In-Reply-To: <020101cd26f3$05c2e6e0$1148b4a0$@orbiteam.de> Message-ID: References: <00a401cd1d67$8dffc900$a9ff5b00$@orbiteam.de> <1967FFCE-585B-489C-9CB4-032E42B1D3AC@apache.org> <020101cd26f3$05c2e6e0$1148b4a0$@orbiteam.de> User-Agent: Alpine 2.01 (OSX 1266 2009-07-14) MIME-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="0-1781718703-1335806971=:5446" --0-1781718703-1335806971=:5446 Content-Type: TEXT/PLAIN; charset=utf-8; format=flowed Content-Transfer-Encoding: 8BIT Hi Thomas, On Mon, 30 Apr 2012, Thomas Koch wrote: > I again had a look at the patch I submitted recently and would like to get > back to it. An updated version of the patch is attached to this email - > the patch is against the branch_3x repo > http://svn.apache.org/repos/asf/lucene/pylucene/branches/branch_3x Thank you for sending this, I just got back from vacation and was going to ask you about this as I'd like to get the PyLucene 3.6 release out soon - if possible with you patch. > The patch mainly > - adds two java classes: PythonList, PythonListIterator > - adds according Python classes (JavaListIterator and JavaList in collections.py) > > Purpose: > - provide a Java-based List implementation in JCC/PyLucene (similar to existing PythonSet/JavaSet) > - allow to pass python lists via Java Collections into PyLucene > > Let's try summarize shortly: PythonSet /JavaSet was already existing, but > nothing similar for Lists. I made an implementation of PythonList > /JavaList and with your help this is now basically working. Except of an > open issue that affects both JavaSet and JavaList: initialization of an > ArrayList with a JavaSet (or JavaList) may cause trouble. > > As you said: "There is a bug somewhere with constructing an ArrayList from > a python collection like JavaSet or JavaList." > > I tried to change the toArray() method as you suggested, but that didn't > help. As far as I understood, there are two options to box python values > into a typed JArray: > > 1) use the object based JArray class and box python values by wrapping > them with the corresponding Java object (e.g. type -> > lucene.Integer): > >>>> x = lucene.JArray('object')([lucene.Boolean(True),lucene.Boolean(False)]) > JArray[, ] >>>> type(x[0]) > > > 2) use the correct array type (int, float, etc.) and pass the list of > Python elements or literals) to the JArray constructur, e.g. > >>>> y = lucene.JArray('bool')([True,False]) > JArray[True, False] >>>> type(y[0]) > > > I tried both of them (see _pyList2JArray methods in collections.py) but > none of them did the trick. Actually the 'empty objects in ArrayList' > problem remains when handling with strings (the ArrayList object that is > initialized with a JavaSet or JavaList of string items will have a number > of objects as the original JavaSet/JavaList, but all objects are the same > - ooks like an array of empty objects). Furthermore another issue with > integer lists comes into play: here the initialization of ArrayList with > the Collection fails with a Java stacktrace (lucene.JavaError: > org.apache.jcc.PythonException). > > The most simple test case is as follows: > > --%< -- > import lucene > lucene.initVM() > from lucene.collections import JavaList > > # using strings: the ArrayList is created, but initialized with empty objects > jl = JavaList(['a','b']) > al = lucene.ArrayList(jl) > assert (not al.get(0).equals(al.get(1))), "unique values" > > # using ints: the ArrayList is not created, but an error occurs instead: > # Java stacktrace: org.apache.jcc.PythonException: ('while calling toArray') > jl = JavaList(range(3)) > al = lucene.ArrayList(jl) > --%< -- > > I currently feel like having to stab around in the dark to find out what's > going on here and would welcome any suggestions. Needs some JCC expert I > guess ,-) > > Of course we can leave the patch out - but still there's the same issue > with JavaSet. I'd like to get to the bottom of this before the 3.6 release. It's a matter of my finding the time this week. Thanks for reviving this ! Andi.. > > > kind regards > > Thomas > -- > OrbiTeam Software GmbH & Co. KG, Germany > http://www.orbiteam.de > > >> -----Ursprüngliche Nachricht----- >> Von: Andi Vajda [mailto:vajda@apache.org] >> Gesendet: Mittwoch, 18. April 2012 20:37 >> An: pylucene-dev@lucene.apache.org >> Betreff: Re: AW: PyLucene use JCC shared object by default >> >> >> Hi Thomas, >> ... >> Lucene 3.6 just got released a few days ago. Apart from your patch, the >> PyLucene 3.6 release is ready. I'm about to go offline (email only) for a week. >> Let's revisit this patch then (first week of May). It's not blocking the release >> right now as, even if I sent out a release candidate for a vote, the three >> business days required for this would take this into the time I'm away. >> ... >> Andi.. > > --0-1781718703-1335806971=:5446--