@@ -476,10 +476,10 @@ window.initSearch = function(rawSearchIndex) {
476
476
throw new Error ( `Unexpected \`${ c } \` (did you mean \`->\`?)` ) ;
477
477
}
478
478
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
+ }
483
483
if ( query . elems . length === 0 ) {
484
484
throw new Error ( "Expected type filter before `:`" ) ;
485
485
} else if ( query . elems . length !== 1 || parserState . totalElems !== 1 ) {
@@ -505,12 +505,7 @@ window.initSearch = function(rawSearchIndex) {
505
505
before = query . elems . length ;
506
506
getNextElem ( query , parserState , query . elems , false ) ;
507
507
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.
514
509
parserState . pos += 1 ;
515
510
}
516
511
foundStopChar = false ;
@@ -678,6 +673,7 @@ window.initSearch = function(rawSearchIndex) {
678
673
} catch ( err ) {
679
674
query = newParsedQuery ( userQuery ) ;
680
675
query . error = err . message ;
676
+ query . typeFilter = - 1 ;
681
677
return query ;
682
678
}
683
679
0 commit comments