api/MarkLogic/MLPHP/Search.php
public function retrieveKeyValue($key, $value, $params = array())
    {
        // /v1/keyvalue is deprecated, use /v1/search with structured
        $this->key = (string)$key;
        $this->value = (string)$value;
        $query = '<query xmlns="http://marklogic.com/appservices/search">
                    <container-query>
                      <json-property name="' . $this->key . '" ns="" />
                      <term-query>
                        <text>' . $this->value . '</text>
                      </term-query>
                    </container-query>
                  </query>';

        try {
            $params = array_merge(
                array('structuredQuery' => $query),
                $this->getParams(), $params
            );
            $request = new RESTRequest('GET', 'search', $params);
            $response = $this->client->send($request);
            $results = new SearchResults($response->getBody());
            return $results;
        } catch(Exception $e) {
            echo $e->getMessage() . ' in ' . $e->getFile() .
            ' on line ' . $e->getLine() . PHP_EOL;
        }
    }
public function retrieveKeyValue($key, $value, $params = array())
    {
        // /v1/keyvalue is deprecated, use /v1/search with structured
        $this->key = (string)$key;
        $this->value = (string)$value;
        $query = '<query xmlns="http://marklogic.com/appservices/search">
                    <container-query>
                      <json-property name="' . $this->key . '" ns="" />
                      <term-query>
                        <text>' . $this->value . '</text>
                      </term-query>
                    </container-query>
                  </query>';

        try {
            $params = array_merge(
                array('structuredQuery' => $query),
                $this->getParams(), $params
            );
            $request = new RESTRequest('GET', 'search', $params);
            $response = $this->client->send($request);
            $results = new SearchResults($response->getBody());
            return $results;
        } catch(Exception $e) {
            echo $e->getMessage() . ' in ' . $e->getFile() .
            ' on line ' . $e->getLine() . PHP_EOL;
        }
    }
Retrieve the key-value search results for JSON content using the
REST client.

@param string $key The key (property name) in JSON content.
@param string $value The value (property value) in JSON content.
@return SearchResults A search results object.