Skip to content

How to get total documents indexed? #164

Closed Answered by sanikolaev
d47081 asked this question in Q&A
Discussion options

You must be logged in to vote
<?php
require_once __DIR__ . '/vendor/autoload.php';

$config = ['host'=>'127.0.0.1','port'=>9308];
$client = new \Manticoresearch\Client($config);
$index = $client->index('t');
$index->drop(true);
$index->create(['a' => ['type' => 'int']]);
$docs = []; for ($n=0;$n<100000;$n++) $docs[] = ['id' => 0, 'a' => rand(0,1000)];
$index->addDocuments($docs);
$result = $index->search('')->option('cutoff', 0)->limit(0)->get()->getTotal();
echo $result."\n";
# php test_count.php
100000

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@d47081
Comment options

@sanikolaev
Comment options

Answer selected by d47081
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants