Truncate search result text for performance reasons

This commit is contained in:
squidfunk 2017-03-16 16:26:52 +01:00 committed by Martin Donath
parent 675a75e000
commit d77d900479
3 changed files with 6 additions and 4 deletions

View File

@ -151,7 +151,7 @@
{% endblock %} {% endblock %}
</div> </div>
{% block scripts %} {% block scripts %}
<script src="{{ base_url }}/assets/javascripts/application-1380e43b15.js"></script> <script src="{{ base_url }}/assets/javascripts/application-c5d094b286.js"></script>
<script>app.initialize({url:{base:"{{ base_url }}"}})</script> <script>app.initialize({url:{base:"{{ base_url }}"}})</script>
{% for path in extra_javascript %} {% for path in extra_javascript %}
<script src="{{ path }}"></script> <script src="{{ path }}"></script>

View File

@ -205,14 +205,16 @@ export default class Result {
</h1> </h1>
{section.text.length ? {section.text.length ?
<p class="md-search-result__teaser"> <p class="md-search-result__teaser">
{{ __html: section.text.replace(match, highlight) }} {{ __html: this.truncate_(
section.text.replace(match, highlight), 400)
}}
</p> : {}} </p> : {}}
</article> </article>
</a> </a>
) )
})} })}
</li> </li>
) /* {this.truncate_(doc.text, 140)} */ )
}) })
/* Bind click handlers for anchors */ /* Bind click handlers for anchors */