lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From crocket <crockabisc...@gmail.com>
Subject Re: How do I retrieve a list of child categories for a category?
Date Mon, 01 Apr 2013 05:04:44 GMT
Well, I can understand the code easily, but it could have been very
difficult to find out without you since it is not explained in facet user
guide and I couldn't imagine TaxonomyReader was the key to this process.

It would have been a lot better if there had been a higher level API for
retrieving or traversing child categories.

What do you like to do regarding this?


On Sun, Mar 31, 2013 at 1:42 PM, Shai Erera <serera@gmail.com> wrote:

> Hi
>
> You can do so quite easily, using TaxonomyReader, following code such as:
>
> ParallelTaxonomyArrays arrays = taxoReader.getParallelTaxonomyArrays();
> int[] children = arrays.children();
> int[] siblings = arrays.siblings();
>
> int ordinal = taxoReader.getOrdinal(category); // ordinal of requested
> category
> int child = children[ordinal]; // child of requested category
> int sibling = siblings[child]; // siblings[] lets you traverse the children
> of a category
> while (sibling != TaxonomyReader.INVALID_ORDINAL) {
>   System.out.println(taxoReader.getPath(sibling));
>   sibling = siblings[sibling]; // get next sibling
> }
>
> Shai
>
>
> On Sun, Mar 31, 2013 at 12:24 AM, crocket <crockabiscuit@gmail.com> wrote:
>
> > I could use CountFacetRequest, but I don't need counting.
> >
> > I just want to get the list of child categories.
> >
> > How can I do it?
> >
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message