mirror of
https://github.com/owncloud/ocis
synced 2026-04-25 17:25:21 +02:00
* enhancement: add more kql spec tests and simplify ast normalization * enhancement: kql parser error if query starts with AND * enhancement: add kql docs and support for date and time only dateTimeRestriction queries * enhancement: add the ability to decide how kql nodes get connected connecting nodes (with edges) seem straight forward when not using group, the default connection for nodes with the same node is always OR. THis only applies for first level nodes, for grouped nodes it is defined differently. The KQL docs are saying, nodes inside a grouped node, with the same key are connected by a AND edge. * enhancement: explicit error handling for falsy group nodes and queries with leading binary operator * enhancement: use optimized grammar for kql parser and toolify pigeon * enhancement: simplify error handling * fix: kql implicit 'AND' and 'OR' follows the ms html spec instead of the pdf spec
31 lines
716 B
Go
31 lines
716 B
Go
package kql
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/owncloud/ocis/v2/services/search/pkg/query/ast"
|
|
)
|
|
|
|
// StartsWithBinaryOperatorError records an error and the operation that caused it.
|
|
type StartsWithBinaryOperatorError struct {
|
|
Node *ast.OperatorNode
|
|
}
|
|
|
|
func (e StartsWithBinaryOperatorError) Error() string {
|
|
return "the expression can't begin from a binary operator: '" + e.Node.Value + "'"
|
|
}
|
|
|
|
// NamedGroupInvalidNodesError records an error and the operation that caused it.
|
|
type NamedGroupInvalidNodesError struct {
|
|
Node ast.Node
|
|
}
|
|
|
|
func (e NamedGroupInvalidNodesError) Error() string {
|
|
return fmt.Errorf(
|
|
"'%T' - '%v' - '%v' is not valid",
|
|
e.Node,
|
|
ast.NodeKey(e.Node),
|
|
ast.NodeValue(e.Node),
|
|
).Error()
|
|
}
|