Skip to content

Make max_analyzed_offset configurable and apply it on search #20

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions action/search.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ public function handle_action(Doku_Event $event, $param) {
[
"pre_tags" => ['ELASTICSEARCH_MARKER_IN'],
"post_tags" => ['ELASTICSEARCH_MARKER_OUT'],
"max_analyzed_offset" => $this->getConf('maxAnalyzedOffset'),
"fields" => [
$this->getConf('snippets') => new \stdClass(),
'title' => new \stdClass()]
Expand Down
1 change: 1 addition & 0 deletions conf/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@
$conf['perpage'] = 20;
$conf['detectTranslation'] = 0;
$conf['disableQuicksearch'] = 0;
$conf['maxAnalyzedOffset'] = 1000000;
1 change: 1 addition & 0 deletions conf/metadata.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@
$meta['perpage'] = array('numeric', '_min' => 1);
$meta['detectTranslation'] = array('onoff');
$meta['disableQuicksearch'] = array('onoff');
$meta['maxAnalyzedOffset'] = array('numeric', '_min' => 0, '_caution' => 'warning');
4 changes: 4 additions & 0 deletions helper/client.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,10 @@ public function createIndex($clear = false) {
throw new \splitbrain\phpcli\Exception("Failed to create index!");
}

if ($index->setSettings(['index.highlight.max_analyzed_offset' => $this->getConf('maxAnalyzedOffset')])->hasError()) {
throw new \splitbrain\phpcli\Exception("Could not set highlighting config on index!");
}

if ($this->createMappings($index)->hasError()) {
throw new \splitbrain\phpcli\Exception("Failed to create field mappings!");
}
Expand Down
1 change: 1 addition & 0 deletions lang/de/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@
$lang['perpage'] = 'Anzahl der Treffer pro Seite';
$lang['detectTranslation'] = 'Translation Plugin Integration: Zunächst im aktuellen Übersetzungnamensraum suchen';
$lang['disableQuicksearch'] = 'Schnellsuche deaktivieren (Vorschläge von passenden Seiten IDs)';
$lang['maxAnalyzedOffset'] = 'Maximale Datenmenge pro Seite/Datei zur Hervorhebung von Suchtreffern. Nach Änderung dieses Wertes muss der Suchindex neu aufgebaut werden.';
1 change: 1 addition & 0 deletions lang/en/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@
$lang['perpage'] = 'How many hits to show per page';
$lang['detectTranslation'] = 'Translation plugin support: search in current language namespace by default';
$lang['disableQuicksearch'] = 'Disable quick search (page id suggestions)';
$lang['maxAnalyzedOffset'] = 'Maximum amount of data per page/media file considered for search result highlighting. You have to recreate your index if you change this value.';