nextcloud / fulltextsearch_elasticsearch

🔍 Use Elasticsearch to index the content of your Nextcloud
https://apps.nextcloud.com/apps/fulltextsearch_elasticsearch
GNU Affero General Public License v3.0
81 stars 30 forks source link

Allow setting size of highlighted excerpt/snippet in highlight parameter #118

Open TheRealThor opened 4 years ago

TheRealThor commented 4 years ago

The search results view currently show the default snippet/excerpts of 100 characters. The custom range can be beweteen 20-1000 characters.
By adding "fragment_size" to the highlight parameters (part of the 'content' subparameter ), which are generated by "private function generateSearchHighlighting" in lib/Service/SearchMappingService.php, an excerpt of custom length could be requested. This is helpful when the user has to search through many documents and needs orientation which documents are more relevant to open and inspect further.

https://www.elastic.co/guide/en/elasticsearch/reference/7.9/highlighting.html