Feature Request: Statistics about metadata fields in search API
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 1.1k
- Forks
- 564
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 29
Description
Overview of the Feature Request
We are interested in making statistics about metadata fields available through the search API.
Solr supports this via the stats and stats.field query parameters for indexed fields of numeric, string and date types: https://solr.apache.org/guide/6_6/the-stats-component.html
By default, Solr sends the following stats:
Example: If I pass the following query to Solr http://localhost:8983/solr/#/collection1/query?q=*:*&q.op=OR&indent=true&fq=publicationStatus:%22Published%22&fq=dvObjectType:%22datasets%22&stats=true&stats.field=resource.design.population.obtainedSampleSize I receive the following stats for the "obtained sample size" metadata field in addition to the query results:
"stats":{
"stats_fields":{
"resource.design.population.obtainedSampleSize":{
"min":-1.0,
"max":9.9999999E7,
"count":25593,
"missing":1540,
"sum":1.41567565E8,
"sumOfSquares":1.002115122884504E16,
"mean":5531.495526120423,
"stddev":625733.9594302336
}
}
}
This feature could be implemented relatively easily by allowing the search API user to pass a stats.field parameter into Solr, and passing the output back.
What kind of user is the feature intended for?
API users
What inspired the request?
In our custom UI, we have a range input for searches on numeric fields. For the input, we would like to know the min and max of the fields to use as the default min and max of the input.
Example: numeric field "obtained sample size"
What existing behavior do you want changed?
/
Any brand new behavior do you want to add to Dataverse?
Any open or closed issues related to this feature request?
Didn't find any
Are you thinking about creating a pull request for this feature?
Yes
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the search API and the linked Solr Stats Component documentation, focusing on how query parameters and Solr responses are currently handled. Done means API users can provide stats.field and receive the corresponding field statistics alongside search results, including the numeric-field min and max needed by the requested range input.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api, backend, search
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100