apache / apache/lucene

Add FacetRequest.ResultMode.AUTO_EXPAND [LUCENE-4767]

Open
#5,832 0 comments 0 reactions 0 assignees View on GitHub
legacy-jira-priority:Major module:facet type:enhancement
Dominant language
Java
Stars
3.6k
Forks
1.4k
Avg merge
2d 11h
Merged PRs (30d)
88

Description

A ResultMode.AUTO_EXPAND will auto-expand a node in tree if only one result came up. For example, if you have a Date facet, and you ask to count the top-K of Date/, then if your documents were all created in say 2010, you'll get a redundant facet back: Date/2010 (no other children of Date/).

Rather, since we already have all the categories counted at hand, we can "auto-expand" Date/2010 recursively, until we get to a level in the tree which has more than one children. And of course, if all the results belong to a single leaf node, then we should return it ...

This can be implemented by adding a new ResultMode and a special FacetResultsHandler, which performs the auto-expansion. I think it should be limited to depth=1 only at the moment ...

---
Migrated from [LUCENE-4767](https://issues.apache.org/jira/browse/LUCENE-4767) by Shai Erera (@shaie)

Contributor guide

Open the contributing guide

Research direction

Start by locating FacetRequest.ResultMode and the FacetResultsHandler implementation. Trace how top-K facet results are produced, then determine how a depth=1 AUTO_EXPAND mode would recursively follow a sole child until a level has multiple children or reaches a leaf. Add focused coverage for the Date/2010-style single-child and multi-child cases, with completion shown by the expected expanded results.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
search
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.