PHP code example of itscript / sphinxsearch-query-log-parser

1. Go to this page and download the library: Download itscript/sphinxsearch-query-log-parser library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

itscript / sphinxsearch-query-log-parser example snippets


$log_line = '[Fri Jun 29 21:17:58 2007] 0.004 sec 0.004 sec [all/0/rel 35254 (0,20)] [lj] test';

$parser = new \ITS\SphinxSearchQueryLogParser\Parser();

/** @var \ITS\SphinxSearchQueryLogParser\Log $log */
$log = $parser->parse($log_line);

// it is equal to
$log = (new \ITS\SphinxSearchQueryLogParser\Log())
    ->setQueryDate(new \DateTimeImmutable('2007-06-29 21:17:58'))
    ->setRealTime(0.004)
    ->setWallTime(0.004)
    ->setMatchMode('all')
    ->setFiltersCount(0)
    ->setSortMode('rel')
    ->setTotalMatches(35254)
    ->setOffset(0)
    ->setLimit(20)
    ->setIndexName('lj')
    ->setQuery('test');