Hi Andi,

first please excuse I didn't get back to you regarding the tests - I did start 
with it but then got stuck and distracted from other tasks popping up. No 
excuse - I just failed to deliver what I promised.

> ...
> Would you please port it to the new 4.x API so that it can be included with 
> the PyLucene 4.1 release ? 


Yes, will do. And yes, the Facets API has changed - mainly due to a complete 
rewrite of huge parts of the code by Shai Erera (as written in LUCENE-4647).

I haven't yet worked with 4.x so I had to check the documentation first... 
(mainly API docs).  The most obvious change is in CategoryDocumentBuilder that 
has been replaced by the FacetFields class. The method of interest is certainly
        FacetFields.addFields(Document doc, Iterable<CategoryPath> categories)  
that should be used instead of
    CategoryDocumentBuilder.setCategoryPaths(Iterable<CategoryPath> 
categoryPaths)
AND
    CategoryDocumentBuilder.build(org.apache.lucene.document.Document doc)

It should be noted (and reported - to whom?) that the  "Apache Lucene Faceted 
Search User's Guide" at
http://lucene.apache.org/core/4_1_0/facet/org/apache/lucene/facet/doc-files/userguide.html
does NOT yet reflect the new API and thus is misleading (or just plain wrong).

Luckily the basic concept of a CategoryPath and a CountFacetRequest have 
remained unchanged AFAIK so changes should not be that big. Actually I did 
change the FacetSample.py according to the API changes I noticed already,  but 
couldn't test it yet because I was unable to build PyLucene4.1. 

Here's the diff against pylucene-trunk: 
https://dl.dropbox.com/u/4384120/FacetExample_patch.txt

And here's what I did in order to get my local pylucene-trunk environment 
up-to-date (to4.1) and how I failed:

I first did "svn up" and rebuild JCC and PyLucene but then noticed I still had 
got PyLucene4.0 :

>>> import lucene
>>> lucene.VERSION
'4.0'
>>> from org.apache.lucene.facet.taxonomy.directory import 
>>> DirectoryTaxonomyReader
>>> from org.apache.lucene.facet.index import FacetFields
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: cannot import name FacetFields
>>> import org.apache.lucene.facet.index 
>>> dir(org.apache.lucene.facet.index)
['CategoryContainer', 'CategoryDocumentBuilder', 'CategoryListPayloadStream', 
'OrdinalMappingAtomicReader', '__doc__', '__name__', '__package__', 
'attributes', 'categorypolicy', 'params', 'streaming']
>>> exit()

So I had to replace the java-source directory "lucene-java-40" - I just removed 
it and changed in Makefile
LUCENE_VER=4.1
then did make again, which svn updated the java-lucene sources into 
lucene-java-4.1:
...
A    lucene-java-4.1/lucene/queries/src/java/overview.html
A    lucene-java-4.1/lucene/queries/build.xml
Exported revision 1444751.

But then failed to build around pylucene-trunk/extensions.xml.  It did build 
/lucene-java-4.1/build/core/lucene-core-4.1.jar and other jars before though. 
The output is captured below.

Is there more that need to be changed in the Makefile for 4.1 or do you have 
any other local diff against the current pylucene-trunk that's needed? (I am 
using SVN URL http://svn.apache.org/repos/asf/lucene/pylucene/trunk).

Please let me know how to get pylucene-41 up and running locally so I can 
proceed with the migration of FacetsExample. Thx.

Cheers,
Thomas
--
OUTPUT of make (the part that failed) - steps including common.compile-core did 
succeed and it created 
lucene-java-4.1/lucene/build/highlighter/lucene-highlighter-4.1.jar
before it failed in pylucene-trunk/extensions.xml:

(pylucene)ios:pylucene-trunk koch$ make
cd lucene-java-4.1/lucene; (ant ivy-fail || ant ivy-bootstrap)
Buildfile: 
/Users/koch/Projekte/Python/pylucene/pylucene-trunk/lucene-java-4.1/lucene/build.xml

