0
0
bleve/search/query_syntax.nex
Marty Schoch f225d484b3 overhauled search
many bugs fixed in existing search
phrase query updated to support gaps in term sequence
new query types
all,none,match,phrase match
and new query syntax search, like google search:
+/-(optional field qualifier:)<term or quoted phrase>
2014-07-11 14:49:59 -04:00

34 lines
1.3 KiB
Plaintext

/\"((\\\")|(\\\\)|(\\\/)|(\\b)|(\\f)|(\\n)|(\\r)|(\\t)|(\\u[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F])|[^\"])*\"/ {
lval.s = yylex.Text()[1:len(yylex.Text())-1]
logDebugTokens("PHRASE - %s", lval.s);
return PHRASE
}
/\+/ { logDebugTokens("PLUS"); return PLUS }
/-/ { logDebugTokens("MINUS"); return MINUS }
/:/ { logDebugTokens("COLON"); return COLON }
/^/ { logDebugTokens("BOOST"); return BOOST }
/\(/ { logDebugTokens("LPAREN"); return LPAREN }
/\)/ { logDebugTokens("RPAREN"); return RPAREN }
/-?[0-9]|[1-9][0-9]*/
{
lval.n,_ = strconv.Atoi(yylex.Text());
logDebugTokens("INT - %d", lval.n);
return INT
}
/[ \t\n]+/ { logDebugTokens("WHITESPACE (count=%d)", len(yylex.Text())) /* eat up whitespace */ }
/[^\t\n\f\r :^\+\-]+/ {
lval.s = yylex.Text()
logDebugTokens("STRING - %s", lval.s);
return STRING
}
//
package search
import("log")
import("strconv")
func logDebugTokens(format string, v ...interface{}) {
if debugLexer {
log.Printf(format, v...)
}
}