diff --git a/example/config.json b/example/config.json index fa821c2..c1e8432 100644 --- a/example/config.json +++ b/example/config.json @@ -8,7 +8,22 @@ }, "index": { - "document":"yo_document" + "document":{ + "name":"yo_document", + "settings": + { + "morphology": + [ + "stem_cz", + "stem_ar", + "stem_enru" + ], + "index_exact_words":1, + "html_strip":1, + "min_word_len":3, + "min_prefix_len":3 + } + } } }, "webui": diff --git a/src/cli/document/add.php b/src/cli/document/add.php index 04368fc..7b6a158 100644 --- a/src/cli/document/add.php +++ b/src/cli/document/add.php @@ -20,7 +20,7 @@ $client = new \Manticoresearch\Client( // Init index $index = $client->index( - $config->manticore->index->document + $config->manticore->index->document->name ); // Check URL for exist @@ -33,7 +33,7 @@ if ($result->getTotal()) echo sprintf( 'URL "%s" already exists in "%s" index!' . PHP_EOL, $argv[1], - $config->manticore->index->document + $config->manticore->index->document->name ); exit; @@ -49,7 +49,7 @@ $result = $index->addDocument( echo sprintf( 'URL "%s" added to "%s" index: %s' . PHP_EOL, $argv[1], - $config->manticore->index->document, + $config->manticore->index->document->name, print_r( $result, true diff --git a/src/cli/document/crawl.php b/src/cli/document/crawl.php index ac1c577..39d3198 100644 --- a/src/cli/document/crawl.php +++ b/src/cli/document/crawl.php @@ -32,7 +32,7 @@ $search = new \Manticoresearch\Search( ); $search->setIndex( - $config->manticore->index->document + $config->manticore->index->document->name ); $search->match( @@ -51,7 +51,7 @@ $search->limit( // Init index $index = $client->index( - $config->manticore->index->document + $config->manticore->index->document->name ); // Begin queue @@ -182,7 +182,7 @@ foreach($search->get() as $document) echo sprintf( 'index "%s" updated: %s %s' . PHP_EOL, - $config->manticore->index->document, + $config->manticore->index->document->name, print_r( $result, true @@ -268,7 +268,7 @@ foreach($search->get() as $document) echo sprintf( 'add "%s" to "%s"' . PHP_EOL, $url, - $config->manticore->index->document + $config->manticore->index->document->name ); } } diff --git a/src/cli/document/search.php b/src/cli/document/search.php index aec4381..0515b63 100644 --- a/src/cli/document/search.php +++ b/src/cli/document/search.php @@ -20,7 +20,7 @@ $client = new \Manticoresearch\Client( // Init index $index = $client->index( - $config->manticore->index->document + $config->manticore->index->document->name ); // Search diff --git a/src/cli/index/init.php b/src/cli/index/init.php index 9eb2016..0ac696e 100644 --- a/src/cli/index/init.php +++ b/src/cli/index/init.php @@ -20,7 +20,7 @@ $client = new \Manticoresearch\Client( // Init index $index = $client->index( - $config->manticore->index->document + $config->manticore->index->document->name ); // Request options @@ -34,7 +34,7 @@ if (isset($argv[1])) echo sprintf( 'index "%s" deleted: %s' . PHP_EOL, - $config->manticore->index->document, + $config->manticore->index->document->name, print_r( $result, true @@ -80,12 +80,22 @@ $result = $index->create( [ 'type' => 'integer' ] + ], + [ + 'index_exact_words' => $config->manticore->index->document->settings->index_exact_words, + 'html_strip' => $config->manticore->index->document->settings->html_strip, + 'min_word_len' => $config->manticore->index->document->settings->min_word_len, + 'min_prefix_len' => $config->manticore->index->document->settings->min_prefix_len, + 'morphology' => implode( + ',', + $config->manticore->index->document->settings->morphology + ) ] ); echo sprintf( 'index "%s" created: %s' . PHP_EOL, - $config->manticore->index->document, + $config->manticore->index->document->name, print_r( $result, true diff --git a/src/cli/yggo/import.php b/src/cli/yggo/import.php index 0818657..10d2e3c 100644 --- a/src/cli/yggo/import.php +++ b/src/cli/yggo/import.php @@ -20,7 +20,7 @@ $client = new \Manticoresearch\Client( // Init index $index = $client->index( - $config->manticore->index->document + $config->manticore->index->document->name ); // Connect Yggo DB diff --git a/src/webui/index.php b/src/webui/index.php index ff3c89a..9ecc7af 100644 --- a/src/webui/index.php +++ b/src/webui/index.php @@ -34,7 +34,7 @@ $client = new \Manticoresearch\Client( // Init index $index = $client->index( - $config->manticore->index->document + $config->manticore->index->document->name ); // Get totals diff --git a/src/webui/search.php b/src/webui/search.php index 939522f..6049227 100644 --- a/src/webui/search.php +++ b/src/webui/search.php @@ -32,7 +32,7 @@ $client = new \Manticoresearch\Client( // Init index $index = $client->index( - $config->manticore->index->document + $config->manticore->index->document->name ); // Get totals @@ -120,7 +120,7 @@ if (filter_var($q, FILTER_VALIDATE_URL)) $query = '@url "' . $q . '"'; } -if (false === strpos($q, '"')) +elseif (false === strpos($q, '"')) { $query = '"' . $q . '"'; }