From: Christian Weiske Date: Thu, 1 Sep 2016 05:47:49 +0000 (+0200) Subject: Always show text, make text extract size configurable. X-Git-Tag: v0.2.0~26 X-Git-Url: https://git.cweiske.de/phinde.git/commitdiff_plain/7aba8a17bae437bfba2cb6c6496f750d014f3636 Always show text, make text extract size configurable. Resolves: #8 --- diff --git a/data/config.php.dist b/data/config.php.dist index 20bf208..1e2641a 100644 --- a/data/config.php.dist +++ b/data/config.php.dist @@ -25,5 +25,8 @@ $GLOBALS['phinde'] = array( //prefix for the gearman queue names, needed when multiple instances //are running in parallel 'queuePrefix' => '', + //show the full text content in the results + // useful for chat logs in which every line is its own document + 'showFullContent' => false, ); ?> \ No newline at end of file diff --git a/src/phinde/Elasticsearch.php b/src/phinde/Elasticsearch.php index 4035861..c437036 100644 --- a/src/phinde/Elasticsearch.php +++ b/src/phinde/Elasticsearch.php @@ -136,6 +136,11 @@ class Elasticsearch $sortCfg = array(); } + $contentMatchSize = 100; + if ($GLOBALS['phinde']['showFullContent']) { + $contentMatchSize = 999999; + } + $r = new Elasticsearch_Request( $this->baseUrl . 'document/_search', \HTTP_Request2::METHOD_GET @@ -168,6 +173,8 @@ class Elasticsearch 'text' => array( 'require_field_match' => false, 'number_of_fragments' => 1, + 'fragment_size' => $contentMatchSize, + 'no_match_size' => $contentMatchSize, ), ) ),