Danny, can you try to describe your problem again? I don't think overriding OrdinalPolicy is something that you want to do in general. If you can, please provide a short example (even in text) with 1-2 documents, with their facets and what you're trying to achieve.
Shai On Tue, May 28, 2013 at 9:25 AM, Schimke, Danny <danny.schi...@incowia.com>wrote: > > Good Morning, > > thank you very much!! I got it so far, that the result changed by using > the different ordinal policies, but they're not correct so far. > > I think it does not work, because one lucene document can have one or even > more categories in my indexing routine and I think this causes faulty > counts!? > > I'm a little frustrated, that faceted search have to be that complicated. > > Maybe someone can check my independent java project if I attach it to this > mail (if it is accessible then?) for helping me figure out how to achieve > my goals. > > Thanks a lot and sorry for asking THAT much! > -Danny > > > -----Ursprüngliche Nachricht----- > Von: Shai Erera [mailto:ser...@gmail.com] > Gesendet: Montag, 27. Mai 2013 15:18 > An: java-user@lucene.apache.org > Betreff: Re: Faceted Search: count direct matches/member für result nodes > > 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 > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org > For additional commands, e-mail: java-user-h...@lucene.apache.org > >