mirror of
https://github.com/YGGverse/Yo.git
synced 2025-01-27 23:14:16 +00:00
add index settings support
This commit is contained in:
parent
4aadb7f642
commit
192e45103d
@ -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":
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ $client = new \Manticoresearch\Client(
|
||||
|
||||
// Init index
|
||||
$index = $client->index(
|
||||
$config->manticore->index->document
|
||||
$config->manticore->index->document->name
|
||||
);
|
||||
|
||||
// Search
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -34,7 +34,7 @@ $client = new \Manticoresearch\Client(
|
||||
|
||||
// Init index
|
||||
$index = $client->index(
|
||||
$config->manticore->index->document
|
||||
$config->manticore->index->document->name
|
||||
);
|
||||
|
||||
// Get totals
|
||||
|
@ -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 . '"';
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user