<commit_before><?php

require 'vendor/autoload.php';

use Sajari\Engine\EngineClient;
use Sajari\Engine\Exception\EngineException;

$logger = new Monolog\Logger('log');
$logger->pushHandler(new Monolog\Handler\StreamHandler('php://stdout'));

$c = new EngineClient(new Guzzle\Http\Client(), array(
    'access_key' => getenv('SAJARI_ACCESS_KEY'),
    'secret_key' => getenv('SAJARI_SECRET_KEY'),
    'company' => getenv('SAJARI_COMPANY'),
    'collection' => getenv('SAJARI_COLLECTION'),
), $logger);

try {
    $results = $c->multiSearch(array(
        'requests' => array(
            array(
                'collection' => getenv('SAJARI_COLLECTION'),
                'q' => 'hey',
                'meta' => array(
                    'key1' => 'value1',
                    'key2' => 'value2',
                    'created' => 1442293946,
                ),
                'filters' => array(
                    array(
                        'op' => '=',
                        'key' => 'category',
                        'val' => 'whatever',
                    ),
                ),
            ),
        ),
        'all' => array(
            'company' => getenv('SAJARI_COMPANY'),
        ),
        'merge' => 'linear',
        'timeout' => 2000,
    ));
    echo var_export($results, true), PHP_EOL;
} catch (EngineException $e) {
    echo 'There was an error running the search. ', $e->getMessage(), PHP_EOL;
}<commit_msg>multiSearch: add example with array meta field<commit_after><?php

require 'vendor/autoload.php';

use Sajari\Engine\EngineClient;
use Sajari\Engine\Exception\EngineException;

$logger = new Monolog\Logger('log');
$logger->pushHandler(new Monolog\Handler\StreamHandler('php://stdout'));

$c = new EngineClient(new Guzzle\Http\Client(), array(
    'access_key' => getenv('SAJARI_ACCESS_KEY'),
    'secret_key' => getenv('SAJARI_SECRET_KEY'),
    'company' => getenv('SAJARI_COMPANY'),
    'collection' => getenv('SAJARI_COLLECTION'),
), $logger);

try {
    $results = $c->multiSearch(array(
        'requests' => array(
            array(
                'collection' => getenv('SAJARI_COLLECTION'),
                'q' => 'hey',
                'meta' => array(
                    'key1' => 'value1',
                    'key2' => 'value2',
                    'created' => 1442293946,
                    'arrayField' => array(
                        'boo',
                        'yah',
                    ),
                ),
                'filters' => array(
                    array(
                        'op' => '=',
                        'key' => 'category',
                        'val' => 'whatever',
                    ),
                ),
            ),
        ),
        'all' => array(
            'company' => getenv('SAJARI_COMPANY'),
        ),
        'merge' => 'linear',
        'timeout' => 2000,
    ));
    echo var_export($results, true), PHP_EOL;
} catch (EngineException $e) {
    echo 'There was an error running the search. ', $e->getMessage(), PHP_EOL;
}
{'fraction_non_alphanumeric': 0.15992102665350444, 'fraction_numerical': 0.011846001974333662, 'mean_word_length': 1.6690079016681298, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 48, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '635532', 'n_tokens_mistral': 953, 'n_tokens_neox': 901, 'n_words': 164}