ivy-fail:
     [echo] 
     [echo]      This build requires Ivy and Ivy could not be found in your ant 
classpath.
     [echo] 
     [echo]      (Due to classpath issues and the recursive nature of the 
Lucene/Solr 
     [echo]      build system, a local copy of Ivy can not be used an loaded 
dynamically 
     [echo]      by the build.xml)
     [echo] 
     [echo]      You can either manually install a copy of Ivy 2.3.0 in your 
ant classpath:
     [echo]        http://ant.apache.org/manual/install.html#optionalTasks
     [echo] 
     [echo]      Or this build file can do it for you by running the Ivy 
Bootstrap target:
     [echo]        ant ivy-bootstrap     
     [echo]      
     [echo]      Either way you will only have to install Ivy one time.
     [echo] 
     [echo]      'ant ivy-bootstrap' will install a copy of Ivy into your Ant 
User Library:
     [echo]        /Users/koch/.ant/lib
     [echo]      
     [echo]      If you would prefer, you can have it installed into an 
alternative 
     [echo]      directory using the "-Divy_install_path=/some/path/you/choose" 
option, 
     [echo]      but you will have to specify this path every time you build 
Lucene/Solr 
     [echo]      in the future...
     [echo]        ant ivy-bootstrap -Divy_install_path=/some/path/you/choose
     [echo]        ...
     [echo]        ant -lib /some/path/you/choose clean compile
     [echo]        ...
     [echo]        ant -lib /some/path/you/choose clean compile
     [echo] 
     [echo]      If you have already run ivy-bootstrap, and still get this 
message, please 
     [echo]      try using the "--noconfig" option when running ant, or editing 
your global
     [echo]      ant config to allow the user lib to be loaded.  See the wiki 
for more details:
     [echo]        http://wiki.apache.org/lucene-java/HowToContribute#antivy
     [echo]     

BUILD FAILED
/Users/koch/Projekte/Python/pylucene/pylucene-trunk/lucene-java-4.1/lucene/common-build.xml:391:
 Ivy is not available

Total time: 0 seconds
Buildfile: 
/Users/koch/Projekte/Python/pylucene/pylucene-trunk/lucene-java-4.1/lucene/build.xml

ivy-bootstrap1:
     [echo] installing ivy 2.3.0 to /Users/koch/.ant/lib
      [get] Getting: 
http://repo1.maven.org/maven2/org/apache/ivy/ivy/2.3.0/ivy-2.3.0.jar
      [get] To: /Users/koch/.ant/lib/ivy-2.3.0.jar
      [get] Not modified - so not downloaded

ivy-bootstrap2:

ivy-checksum:

ivy-bootstrap:

BUILD SUCCESSFUL
Total time: 0 seconds
ant -f extensions.xml -Dlucene.dir=lucene-java-4.1
Buildfile: /Users/koch/Projekte/Python/pylucene/pylucene-trunk/extensions.xml

compile:
    [mkdir] Created dir: 
/Users/koch/Projekte/Python/pylucene/pylucene-trunk/build/classes
    [javac] 
/Users/koch/Projekte/Python/pylucene/pylucene-trunk/extensions.xml:19: warning: 
'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to 
false for repeatable builds
    [javac] Compiling 35 source files to 
/Users/koch/Projekte/Python/pylucene/pylucene-trunk/build/classes
    [javac] 
/Users/koch/Projekte/Python/pylucene/pylucene-trunk/java/org/apache/pylucene/search/PythonByteParser.java:25:
 org.apache.pylucene.search.PythonByteParser is not abstract and does not 
