Skip to content
Grav 2.0 is officially stable. Read the announcement →

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

Plugins

How to write link to rezult page. tntsearch

Started by ghost666 7 years ago · 1 replies · 497 views
7 years ago

Hi, I make menu to search:

TWIG
    {% for item in item %}
    <a  href="{{ page.url(true, true) }}/search/query{{ config.system.param_sep }}{{ item|e }}">{{ item|e }}</a>
    {% endfor %}

this is for simplesearch.
How wrire link to tnt search to rezult page...?

👍 1
7 years ago

There's quite a few places in TNTIndexer and TNTSearch that looks for what is basically a static list of connectors and drivers. I'm getting around this right now by creating my own GravIndexer class that extends the TNTIndexer and overrides the run() method to load the Grav::pages object and iterate over the pages and store the $page->content()
Buy Fake ID

maybe this other approach will do also
private function doIndex()
{
include DIR.'/../vendor/autoload.php';
error_reporting(1);

PHP
    $data_path = Grav::instance()['locator']->findResource('user://data', true).'/tnt-search';

    if (!file_exists($data_path)) {
        mkdir($data_path);
    }

    $tnt = new TNTSearch;

    $tnt->loadConfig([
        'driver'  => 'sqlite',
        'storage' => $data_path
    ]);
    $tnt->setDatabaseHandle(new GravConnector);
    $indexer = $tnt->createIndex('grav.index');
    $indexer->run();

}
last edited 06/20/19 by Thomas Coello

Suggested topics

Topic Participants Replies Views Activity
Plugins · by Rene, 1 week ago
2 54 1 week ago
Plugins · by Xavier, 4 weeks ago
2 61 4 weeks ago
Plugins · by Luka Prinčič, 7 years ago
3 1188 1 month ago
Plugins · by Sebastian van de Meer, 1 month ago
1 54 1 month ago
Plugins · by PIERROT Alain, 2 months ago
3 79 2 months ago