Hi To override OrdinalPolicy you need to do the following:
FacetIndexingParams fip = new FacetIndexingParams() { public CategoryListParams getCategoryListParams(CategoryPath) { return new CategoryListParams() { public OrdinalPolicy getOrdinalPolicy(String) {} } } } BTW, in the code example you pasted, you don't need to add the categories first to taxoWriter. It's enough to call facetFields.addFields(), it will take care of adding the categories to the taxonomy as well. HTH, Shai On Mon, May 27, 2013 at 4:11 PM, Schimke, Danny <danny.schi...@incowia.com>wrote: > Hi, > > currently I have time to try out your suggestions. First I want try using > the advice using "OrdinalPolicy". > > But I have problems defining the Params FacetIndexingParams. How do I > create those params with the required OrdinalPolicy? > > I already searched a lot, but found no solution yet. Here is a small > snipped of code for indexing: > > List<CategoryPath> categories = new ArrayList<CategoryPath>(); > for (String path : paths) { > CategoryPath cat = new CategoryPath(FIELD_GROUP_ID + "/" + path, '/'); > categories.add(cat); > } > for (CategoryPath path : categories) { > taxoWriter.addCategory(path); > } > ... > // TODO FacetIndexingParams need to be added here... > FacetFields ff = new FacetFields(taxoWriter); > ff.addFields(doc, categories); > > Thanks a lot in advance! > -Danny > > -----Ursprüngliche Nachricht----- > Von: Nicola Buso [mailto:nb...@ebi.ac.uk] > Gesendet: Donnerstag, 25. April 2013 12:51 > An: java-user@lucene.apache.org > Betreff: Re: Faceted Search: count direct matches/member für result nodes > > Hi, > > which version of Lucene? > > Check the OrdinalPolicy you are using in FacetIndexingParams at indexing > time. > > I think you should use: NonTopLevelOrdinalPolicy in lucene 3.6.1 or > OrdinalPolicy.ALL_BUT_DIMENSION in lucene 4.2.1 > > > > Nicola. > > > On Thu, 2013-04-25 at 08:32 +0200, Schimke, Danny wrote: > > Hi, > > > > > > > > I am new to lucene. I've done some basics so far. Currently I have to > deal with Faceted Search. > > > > > > > > Given: > > > > For example I have the following categories: > > > > > > > > Root > > > > Root/idA/ > > > > Root/idA/idB > > > > Root/idA/idB/idC > > > > > > > > Scenario: > > > > The search result delivers the folowing FacetResult for example: > > > > > > > > Root (5) > > > > Root/idA (5) > > > > Root/idA/idB (3) > > > > Root/idA/idB/idC (3) > > > > > > > > That means 2 direct matches for Root/idA and 3 direct matches for > Root/idA/idB/idC. > > > > > > > > But I want ability to get the count that one category exactly has, > without consideration of the subcategories (only "direct" member), e.g.: > > > > > > > > Root (0) > > > > Root/idA (2) > > > > Root/idA/idB (0) > > > > Root/idA/idB/idC (3) > > > > > > > > Maybe there is a standard way don't calculate this by hand in dependence > to subcategories? > > > > > > > > How can I achieve this? > > > > Thanks a lot in advance! > > > > > > > > -Danny > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org > For additional commands, e-mail: java-user-h...@lucene.apache.org > > --------------------------------------------------------------------- > To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org > For additional commands, e-mail: java-user-h...@lucene.apache.org > >