Hi Shai, you understood correctly, fantastic! You described my data representation properly.
Yes, one document is a person and for each community there is a referenced category, currently with hierachical String representation delemited by slash "/", in the taxonomy index. Yes, communities are hiearchical, but if necessary I could store them as strings - here I can feel free. That's why I asked about store them in kind of 2 different lists - one with hierarchical image and one with string? Suppose we have the data you described: *P1 * name: John Doe communities: C1/C2, C4/C5/C6 *P2 * name: John Smith communities: C1/C3, C4/C7 This means *P1 is direct member of C2 and C6. *P2 is direct member of C3 and C7. I expect the following results: 1. Flat list, direct membership: C2 (1) C3 (1) C6 (1) C7 (1) 2. Flat list, indirect membership: C1 (2) C2 (1) C3 (1) C4 (2) C5 (1) C6 (1) C7 (1) 3. Hierarchical, indirect membership: C1 (2) | |- C2 (1) |- C3 (1) |- C4 (2) | |- C5 (1) | |- C6 (1) | |- C7 (1) 4. Hierarchical, direct membership (same as #3, but only show counts for direct members, others are only show to complete the tree) C1 | |- C2 (1) |- C3 (1) |- C4 | |- C5 | |- C6 (1) | |- C7 (1) I think we're on a good way now. Thanks you very much! -Danny -----Ursprüngliche Nachricht----- Von: Shai Erera [mailto:ser...@gmail.com] Gesendet: Dienstag, 28. Mai 2013 12:04 An: java-user@lucene.apache.org Betreff: Re: Faceted Search: count direct matches/member für result nodes What represents a document in the index, the persons? And each person is associated with 0..N communities? And are communities hierarchical? So if I have these two documents: *P1 * name: John Doe communities: C1/C2, C4/C5/C6 *P2 * name: John Smith communities: C1/C3, C4/C7 Does that represent the data? If so, can you give an example of the flat list, direct membership, hierarchical etc.? Just so I get a better understanding of what you want to achieve. Shai On Tue, May 28, 2013 at 12:05 PM, Schimke, Danny <danny.schi...@incowia.com>wrote: > > Hello Shai, > > here my scenario: > > There are persons. Each person can be a member of 0..n groups. On the > frontend there are 2 different views. One is hierarchical, the other one is > a list (flat). These groups should be shown as facets (how many persons are > member of a group). > > A further option (on frontend) is, that the view, either a list or a > hiearchie should be switchable in their visibility between direct > memberships (only show groups without their parents or the parents should > have zero as count if it has no direct member) and indirect memberships > (show all groups even if they have no direct members in search result). > > Today I spoke with a coworker: maybe it is possible to hold 2 different > category lists - one for direct members only (flat list, category without > category path: instead it holds only a string without delemiter), the other > one for indirect membership (hierarchical categories) and access them based > on required results? > > If something isn't clear, please ask and I'll explain obscurities. > Thanks a lot for spent your precious time for solve my problem! > > -Danny > > > -----Ursprüngliche Nachricht----- > Von: Shai Erera [mailto:ser...@gmail.com] > Gesendet: Dienstag, 28. Mai 2013 09:13 > An: java-user@lucene.apache.org > Betreff: Re: Faceted Search: count direct matches/member für result nodes > > 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 > > > > > > --------------------------------------------------------------------- > 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