Hi Thomas,
On Mon, 11 Feb 2013, Thomas Koch wrote:
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.
Oh well. No worries.
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?)
Either file a bug on https://issues.apache.org/jira/browse/LUCENE
or send a note to d...@lucene.apache.org (subscribe first).
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 :
I checked in the latest Makefile for version 4.1 into rev 1445038.
Be sure to have
LUCENE_SVN=http://svn.apache.org/repos/asf/lucene/dev/branches/branch_4x
as well.
... snip ...
[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
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).
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.
Andi..