override abstract method termsEnum(org.apache.lucene.index.Terms) in 
org.apache.lucene.search.FieldCache.Parser
    [javac] public class PythonByteParser implements FieldCache.ByteParser {
    [javac]        ^
    [javac] 
/Users/koch/Projekte/Python/pylucene/pylucene-trunk/java/org/apache/pylucene/search/PythonDoubleParser.java:25:
 org.apache.pylucene.search.PythonDoubleParser is not abstract and does not 
override abstract method termsEnum(org.apache.lucene.index.Terms) in 
org.apache.lucene.search.FieldCache.Parser
    [javac] public class PythonDoubleParser implements FieldCache.DoubleParser {
    [javac]        ^
    [javac] 
/Users/koch/Projekte/Python/pylucene/pylucene-trunk/java/org/apache/pylucene/search/PythonFloatParser.java:25:
 org.apache.pylucene.search.PythonFloatParser is not abstract and does not 
override abstract method termsEnum(org.apache.lucene.index.Terms) in 
org.apache.lucene.search.FieldCache.Parser
    [javac] public class PythonFloatParser implements FieldCache.FloatParser {
    [javac]        ^
    [javac] 
/Users/koch/Projekte/Python/pylucene/pylucene-trunk/java/org/apache/pylucene/search/PythonIntParser.java:25:
 org.apache.pylucene.search.PythonIntParser is not abstract and does not 
override abstract method termsEnum(org.apache.lucene.index.Terms) in 
org.apache.lucene.search.FieldCache.Parser
    [javac] public class PythonIntParser implements FieldCache.IntParser {
    [javac]        ^
    [javac] 
/Users/koch/Projekte/Python/pylucene/pylucene-trunk/java/org/apache/pylucene/search/PythonLongParser.java:25:
 org.apache.pylucene.search.PythonLongParser is not abstract and does not 
override abstract method termsEnum(org.apache.lucene.index.Terms) in 
org.apache.lucene.search.FieldCache.Parser
    [javac] public class PythonLongParser implements FieldCache.LongParser {
    [javac]        ^
    [javac] 
/Users/koch/Projekte/Python/pylucene/pylucene-trunk/java/org/apache/pylucene/search/PythonShortParser.java:25:
 org.apache.pylucene.search.PythonShortParser is not abstract and does not 
override abstract method termsEnum(org.apache.lucene.index.Terms) in 
org.apache.lucene.search.FieldCache.Parser
    [javac] public class PythonShortParser implements FieldCache.ShortParser {
    [javac]        ^
    [javac] Note: 
/Users/koch/Projekte/Python/pylucene/pylucene-trunk/java/org/apache/pylucene/search/PythonFieldComparator.java
 uses unchecked or unsafe operations.
    [javac] Note: Recompile with -Xlint:unchecked for details.
    [javac] 6 errors

BUILD FAILED
/Users/koch/Projekte/Python/pylucene/pylucene-trunk/extensions.xml:19: Compile 
failed; see the compiler error output for details.
--
Am 10.02.2013 um 22:59 schrieb Andi Vajda <va...@apache.org>:

> 
> Hi Thomas,
> 
> I'm working towards getting a PyLucene 4.1 release ready.
> All unit tests were ported to the new API and now I'm onto samples.
> 
> The Lucene in Action samples are going to be dropped from the release as 
> they're not currently supported or being rewritten by the original (or 
> future) authors of the Lucene in Action book.
> 
> You contributed a sample a while ago called FacetExample.py.
> 
> Would you please port it to the new 4.x API so that it can be included with 
> the PyLucene 4.1 release ? I started porting it but the API changed in non 
> trivial ways and MIGRATE.txt doesn't mention how to adapt existing code to the
> change; only CHANGES.txt excerpted below) and I know nothing about the Lucene 
> facets API:
> 
>  LUCENE-4647:
>     CategoryDocumentBuilder and EnhancementsDocumentBuilder are
>     replaced by FacetFields and AssociationsFacetFields respectively.
>     CategoryEnhancement and AssociationEnhancement were removed in favor of a
>     simplified CategoryAssociation interface, with CategoryIntAssociation and
>     CategoryFloatAssociation implementations.
> 
> I checked in import changes for FacetExample.py (rev 1444622) but 
> CategoryDocumentBuilder no longer exists.
> 
> Please, let me know how you'd like to proceed.
> Thanks !
> 
> Andi..

Reply via email to