mirror of
https://github.com/kvazar-network/crawler.git
synced 2025-09-02 10:01:59 +00:00
define index drivers config
This commit is contained in:
parent
5d6781a997
commit
47b1cad89a
@ -7,6 +7,8 @@
|
|||||||
"username":"",
|
"username":"",
|
||||||
"password":""
|
"password":""
|
||||||
},
|
},
|
||||||
|
"index":
|
||||||
|
{
|
||||||
"manticore":
|
"manticore":
|
||||||
{
|
{
|
||||||
"name":"kvazar",
|
"name":"kvazar",
|
||||||
@ -20,5 +22,7 @@
|
|||||||
"min_word_len":3,
|
"min_word_len":3,
|
||||||
"min_prefix_len":3
|
"min_prefix_len":3
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"driver":"manticore"
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -12,9 +12,6 @@ if (false === sem_acquire($semaphore, true))
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load dependencies
|
|
||||||
require_once __DIR__ . '/../vendor/autoload.php';
|
|
||||||
|
|
||||||
// Init config
|
// Init config
|
||||||
if (!file_exists(__DIR__ . '/../config.json'))
|
if (!file_exists(__DIR__ . '/../config.json'))
|
||||||
{
|
{
|
||||||
@ -29,14 +26,21 @@ $config = json_decode(
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Load dependencies
|
||||||
|
require_once __DIR__ . '/../vendor/autoload.php';
|
||||||
|
|
||||||
// Init index
|
// Init index
|
||||||
|
switch ($config->index->driver)
|
||||||
|
{
|
||||||
|
case 'manticore':
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
$index = new \Kvazar\Index\Manticore(
|
$index = new \Kvazar\Index\Manticore(
|
||||||
(string) $config->manticore->name,
|
(string) $config->index->manticore->name,
|
||||||
(array) $config->manticore->meta,
|
(array) $config->index->manticore->meta,
|
||||||
(string) $config->manticore->host,
|
(string) $config->index->manticore->host,
|
||||||
(int) $config->manticore->port
|
(int) $config->index->manticore->port
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -50,6 +54,15 @@ catch (Exception $exception)
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
|
||||||
|
exit(
|
||||||
|
_('Undefined index driver!')
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// Init kevacoin
|
// Init kevacoin
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user