Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

Mark Leighton Fisher (4252)

Mark Leighton Fisher
  (email not shown publicly)
http://mark-fisher.home.mindspring.com/

I am a Systems Engineer at Regenstrief Institute [regenstrief.org]. I also own Fisher's Creek Consulting [comcast.net].
Friday July 16, 2010
11:09 AM

Stupid Lucene Tricks: Hierarchies

[ #40449 ]

You can search on hierarchies in Lucene if your hierarchy can be represented as a path enumeration (a Dewey-Decimal-like style of encoding a path, like "001.014.003" for the 3rd grandchild of the 14th child of the 1st branch).

For example, a search phrase like:

    hierarchy:001

would return only the direct children of the 1st branch, while:

    hierarchy:001*

would return all descendents of the 1st branch.

  1. To get only the children of a particular node, you specify only that node, like:

        hierarchy:001.014.003

  2. To get all of the descendents you specify everything that starts with that node:

        hierarchy:001.014.003*

  3. To get only the descendents after the children (grandchildren, etc.), you specify:

        hierarchy:001.014.003.*

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.