-
Notifications
You must be signed in to change notification settings - Fork 187
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
enhancement: Keyword Query Language (KQL) search syntax support #7043
Conversation
We should discuss how to handle the implicit boolean operators and NOT together. It is not explicitly described in the documentation. The rules are different for the ocis/services/search/pkg/query/kql/factory.go Lines 156 to 176 in 46b8e43
Should we support and how do we represent? For example:
Is
Is |
With the increasing complexity of how we organize our resources, the search must also be able to find them using entity properties. The query package provides the necessary functionality to do this. This makes it possible to search for resources via KQL, the microsoft spec is largely covered and can be used for this. In the current state, the legacy query language is still used, in a future update this will be deprecated and KQL will become the standard
the ms spec defines when to use a implicit AND and when to use a implicit OR, but negotiations aren't mentioned. my 5 cents: since no description is available for those cases i would say, as soon as someone uses an operator as edge between two nodes:
we do not add any other implicit type there. cC.: @tbsbdr |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks fluffy 👍 Just one question and one typo.
I assume documentation is done as a follow up?
🤣 SURE, to be more exact, KQL is not enabled at the moment, but in the follow up we will enable it and provide a readme and with the help of @mmattel a even more fluffy docs page 💋 |
…e-text expressions
Kudos, SonarCloud Quality Gate passed! |
* feat(search): introduce search query package With the increasing complexity of how we organize our resources, the search must also be able to find them using entity properties. The query package provides the necessary functionality to do this. This makes it possible to search for resources via KQL, the microsoft spec is largely covered and can be used for this. In the current state, the legacy query language is still used, in a future update this will be deprecated and KQL will become the standard
Description
Introduce support for KQL syntax for search.
The functionality consists of a kql lexer and a bleve query compiler
Supported field queries:
Tag
searchtag:golden tag:"silver"
Filename
searchname:file.txt name:"file.docx"
Content
searchcontent:ahab content:"captain aha*"
Supported conjunctive normal form queries:
Boolean
operatorsAND
,OR
,NOT
,Nesting
(
...SUB_QUERY...
)
for example:
Query:
(name:"moby di*" OR tag:bestseller) AND tag:book NOT tag:read
Result:
name: moby di*
OR
tag: bestseller
.AND
withtag:book
.NOT
withtag:read
.AST:
Todos:
KQL-STRING-QUERY
toAST
kql syntax subset [KQL-TO-AST-LEXER
]ast.StringNode
)ast.StringNode
)ast.StringNode
)ast.StringNode
)ast.GroupNode
)AND
,OR
,NOT
(ast.OperatorNode
)AST
toBLEVE-STRING-QUERY
compiler [AST-TO-BLEVE-COMPILER
]ast.StringNode
)ast.StringNode
)ast.StringNode
)ast.StringNode
)ast.GroupNode
)AND
,OR
,NOT
(ast.OperatorNode
)Related Issue
How Has This Been Tested?
Types of changes
Checklist: