You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by "Schimke, Danny" <Da...@incowia.com> on 2013/04/25 08:32:51 UTC

Faceted Search: count direct matches/member für result nodes

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


Re: Faceted Search: count direct matches/member für result nodes

Posted by Shai Erera <se...@gmail.com>.
Hi

I think that building the result tree is a good decision. And I think that
you can accomplish that by implementing a FacetResultsHandler which takes
the FacetArrays (that contains the counts for all categories) and builds
the result FacetResult including all tree sub-nodes.

You can find somewhat related code in CountingFacetsAggregator.rollupValues
which traverses the count array and rollup the values from the leafs to
their parents. You can write similar recursive code which builds a
hierarchical FacetRestulNode. Your search request can defined whether
counts should be rolled-up (indirect membership?) or stay at 0 (direct
membership).

And I think that you can index all the data just once by setting
OrdinalPolicy.NO_PARENTS. If you only require direct membership, you don't
rollup the counts to the parents, if you do, you do the rollup. Then the
FacetResult is constructed either as flat list (single FacetResultNode with
many subResults) or a tree.

Shai


On Tue, May 28, 2013 at 4:39 PM, Schimke, Danny
<Da...@incowia.com>wrote:

> Hi,
>
> I finished 3 of my 4 requirements.
> * Indirect membership for list and hierarchical
> * direct membership for flat list
>
> I accomplished the flat list for direct memberships by indexing a second
> category using another category path prefix and "id" in this case does not
> contain any slash "/" e.g.:
>
> CategoryPath catIndirect = new CategoryPath(FIELD_GROUP_ID_DIRECT + "/" +
> id, '/');
>
> Now I can search usual on "FIELD_GROUP_ID_DIRECT" and get my flat results.
> This way I have the communities ID to retrieve any information about this
> "community".
>
> Anyway one point is still unanswered. I still have no solution for the
> hierarchical direct membership. So far we decided to build that tree
> manually by using IDs from the flat result of direct members because it
> contains all IDs upward to its root community. Maybe it is an option to
> hold the flat search result for direct members against the hierarchical
> search result for indirect members?
>
> But if there is a lucene standard we prefer to use it.
>
> -Danny
>
>
>
> -----Ursprüngliche Nachricht-----
> Von: Schimke, Danny [mailto:Danny.Schimke@incowia.com]
> Gesendet: Dienstag, 28. Mai 2013 12:33
> An: java-user@lucene.apache.org
> Betreff: Re: Faceted Search: count direct matches/member für result nodes
>
>
> 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:serera@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
> <Da...@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:serera@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
> > <Da...@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:serera@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
> > > <Da...@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:nbuso@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-unsubscribe@lucene.apache.org
> > > > For additional commands, e-mail: java-user-help@lucene.apache.org
> > > >
> > > > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> > > > For additional commands, e-mail: java-user-help@lucene.apache.org
> > > >
> > > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> > > For additional commands, e-mail: java-user-help@lucene.apache.org
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> > For additional commands, e-mail: java-user-help@lucene.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>

Re: Faceted Search: count direct matches/member für result nodes

Posted by "Schimke, Danny" <Da...@incowia.com>.
Hi,

I finished 3 of my 4 requirements. 
* Indirect membership for list and hierarchical 
* direct membership for flat list 

I accomplished the flat list for direct memberships by indexing a second category using another category path prefix and "id" in this case does not contain any slash "/" e.g.:

CategoryPath catIndirect = new CategoryPath(FIELD_GROUP_ID_DIRECT + "/" + id, '/');

Now I can search usual on "FIELD_GROUP_ID_DIRECT" and get my flat results.
This way I have the communities ID to retrieve any information about this "community".

Anyway one point is still unanswered. I still have no solution for the hierarchical direct membership. So far we decided to build that tree manually by using IDs from the flat result of direct members because it contains all IDs upward to its root community. Maybe it is an option to hold the flat search result for direct members against the hierarchical search result for indirect members?

But if there is a lucene standard we prefer to use it.

-Danny



-----Ursprüngliche Nachricht-----
Von: Schimke, Danny [mailto:Danny.Schimke@incowia.com] 
Gesendet: Dienstag, 28. Mai 2013 12:33
An: java-user@lucene.apache.org
Betreff: Re: Faceted Search: count direct matches/member für result nodes


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:serera@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
<Da...@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:serera@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
> <Da...@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:serera@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
> > <Da...@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:nbuso@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-unsubscribe@lucene.apache.org
> > > For additional commands, e-mail: java-user-help@lucene.apache.org
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> > > For additional commands, e-mail: java-user-help@lucene.apache.org
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> > For additional commands, e-mail: java-user-help@lucene.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Re: Faceted Search: count direct matches/member für result nodes

Posted by "Schimke, Danny" <Da...@incowia.com>.
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:serera@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
<Da...@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:serera@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
> <Da...@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:serera@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
> > <Da...@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:nbuso@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-unsubscribe@lucene.apache.org
> > > For additional commands, e-mail: java-user-help@lucene.apache.org
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> > > For additional commands, e-mail: java-user-help@lucene.apache.org
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> > For additional commands, e-mail: java-user-help@lucene.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Re: Faceted Search: count direct matches/member für result nodes

Posted by Shai Erera <se...@gmail.com>.
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
<Da...@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:serera@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
> <Da...@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:serera@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
> > <Da...@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:nbuso@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-unsubscribe@lucene.apache.org
> > > For additional commands, e-mail: java-user-help@lucene.apache.org
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> > > For additional commands, e-mail: java-user-help@lucene.apache.org
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> > For additional commands, e-mail: java-user-help@lucene.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>

Re: Faceted Search: count direct matches/member für result nodes

Posted by "Schimke, Danny" <Da...@incowia.com>.
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:serera@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
<Da...@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:serera@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
> <Da...@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:nbuso@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-unsubscribe@lucene.apache.org
> > For additional commands, e-mail: java-user-help@lucene.apache.org
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> > For additional commands, e-mail: java-user-help@lucene.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Re: Faceted Search: count direct matches/member für result nodes

Posted by Shai Erera <se...@gmail.com>.
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
<Da...@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:serera@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
> <Da...@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:nbuso@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-unsubscribe@lucene.apache.org
> > For additional commands, e-mail: java-user-help@lucene.apache.org
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> > For additional commands, e-mail: java-user-help@lucene.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>

Re: Faceted Search: count direct matches/member für result nodes

Posted by "Schimke, Danny" <Da...@incowia.com>.
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:serera@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
<Da...@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:nbuso@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-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Re: Faceted Search: count direct matches/member für result nodes

Posted by Shai Erera <se...@gmail.com>.
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
<Da...@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:nbuso@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-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>

Re: Faceted Search: count direct matches/member für result nodes

Posted by "Schimke, Danny" <Da...@incowia.com>.
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:nbuso@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-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Re: Faceted Search: count direct matches/member für result nodes

Posted by "Schimke, Danny" <Da...@incowia.com>.
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:serera@gmail.com] 
Gesendet: Donnerstag, 25. April 2013 13:34
An: java-user@lucene.apache.org; nbuso@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-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Re: Faceted Search: count direct matches/member für result nodes

Posted by Shai Erera <se...@gmail.com>.
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-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>

Re: Faceted Search: count direct matches/memberfür result nodes

Posted by Nicola Buso <nb...@ebi.ac.uk>.
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-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org