0
0
bleve/query_string.nex
Marty Schoch 3a0263bb72 finished initial impl of fuzzy search
you can do a manual fuzzy term search using the FuzzyQuery struct
or, more suitable for most users the MatchQuery now supports
some fuzzy options.  Here you can specify fuzziness and
prefix_length, to turn the underlying term search into a fuzzy
term search.  This has the benefit that analysis is performed
on your input, just like the analyzed field, prior to computing
the fuzzy variants.

closes #82
2014-10-24 13:39:48 -04:00

43 lines
1.8 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 tPHRASE
}
/\+/ { logDebugTokens("PLUS"); return tPLUS }
/-/ { logDebugTokens("MINUS"); return tMINUS }
/:/ { logDebugTokens("COLON"); return tCOLON }
/^/ { logDebugTokens("BOOST"); return tBOOST }
/\(/ { logDebugTokens("LPAREN"); return tLPAREN }
/\)/ { logDebugTokens("RPAREN"); return tRPAREN }
/>/ { logDebugTokens("GREATER"); return tGREATER }
/</ { logDebugTokens("LESS"); return tLESS }
/=/ { logDebugTokens("EQUAL"); return tEQUAL }
/~([0-9]|[1-9][0-9]*)/
{
lval.s = yylex.Text()[1:]
logDebugTokens("TILDENUMBER - %s", lval.s);
return tTILDENUMBER
}
/~/ { logDebugTokens("TILDE"); return tTILDE }
/-?([0-9]|[1-9][0-9]*)(\.[0-9][0-9]*)?/
{
lval.s = yylex.Text()
logDebugTokens("NUMBER - %s", lval.s);
return tNUMBER
}
/[ \t\n]+/ { logDebugTokens("WHITESPACE (count=%d)", len(yylex.Text())) /* eat up whitespace */ }
/[^\t\n\f\r :^\+\-><=~][^\t\n\f\r :^~]*/ {
lval.s = yylex.Text()
logDebugTokens("STRING - %s", lval.s);
return tSTRING
}
//
package bleve
import("log")
func logDebugTokens(format string, v ...interface{}) {
if debugLexer {
log.Printf(format, v...)
}
}