FIX: stop highlighting single l which is used for sorting
This commit is contained in:
parent
845170bd6b
commit
45c3ad5f91
|
@ -46,6 +46,14 @@ export default Ember.Controller.extend({
|
||||||
return Em.isEmpty(q);
|
return Em.isEmpty(q);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
@computed('q')
|
||||||
|
highlightQuery(q) {
|
||||||
|
if (!q) { return; }
|
||||||
|
// remove l which can be used for sorting
|
||||||
|
return _.reject(q.split(/\s+/), t => t === 'l').join(' ');
|
||||||
|
},
|
||||||
|
|
||||||
@computed('skip_context', 'context')
|
@computed('skip_context', 'context')
|
||||||
searchContextEnabled: {
|
searchContextEnabled: {
|
||||||
get(skip,context){
|
get(skip,context){
|
||||||
|
|
|
@ -107,7 +107,7 @@
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
{{#if result.blurb}}
|
{{#if result.blurb}}
|
||||||
{{#highlight-text highlight=q}}
|
{{#highlight-text highlight=highlightQuery}}
|
||||||
{{{unbound result.blurb}}}
|
{{{unbound result.blurb}}}
|
||||||
{{/highlight-text}}
|
{{/highlight-text}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
|
@ -13,7 +13,9 @@ class Highlighted extends RawHtml {
|
||||||
|
|
||||||
decorate($html) {
|
decorate($html) {
|
||||||
if (this.term) {
|
if (this.term) {
|
||||||
$html.highlight(this.term.split(/\s+/), { className: 'search-highlight' });
|
// special case ignore "l" which is used for magic sorting
|
||||||
|
const words = _.reject(this.term.split(/\s+/), t => t === 'l');
|
||||||
|
$html.highlight(words, { className: 'search-highlight' });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue