You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@jena.apache.org by "aiworkerjohns (via GitHub)" <gi...@apache.org> on 2026/02/23 07:47:32 UTC
[I] Facet counts via luc:facet property function [jena]
aiworkerjohns opened a new issue, #3770:
URL: https://github.com/apache/jena/issues/3770
## Status: Done
## Problem
There was no way to get facet counts (value distributions) from a text search in Jena. Applications needing "show me how many results per category" had to retrieve all results and count in application code, which is expensive and doesn't scale.
## Use Case
```mermaid
flowchart LR
Query["luc:facet<br/>'climate change'<br/>fields: category, publisher"]
Cat["category:<br/>Environment (42)<br/>Policy (28)<br/>Science (15)"]
Pub["publisher:<br/>CSIRO (31)<br/>BOM (22)<br/>DCCEEW (12)"]
Query --> Cat
Query --> Pub
```
- Sidebar facet panels in a search UI
- Summary statistics for a dataset collection
- "Browse by" navigation (by theme, by organisation, by type)
## Technical Work (completed)
- `TextFacetPF` — new property function registered under `urn:jena:lucene:index#facet`
- Returns `(field, value, count)` bindings — one row per facet value
- Uses Lucene `SortedSetDocValuesFacetCounts` for O(1) counting via pre-built DocValues
- Supports `maxValues` (cap values per field), `minCount` (exclude rare values)
- Supports filtered facets — same JSON filter format as `luc:query`
- `FacetValue` — immutable (value, count) pair
**SPARQL interface:**
```sparql
(?field ?value ?count) luc:facet (queryString facetFields filter? maxValues? minCount?)
```
## Effort
Completed. `TextFacetPF` is 354 lines. `FacetValue` is 73 lines.
## Decisions Made
- **Separate PF** from `luc:query` — hits and facets have different cardinalities. A combined PF would create N*M cartesian product rows.
- **SortedSetDocValues** — efficient counting without document iteration, but requires KEYWORD fields with `idx:facetable true`
- **`maxValues=0` means all** — consistent with "no limit" semantics
## Pitfalls / Gotchas
- Only KEYWORD fields with `idx:facetable true` can be faceted — TEXT and numeric fields are not supported
- Enabling faceting on a field adds ~25% indexing overhead (DocValues built at write time)
- High cardinality fields (e.g. URIs) can consume significant memory during facet collection — use `text:maxFacetHits` to cap
- Adding `idx:facetable true` to an existing field requires a full reindex
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@jena.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@jena.apache.org
For additional commands, e-mail: issues-help@jena.apache.org
Re: [I] Facet counts via luc:facet property function [jena]
Posted by "aiworkerjohns (via GitHub)" <gi...@apache.org>.
aiworkerjohns commented on issue #3770:
URL: https://github.com/apache/jena/issues/3770#issuecomment-3943190228
Created in error — intended for fork. Closing.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@jena.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@jena.apache.org
For additional commands, e-mail: issues-help@jena.apache.org
Re: [I] Facet counts via luc:facet property function [jena]
Posted by "aiworkerjohns (via GitHub)" <gi...@apache.org>.
aiworkerjohns closed issue #3770: Facet counts via luc:facet property function
URL: https://github.com/apache/jena/issues/3770
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@jena.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@jena.apache.org
For additional commands, e-mail: issues-help@jena.apache.org