Hello Thomas,

Thanks for the update on the facets! I just tested this 
with my PyLucene 4.8.0 and can confirm it works great:

Indexed 2 documents with facets.

search by term 'white' ...
Categories:  1
 'root' (2)
Root-a-Categories:  3
 'f1' (2)
 'f2' (1)
 'f3' (1)
Author:  2
 'Bob' (1)
 'Lisa' (1)

search by term 'car' ...
Categories:  1
 'root' (1)
Root-a-Categories:  2
 'f1' (1)
 'f2' (1)
Author:  1
 'Bob' (1)

search all documents  ...
Categories:  1
 'root' (2)
Root-a-Categories:  3
 'f1' (2)
 'f2' (1)
 'f3' (1)
Author:  2
 'Bob' (1)
 'Lisa' (1)


Best regards,
—Ed

On Jun 2, 2014, at 8:04, Thomas Koch <k...@orbiteam.de> wrote:

> Am 30.05.2014 um 23:08 schrieb Andi Vajda <va...@apache.org>:
> 
>> Thanks Thomas !
>> Once you do that maybe it's time to make a 4.8.1 release too.
>> Let me know when you're ready with a fix.
> 
> TLDR;  fix is available: I've now revised the FacetExample.py to use the new 
> API - it's tested to work with pylucene-4.8.0-1
> The source can be found here:  
> https://dl.dropboxusercontent.com/u/4384120/Python/FacetExample.py
> Andi, can you please update the file in the repo? thanks.
> 
> details:  I should correct myself. The FacetExample was 'ported' to 4.x (with 
> new fully qualified imports) already.
> However in Java Lucene Release 4.7.0 [2014-02-26] some API Changes did break 
> the code:
> LUCENE-5339: The facet module was simplified/reworked to make the APIs more 
> approachable to new users. 
> 
> Note: when migrating to the new API, you must pass the Document that is 
> returned 
>      from FacetConfig.build() to IndexWriter.addDocument(). 
>      (Shai Erera, Gilad Barkai, Rob Muir, Mike McCandless)
> see https://issues.apache.org/jira/browse/LUCENE-5339 for details!
> (This was really a good and needed simplification of the Facet API!)
> 
> Some notes for those interested in facet search in Lucene:
> 
> - there are some Java samples available with Lucene Java, e.g.
>  
> http://svn.apache.org/repos/asf/lucene/dev/branches/lucene_solr_4_8/lucene/demo/src/java/org/apache/lucene/demo/facet/SimpleFacetsExample.java
>  (which I took as a reference)
> 
> - back in 4.4 there was some good documentation (besides Javadocs) - the 
> "Apache Lucene Faceted Search "User's Guide
> http://lucene.apache.org/core/4_4_0/facet/org/apache/lucene/facet/doc-files/userguide.html
> 
> I can't find it for more recent versions though and according to Changelog it 
> was removed with 4.5 because it's outdated:
> LUCENE-4894: remove facet userguide as it was outdated. Partially absorbed 
> into 
>             package's documentation and classes javadocs. 
>             (Shai Erera)
> (still think it's partially useful introductory reading though...)
> 
> - developer hint:
> 
> whereas in Java you can write
> doc.add(new FacetField("Publish Date", "2010", "10", "20"));
>  here "Publish Date" is the 'dimension'
>  and "2010", "10", "20" is the 'path' 
> 
> in Python you need to declare the path as an array argument:
> doc.add(FacetField("Publish Date", ["2010", "10", "20"]))
> 
> 
> Java introduced 'varargs' feature to pass unspecified number of argument to a 
> method in JDK 5.0.
> Python can do similar by using the *args which can be passed a list of 
> arguments - as positional arguments.
> Seems however JCC does for some (probably good) reason not map Java varargs 
> to python *args.
> 
> 
> regards,
> Thomas

Reply via email to