apache / apache/lucene

Make Faceting counting array overridable [LUCENE-5428]

Open
#6,491 3 comments 0 reactions 0 assignees View on GitHub
affects-version:4.6.1 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

In SortedSetDocValuesFacetCounts, the count array is allocated as an int[] size of number of total values across all facets and that is allocated per query.

In the case where number of values are large, large amount of garbage maybe created. Furthermore, the size of the array is dependent on the number of possible values, not number of number values needed for which facets fields are being accumulated for. E.g. if FacetSearchParam indicates counting only one 1 field with 2 values, we are still creating the array for all values across all fields.

This patch makes the count array abstract to allow for
1) caching
2) hash counting - which can choose to count only of needed fields.

This patch can be further enhanced to create FacetCouter per segment, per field by pass in the ordinal map.

---
Migrated from [LUCENE-5428](https://issues.apache.org/jira/browse/LUCENE-5428) by John Wang, updated Feb 01 2014
Attachments: [facetcounter.patch](https://apache.github.io/lucene-jira-archive/attachments/LUCENE-5428/facetcounter.patch)

Contributor guide

Open the contributing guide

Research direction

Start with SortedSetDocValuesFacetCounts and review the attached facetcounter.patch to understand the proposed abstraction for its count array. The change is complete when the counting storage can be replaced to support caching or hash counting, while preserving facet-counting behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
search
Issue type
Refactor
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.