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 7DD6FFA08 for ; Mon, 8 Apr 2013 21:44:20 +0000 (UTC) Received: (qmail 16555 invoked by uid 500); 8 Apr 2013 21:44:20 -0000 Delivered-To: apmail-lucene-pylucene-dev-archive@lucene.apache.org Received: (qmail 16439 invoked by uid 500); 8 Apr 2013 21:44:19 -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 16427 invoked by uid 99); 8 Apr 2013 21:44:19 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 08 Apr 2013 21:44:19 +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: local policy) Received: from [92.51.173.165] (HELO mail.orbiteam.de) (92.51.173.165) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 08 Apr 2013 21:44:15 +0000 Received: from localhost (localhost [127.0.0.1]) by mail.orbiteam.de (Postfix) with ESMTP id B8FF218660BA for ; Mon, 8 Apr 2013 23:43:52 +0200 (CEST) Received: from mail.orbiteam.de ([127.0.0.1]) by localhost (mail.orbiteam.de [127.0.0.1]) (amavisd-new, port 10024) with LMTP id l2DKeGELB8wD for ; Mon, 8 Apr 2013 23:43:51 +0200 (CEST) Received: from [192.168.2.110] (p5B0A0E6A.dip.t-dialin.net [91.10.14.106]) by mail.orbiteam.de (Postfix) with ESMTPSA id 5CCE118660B8 for ; Mon, 8 Apr 2013 23:43:51 +0200 (CEST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 6.3 \(1503\)) Subject: Re: FacetExample.py From: Thomas Koch In-Reply-To: Date: Mon, 8 Apr 2013 23:44:03 +0200 Content-Transfer-Encoding: quoted-printable Message-Id: <4EC2760A-8191-4F7A-B1FE-7881594C92FC@orbiteam.de> References: <1519E5E4-F08E-4532-B3E3-5C9E74D1CD5B@orbiteam.de> To: pylucene developers X-Mailer: Apple Mail (2.1503) X-Virus-Checked: Checked by ClamAV on apache.org Hi Andi, I could reproduce this and fixed it. A patch is available here: = https://dl.dropbox.com/u/4384120/pylucene42-facetexample-patch-20130408.tx= t This is caused by change LUCENE-4700 in 4.2.1 cf. http://lucene.apache.org/core/4_2_1/changes/Changes.html regards Thomas -- Am 07.04.2013 um 00:22 schrieb Andi Vajda : >=20 > Hi Thomas, >=20 > I resumed with the PyLucene samples migration and FacetExample.py is = broken again because of another change in the facet module (I guess). > Namely, if you built PyLucene (trunk) against Lucene 4.2.1 by setting >=20 > = LUCENE_SVN=3Dhttp://svn.apache.org/repos/asf/lucene/dev/tags/lucene_solr_4= _2_1 >=20 > in the Makefile. >=20 > Then: > $ rm -rf lucene-java* > $ make > $ make test (all should pass) > $ make install > $ python samples/FacetExample.py index (seems to work) > $ python samples/FacetExample.py simple >=20 > you get this error: >=20 > AttributeError: type object 'FacetIndexingParams' has no attribute = 'ALL_PARENTS' >=20 > Could you please look into this, make FacetExample.py work again ? >=20 > Thanks ! >=20 > Andi.. >=20 >=20 > On Wed, 13 Feb 2013, Thomas Koch wrote: >=20 >> Hi Andi, >> You're right - and API docs are wrong. Actually both must have change = after 4.1 release: I checked the source of java-lucene v4.1 = (lucene-4.1.0-src.tgz / 21-Jan-2013) and it matches the online = javadocs. So I guess you're preparing for PyLucene v4.2? >>=20 >> Note: I think that = LUCENE_SVN=3Dhttp://svn.apache.org/repos/asf/lucene/dev/branches/branch_4x= is the "trunk" where 4.x development happens (i.e. "unstable") whereas >> http://svn.apache.org/repos/asf/lucene/dev/branches/lucene_solr_4_1/ >> is the "stable" Lucene4.1/Solr4.1 branch (matching the 4.1 release = and API docs). So if that's right (please correct me if I'm wrong) - why = did you choose the branch_4x? >>=20 >> Anyway, I fixed the FacetsExample.py for branch_4x now ,-) >>=20 >> Some notes on API changes for those interested: >> -the 'new' FacetsCollector has a factory pattern now: >> public static FacetsCollector create(FacetSearchParams fsp, = IndexReader indexReader, TaxonomyReader taxoReader) >> - the order of constructor arguments for FacetSearchParams has = changed! >> - FacetResultNode has changed: it used to be an interface but is now = a concrete class (and the method getSubResults of FacetResultNode = disappeared) >> - DrillDown.query() became DrillDownQuery() - with a new API. >>=20 >> Well, at least API docs state it: >> "WARNING: This API is experimental and might change in incompatible = ways in the next release." >> So one should be warned... >>=20 >> Here's the new version: = https://dl.dropbox.com/u/4384120/FacetExample.py >> Or as patch to svn: = https://dl.dropbox.com/u/4384120/FacetExample_patch_20130213.txt >>=20 >> Thanks again for your help. >>=20 >> regards, >> Thomas >> -- >> Am 12.02.2013 um 22:36 schrieb Andi Vajda : >>=20 >>>=20 >>> Hi Thomas, >>>=20 >>> On Tue, 12 Feb 2013, Thomas Koch wrote: >>>=20 >>>> Thanks to your hints I was now able to build PyLucene4.1 and got = further with the FacetExample.py - The imports should be OK now and most = of the required changes are done I guess. However I now reached another = problem: I need to instantiate the class 'FacetsCollector' but get an = error when doing so: >>>>=20 >>>> File "samples/FacetExample.py", line 222, in = searchWithRequestAndQuery >>>> facetsCollector =3D FacetsCollector(facetSearchParams, = indexReader, taxoReader) >>>> NotImplementedError: ('instantiating java class', ) >>>>=20 >>>> The java example has this line: >>>> FacetsCollector facetsCollector =3D new = FacetsCollector(facetSearchParams, indexReader, taxoReader); >>>> and javadocs state it has a public constructor: >>>> = http://lucene.apache.org/core/4_1_0/facet/org/apache/lucene/facet/search/F= acetsCollector.html#FacetsCollector(org.apache.lucene.facet.search.params.= FacetSearchParams,%20org.apache.lucene.index.IndexReader,%20org.apache.luc= ene.facet.taxonomy.TaxonomyReader) >>>>=20 >>>> So what could be the reason for this behavior? >>>=20 >>> The FacetCollector class is declared abstract. Thus you can't = instantiate it, constructor or not. I think the intent is to instantiate = one of its concrete inner subclasses. >>> See = lucene-java-4.1/lucene/facet/src/java/org/apache/lucene/facet/search/Facet= sCollector.java >>>=20 >>>> I have another problem with the constructor of FacetSearchParams: = it is expecting arguments: >>>> (List facetRequests, FacetIndexingParams = indexingParams) >>>> but neither >>>> FacetSearchParams(Arrays.asList([facetRequest,]), indexingParams) >>>> nor >>>> FacetSearchParams([facetRequest,], indexingParams) >>>> does it here. I get >>>>=20 >>>> lucene.InvalidArgsError: (, '__init__', = (, )) >>>=20 >>> There are four constructors on FacetSearchParams, none of which = seems to match your call: >>> public FacetSearchParams(FacetRequest... facetRequests) >>> public FacetSearchParams(List facetRequests) >>> public FacetSearchParams(FacetIndexingParams indexingParams, = FacetRequest... facetRequests) >>> public FacetSearchParams(FacetIndexingParams indexingParams, = List facetRequests) >>>=20 >>> See = lucene-java-4.1/lucene/facet/src/java/org/apache/lucene/facet/params/Facet= SearchParams.java >>>=20 >>> You seem to be passing FacetIndexingParams last. >>>=20 >>> Andi.. >>>=20 >>>=20 >>>>=20 >>>> I thought that JavaList could help, but I cannot import it: >>>>>>> from lucene.collections import JavaList >>>> Traceback (most recent call last): >>>> File "", line 1, in >>>> File = "/Users/koch/.virtualenvs/pylucene/lib/python2.7/site-packages/lucene-4.1-= py2.7-macosx-10.8-x86_64.egg/lucene/collections.py", line 17, in = >>>> from org.apache.pylucene.util import \ >>>> ImportError: No module named pylucene.util >>>>>>>=20 >>>>=20 >>>> That's probably because I had to disable in Makefile >>>> ## JARS+=3D$(HIGHLIGHTER_JAR) # needs memory contrib >>>> ## JARS+=3D$(EXTENSIONS_JAR) # needs highlighter contrib >>>>=20 >>>> Do you think that's a type cast issue and that JavaList would help = here? >>>> I need to define a 'typed' list , e.g. List >>>>=20 >>>> FacetSearchParams API docs: >>>> = http://lucene.apache.org/core/4_1_0/facet/org/apache/lucene/facet/search/p= arams/FacetSearchParams.html >>>>=20 >>>> Current version of FacetExample.py >>>> https://dl.dropbox.com/u/4384120/FacetExample.py >>>>=20 >>>> Any hints? >>>>=20 >>>> regards, >>>> Thomas >>>> -- >>>> Am 12.02.2013 um 09:19 schrieb Andi Vajda : >>>>=20 >>>>>=20 >>>>> On Tue, 12 Feb 2013, Andi Vajda wrote: >>>>>=20 >>>>>> Indeed. I reproduced that error here. >>>>>> A new method was added to the FieldCache.Parser interface. >>>>>> I added it to the classes missing it (rev 1445048). >>>>>>=20 >>>>>> I then found that the test case from hell, TestSort.java, has = majorly changed again and test_Sort.py needs to be ported again. Sigh. >>>>>=20 >>>>> That being said, you should be able to build PyLucene 4.1 again = and proceed with FacetExample.py. The test_Sort.py needed work shouldn't = be blocking you. >>>>>=20 >>>>> Andi.. >>>>=20 >>>>=20 >>=20 >>=20