Thanks Yonghui, I will commit a fix - need to initialize the example class before each example is run !
Shai On Tue, Sep 30, 2014 at 1:26 PM, Yonghui Zhao <zhaoyong...@gmail.com> wrote: > > https://svn.apache.org/repos/asf/lucene/dev/branches/lucene_solr_4_8/lucene/demo/src/java/org/apache/lucene/demo/facet/SimpleFacetsExample.java > > In SimpleFacetsExample, > > /** Runs the search example. */ > public List<FacetResult> runFacetOnly() throws IOException { > index(); > return facetsOnly(); > } > > /** Runs the search example. */ > public List<FacetResult> runSearch() throws IOException { > index(); > return facetsWithSearch(); > } > > /** Runs the drill-down example. */ > public FacetResult runDrillDown() throws IOException { > index(); > return drillDown(); > } > > /** Runs the drill-sideways example. */ > public List<FacetResult> runDrillSideways() throws IOException { > index(); > return drillSideways(); > } > > /** Runs the search and drill-down examples and prints the results. */ > public static void main(String[] args) throws Exception { > System.out.println("Facet counting example:"); > System.out.println("-----------------------"); > SimpleFacetsExample example1 = new SimpleFacetsExample(); > List<FacetResult> results1 = example1.runFacetOnly(); > System.out.println("Author: " + results1.get(0)); > System.out.println("Publish Date: " + results1.get(1)); > > System.out.println("Facet counting example (combined facets and > search):"); > System.out.println("-----------------------"); > SimpleFacetsExample example = new SimpleFacetsExample(); > List<FacetResult> results = example.runSearch(); > System.out.println("Author: " + results.get(0)); > System.out.println("Publish Date: " + results.get(1)); > > System.out.println("\n"); > System.out.println("Facet drill-down example (Publish Date/2010):"); > System.out.println("---------------------------------------------"); > System.out.println("Author: " + example.runDrillDown()); > > System.out.println("\n"); > System.out.println("Facet drill-sideways example (Publish > Date/2010):"); > System.out.println("---------------------------------------------"); > for(FacetResult result : example.runDrillSideways()) { > System.out.println(result); > } > } > > > The example doesn't new SimpleFacetsExample each time. > > So in drill-down example, it indexes 2 times, the result number is 2 times. > in drill-sideways example. it indexes 3 times, the result number is 3 > times. > > Is it intended? >