Compare commits
No commits in common. "main" and "v0.4.1.6" have entirely different histories.
25
README.md
25
README.md
|
|
@ -18,32 +18,9 @@ fulltext search with one that is completely relying on the proven elasticsearch
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
composer require sbp/flarum-search
|
composer require blomstra/search:*
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## Notes
|
|
||||||
|
|
||||||
This fork is now maintained as `sbp/flarum-search`.
|
|
||||||
|
|
||||||
Intentional compatibility leftovers:
|
|
||||||
- settings keys remain `blomstra-search.*`
|
|
||||||
- some translation keys remain `blomstra-search.*`
|
|
||||||
- CLI command names may still remain `blomstra:*` until a later migration
|
|
||||||
|
|
||||||
Search behavior:
|
|
||||||
- title autocomplete enabled
|
|
||||||
- fuzzy title search enabled
|
|
||||||
- exact + fuzzy content search on full search page
|
|
||||||
- no content autocomplete in dropdown (performance decision)
|
|
||||||
``
|
|
||||||
|
|
||||||
Repository can be found here: https://gitea.muehlberger.net/sbp-jm/sbp-flarum-search
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Enable the extension in the admin area and configure the Elasticsearch endpoint and index name in the extension settings.
|
Enable the extension in the admin area and configure the Elasticsearch endpoint and index name in the extension settings.
|
||||||
|
|
||||||
## Setting up the index
|
## Setting up the index
|
||||||
|
|
|
||||||
25
extend.php
25
extend.php
|
|
@ -1,24 +1,9 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This file is part of blomstra/search.
|
|
||||||
*
|
|
||||||
* Copyright (c) 2022 Blomstra Ltd.
|
|
||||||
*
|
|
||||||
* For the full copyright and license information, please view the LICENSE.md
|
|
||||||
* file that was distributed with this source code.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace Sbp\Search;
|
|
||||||
|
|
||||||
use Flarum\Extend as Flarum;
|
|
||||||
|
|
||||||
return [
|
return [
|
||||||
(new Flarum\ServiceProvider())->register(Provider::class),
|
(new Flarum\ServiceProvider())->register(Provider::class),
|
||||||
|
|
||||||
(new Flarum\Frontend('forum'))
|
(new Flarum\Frontend('forum'))
|
||||||
->js(__DIR__.'/js/dist/forum.js'),
|
->js(__DIR__.'/js/dist/forum.js'),
|
||||||
|
|
||||||
(new Flarum\Frontend('admin'))
|
(new Flarum\Frontend('admin'))
|
||||||
->js(__DIR__.'/js/dist/admin.js')
|
->js(__DIR__.'/js/dist/admin.js')
|
||||||
->css(__DIR__.'/resources/less/admin.less'),
|
->css(__DIR__.'/resources/less/admin.less'),
|
||||||
|
|
@ -28,6 +13,7 @@ return [
|
||||||
(new Flarum\Routes('api'))
|
(new Flarum\Routes('api'))
|
||||||
->get('/sbp/search/{type}', 'sbp.search', Api\Controllers\SearchController::class)
|
->get('/sbp/search/{type}', 'sbp.search', Api\Controllers\SearchController::class)
|
||||||
->put('/sbp/search/index', 'sbp.search.index', Api\Controllers\IndexController::class),
|
->put('/sbp/search/index', 'sbp.search.index', Api\Controllers\IndexController::class),
|
||||||
|
|
||||||
(new Flarum\Console())
|
(new Flarum\Console())
|
||||||
->command(Commands\BuildCommand::class),
|
->command(Commands\BuildCommand::class),
|
||||||
|
|
||||||
|
|
@ -37,5 +23,10 @@ return [
|
||||||
->default('blomstra-search.min-search-length', Commands\BuildCommand::DEFAULT_MIN_SEARCH_LENGTH)
|
->default('blomstra-search.min-search-length', Commands\BuildCommand::DEFAULT_MIN_SEARCH_LENGTH)
|
||||||
->default('blomstra-search.stem-exclusion', '')
|
->default('blomstra-search.stem-exclusion', '')
|
||||||
->serializeToForum('blomstraSearchMinLength', 'blomstra-search.min-search-length', 'intval')
|
->serializeToForum('blomstraSearchMinLength', 'blomstra-search.min-search-length', 'intval')
|
||||||
->serializeToForum('blomstraSearchPostBodies', 'blomstra-search.search-post-bodies', fn ($v) => (bool) $v, true),
|
->serializeToForum(
|
||||||
|
'blomstraSearchPostBodies',
|
||||||
|
'blomstra-search.search-post-bodies',
|
||||||
|
fn ($v) => (bool) $v,
|
||||||
|
true
|
||||||
|
),
|
||||||
];
|
];
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -1 +0,0 @@
|
||||||
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -22,7 +22,7 @@ export default function extendDiscussionState() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Construct API search URI
|
// Construct API search URI
|
||||||
const url = `${app.forum.attribute('apiUrl')}/sbp/search/${this.type}`;
|
const url = `${app.forum.attribute('apiUrl')}/blomstra/search/${this.type}`;
|
||||||
|
|
||||||
// Make API GET request
|
// Make API GET request
|
||||||
const results = await app.request({ params, url, method: 'GET' });
|
const results = await app.request({ params, url, method: 'GET' });
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ export default class DiscussionsSearchSource implements SearchSource {
|
||||||
};
|
};
|
||||||
|
|
||||||
// Construct API search URI
|
// Construct API search URI
|
||||||
const url = `${app.forum.attribute('apiUrl')}/sbp/search/${this.type}`;
|
const url = `${app.forum.attribute('apiUrl')}/blomstra/search/${this.type}`;
|
||||||
|
|
||||||
// Make API GET request
|
// Make API GET request
|
||||||
const results = await app.request({ params, url, method: 'GET' });
|
const results = await app.request({ params, url, method: 'GET' });
|
||||||
|
|
|
||||||
|
|
@ -176,7 +176,7 @@ class SearchController extends ListDiscussionsController
|
||||||
});
|
});
|
||||||
|
|
||||||
$document->addPaginationLinks(
|
$document->addPaginationLinks(
|
||||||
$this->uri->to('api')->route('sbp.search', ['type' => 'discussions']),
|
$this->uri->to('api')->route('blomstra.search', ['type' => 'discussions']),
|
||||||
$request->getQueryParams(),
|
$request->getQueryParams(),
|
||||||
$offset,
|
$offset,
|
||||||
$limit,
|
$limit,
|
||||||
|
|
@ -265,7 +265,7 @@ class SearchController extends ListDiscussionsController
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$document->addPaginationLinks(
|
$document->addPaginationLinks(
|
||||||
$this->uri->to('api')->route('sbp.search', ['type' => 'discussions']),
|
$this->uri->to('api')->route('blomstra.search', ['type' => 'discussions']),
|
||||||
$request->getQueryParams(),
|
$request->getQueryParams(),
|
||||||
$offset,
|
$offset,
|
||||||
$limit,
|
$limit,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue