init config

This commit is contained in:
ghost 2024-02-12 16:30:26 +02:00
parent f9288e10b0
commit b49f81b66d
3 changed files with 37 additions and 1 deletions

3
.gitignore vendored
View File

@ -1,3 +1,4 @@
/vendor/ /vendor/
composer.lock /composer.lock
/config.json

16
example/config.json Normal file
View File

@ -0,0 +1,16 @@
{
"index":
{
"name":"kvazar",
"host":"127.0.0.1",
"port":9308,
"meta":
{
"morphology":"stem_cz,stem_enru",
"index_exact_words":1,
"html_strip":1,
"min_word_len":3,
"min_prefix_len":3
}
}
}

19
src/index.php Normal file
View File

@ -0,0 +1,19 @@
<?php
// Load dependencies
require_once __DIR__ . '/../vendor/autoload.php';
// Init config
$config = json_decode(
file_get_contents(
__DIR__ . '/../config.json'
)
);
// Init index
$index = new \Kvazar\Index\Manticore(
(string) $config->index->name,
(array) $config->index->meta,
(string) $config->index->host,
(int) $config->index->port
);