add index settings support

This commit is contained in:
ghost 2023-11-25 16:01:46 +02:00
parent 4aadb7f642
commit 192e45103d
8 changed files with 41 additions and 16 deletions

View File

@ -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":

View File

@ -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

View File

@ -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
);
}
}

View File

@ -20,7 +20,7 @@ $client = new \Manticoresearch\Client(
// Init index
$index = $client->index(
$config->manticore->index->document
$config->manticore->index->document->name
);
// Search

View File

@ -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

View File

@ -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

View File

@ -34,7 +34,7 @@ $client = new \Manticoresearch\Client(
// Init index
$index = $client->index(
$config->manticore->index->document
$config->manticore->index->document->name
);
// Get totals

View File

@ -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 . '"';
}