Hi, wow, thank you (Nicola Buso and Shai Erera) for answering quickly!!
Now I have two suggestions that meight help me out of my problem. I'll try as soon as possible and give feedback about the results or fails. Thanks a lot for previous approaches! -Danny -----Ursprüngliche Nachricht----- Von: Shai Erera [mailto:ser...@gmail.com] Gesendet: Donnerstag, 25. April 2013 13:34 An: java-user@lucene.apache.org; nb...@ebi.ac.uk Betreff: Re: Faceted Search: count direct matches/member für result nodes Hi It's ... tricky :). If you ask for depth=3, then you will never get idC because idB's count is 0. I think what you could do is the following: 1. Index the categories with NO_PARENTS 2. Write a FacetsAggregator which extends FastCountingFacetsAggregator 3. Override rollupValues() to clone FacetArrays.intArray() (deep clone, with e.g. System.arraycopy) and then call super.rollupValues(). 1. Alternatively, traverse the given array and put every ordinal with value >0 in an IntToIntMap (will be better if you expect only a small portion of the taxonomy should be exact-counted) 4. Let the search complete and FacetResultHandler to compute the full hierarchy 1. At this point, the counts you'll get in the returned tree will include the aggregated counts from all the leaves 5. Now, traverse the tree of results and correct FacetResultNode.value by pulling its exact count from the cloned array. I hope that answers your question (and that I understood it properly) :). Shai On Thu, Apr 25, 2013 at 1:50 PM, Nicola Buso <nb...@ebi.ac.uk> wrote: > 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