Fix search parser
Allow + or - in the search string as long as it is not preceeded by a space. If it is preceeded by a space, it starts a new search constraint.
This commit is contained in:
parent
a16f2dfe02
commit
3bd07ebf6a
|
@ -41,7 +41,7 @@ local fields
|
||||||
local grammar = P{
|
local grammar = P{
|
||||||
"chunk";
|
"chunk";
|
||||||
whitespace = S" \t\n"^0,
|
whitespace = S" \t\n"^0,
|
||||||
itm = C(P(1-S"+-")^0), --go until the next '+' or '-'
|
itm = C((P(1 - (P" " * S"+-")))^0), --go until the next '+' or '-'
|
||||||
likefield = C(P"title" + P"author") * V"whitespace" * C(P"=") * V"whitespace" * V"itm",
|
likefield = C(P"title" + P"author") * V"whitespace" * C(P"=") * V"whitespace" * V"itm",
|
||||||
rangeop = P"<=" + P">=" + P">" + P"<" + P"=",
|
rangeop = P"<=" + P">=" + P">" + P"<" + P"=",
|
||||||
rangefield = C(P"date" + P"hits") * V"whitespace" * C(V"rangeop") * V"whitespace" * C(V"itm"),
|
rangefield = C(P"date" + P"hits") * V"whitespace" * C(V"rangeop") * V"whitespace" * C(V"itm"),
|
||||||
|
@ -54,7 +54,7 @@ local grammar = P{
|
||||||
table.insert(fields.tags,{pn,"=",field})
|
table.insert(fields.tags,{pn,"=",field})
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
chunk = V"field"^0
|
chunk = V"field" * (P" " * V"field")^0
|
||||||
|
|
||||||
}
|
}
|
||||||
--Grammar
|
--Grammar
|
||||||
|
|
Loading…
Reference in New Issue