@@ -476,10 +476,10 @@ window.initSearch = function(rawSearchIndex) {
476476 throw new Error ( `Unexpected \`${ c } \` (did you mean \`->\`?)` ) ;
477477 }
478478 throw new Error ( `Unexpected \`${ c } \`` ) ;
479- } else if ( c === ":" &&
480- parserState . typeFilter === null &&
481- ! isPathStart ( parserState ) )
482- {
479+ } else if ( c === ":" && ! isPathStart ( parserState ) ) {
480+ if ( parserState . typeFilter !== null ) {
481+ throw new Error ( "Unexpected `:`" ) ;
482+ }
483483 if ( query . elems . length === 0 ) {
484484 throw new Error ( "Expected type filter before `:`" ) ;
485485 } else if ( query . elems . length !== 1 || parserState . totalElems !== 1 ) {
@@ -505,12 +505,7 @@ window.initSearch = function(rawSearchIndex) {
505505 before = query . elems . length ;
506506 getNextElem ( query , parserState , query . elems , false ) ;
507507 if ( query . elems . length === before ) {
508- // Nothing was added, let's check it's not because of a solo ":"!
509- if ( parserState . pos >= parserState . length ||
510- parserState . userQuery [ parserState . pos ] !== ":" )
511- {
512- break ;
513- }
508+ // Nothing was added, weird... Let's increase the position to not remain stuck.
514509 parserState . pos += 1 ;
515510 }
516511 foundStopChar = false ;
@@ -678,6 +673,7 @@ window.initSearch = function(rawSearchIndex) {
678673 } catch ( err ) {
679674 query = newParsedQuery ( userQuery ) ;
680675 query . error = err . message ;
676+ query . typeFilter = - 1 ;
681677 return query ;
682678 }
683679
0 commit comments