manticoresoftware / manticoresoftware/manticoresearch-php
Add a method to get total facets count
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 211
- Forks
- 39
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 1
Description
The library doesn't have a method to get total count of facets.
Here is the code example, imagine an index `jobs` with columns `employer_id` and `employer_name`:
```
$client = new \Manticoresearch\Client();
$index = $client->index('jobs');
$query = new \Manticoresearch\Query\BoolQuery();
$query->must(new \Manticoresearch\Query\MatchQuery('amazon', 'employer_name'));
$search = $index->search($query);
$search->limit(0);
$search->offset($offset);
$search->facet('employer_id', null, $per_page);
$result = $search->get();
var_dump($result->getTotal()); // this returns total number of rows, not total number of facets
var_dump($result->getFacets()); // this returns facets
```
So, adding a method similar to this one could solve the issue:
```
$result->getTotalFacets()
```
Contributor guide
No contributing guide indexed for this repository
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 by tracing the result object methods getTotal() and getFacets() from the search example, then inspect how facet data is returned by the index search. Add the requested total-facets accessor alongside those methods and verify that it reports the total facet count separately from the total row count.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- api, search
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100