@@ -363,20 +363,22 @@ var Search = Control.extend({
363
363
if ( searchTerm . indexOf ( 'can-' ) > - 1 ) { // If the search term includes “can-”
364
364
365
365
// look for an exact match and apply a large positive boost
366
- q . term ( searchTerm , { usePipeline : true , boost : 375 } ) ;
366
+ q . term ( searchTerm , { boost : 375 } ) ;
367
367
368
368
} else {
369
369
// add “can-”, look for an exact match in the title field, and apply a positive boost
370
- q . term ( 'can-' + searchTerm , { usePipeline : false , boost : 12 } ) ;
370
+ q . term ( 'can-' + searchTerm , { boost : 12 } ) ;
371
371
372
372
// look for terms that match the beginning or end of this query
373
- q . term ( searchTerm , { usePipeline : false , wildcard : lunr . Query . wildcard . LEADING | lunr . Query . wildcard . TRAILING } ) ;
373
+ // look in the title field specifically to boost matches in it
374
+ q . term ( searchTerm , { fields : [ 'title' ] , wildcard : lunr . Query . wildcard . LEADING | lunr . Query . wildcard . TRAILING } ) ;
375
+ q . term ( searchTerm , { wildcard : lunr . Query . wildcard . LEADING | lunr . Query . wildcard . TRAILING } ) ;
374
376
}
375
377
376
378
// look for matches in any of the fields and apply a medium positive boost
377
379
var split = searchTerm . split ( lunr . tokenizer . separator ) ;
378
380
split . forEach ( function ( term ) {
379
- q . term ( term , { usePipeline : false , fields : q . allFields , boost : 10 } ) ;
381
+ q . term ( term , { boost : 10 , fields : q . allFields } ) ;
380
382
} ) ;
381
383
} ) ;
382
384
@@ -717,14 +719,14 @@ var Search = Control.extend({
717
719
718
720
resetScrollToTop : function ( activeResultPosTop ) {
719
721
this . $resultsContainer . scrollTop (
720
- this . $resultsContainer . scrollTop ( ) +
722
+ this . $resultsContainer . scrollTop ( ) +
721
723
activeResultPosTop
722
724
) ;
723
725
} ,
724
726
725
727
resetScrollToBottom : function ( activeResultPosTop , resultsContainerHeight ) {
726
728
// Calculate active result's position bottom
727
- var scrollTo = ( activeResultPosTop + this . $activeResult . outerHeight ( ) ) -
729
+ var scrollTo = ( activeResultPosTop + this . $activeResult . outerHeight ( ) ) -
728
730
// Calculate the current scrolled position of the bottom of the list
729
731
( this . getActiveResultOffset ( ) + resultsContainerHeight ) ;
730
732
0 commit comments