meilisearch / meilisearch/meilisearch-php

Expose raw settings (from Data)

Open
#764 9 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
PHP
Stars
757
Forks
125
Avg merge
6d 8h
Merged PRs (30d)
2

Description

I'd like to see the raw settings as an array, and I can't see how to do it.

    public function getSettings(): array
    {
        return (new Settings($this->http->get(self::PATH.'/'.$this->uid.'/settings')))
            ->getIterator()->getArrayCopy();
    }

I think the easiest solution is to add a public getter to Data that gets the protected $data property.

class Data implements \ArrayAccess, \Countable, \IteratorAggregate
{
    protected $data = [];

    public function __construct(array $data = [])
    {
        $this->data = $data;
    }

    public function getData(): array
    {
        return $this->data;
    }

It could also be called getRawData()

Although it's great to have the Embedder class and everything else, sometimes I just want the raw data, especially to store with my internal database of indexes. Am I missing an easier way?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the Data class and inspecting how its protected data property is currently exposed through iteration or array access. Add the requested raw-data access only if it fits the existing API conventions, then verify the returned array against the issue's settings use case and the project's existing tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
api
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
40/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.