-
Notifications
You must be signed in to change notification settings - Fork 9
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
Redesign FT.SEARCH command line parsing in anticipation of merging with future FT.AGGREGATE code. #29
base: main
Are you sure you want to change the base?
Conversation
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 overall good to me. Thanks for driving this!
I left a couple of comments inline.
.vscode/settings.json
Outdated
@@ -5,7 +5,7 @@ | |||
"clangd.path": "/usr/bin/clangd", | |||
"C_Cpp.codeAnalysis.runAutomatically": true, | |||
"editor.formatOnSave": true, | |||
"C_Cpp.intelliSenseEngine": "disabled", | |||
"C_Cpp.intelliSenseEngine": "default", |
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.
would this enable intelliSenseEngine checks? what is the benefit of setting it to "default" and would it conflict with clang-tidy?
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.
oops. not sure what happened there. I didn't check that.
query::VectorSearchParameters ¶meters, absl::string_view source) { | ||
if (source.empty() || source[0] != '$') { | ||
return source; | ||
} else { |
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.
nit- here and in other places, no need to use else
when the if
section alway returns. It would avoid the need to indent
src/commands/ft_search_parser.cc
Outdated
itr.Next(); | ||
absl::string_view key = vmsdk::ToStringView(key_str); | ||
absl::string_view value = vmsdk::ToStringView(value_str); | ||
if (parameters.parse_vars.params.find(key) != |
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.
Better to call parameters.parse_vars.params.insert(key, std::make_pair(0, value))
and if the key already exists, the success would be false.
31e4fe6
to
14a28df
Compare
.vscode/settings.json
Outdated
@@ -19,4 +19,8 @@ | |||
"bazel.buildifierFixOnFormat": false, | |||
"clangd.inactiveRegions.useBackgroundHighlight": true, | |||
"clangd.enableCodeCompletion": true, | |||
"files.associations": { |
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.
Is this required?
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.
No, and I diffed my PR against main and it showed no changes in this file. :( :( :(
future FT.AGGREGATE code. Signed-off-by: Allen Samuels <[email protected]>
Signed-off-by: Allen Samuels <[email protected]>
Signed-off-by: Allen Samuels <[email protected]>
23ae1b0
to
597210c
Compare
Previously, the command line was parsed up to the query string. The parse of the query string had the side effect of identifying all $param substitution variables. This list was then used to generate a custom key/value parser which was then combined with the other processing clauses to finish parsing of the command line.
Now, the parsing of the query string is performed after the parsing of the entire command line. The major change here is that instead of creating a custom key/value parser that only recognized the $param substitution variables a generic hash-map of the substitution variables is generated in the first pass. During the subsequent parsing of the query string, the various places where a $param substitution is allowed is done by looking up the value in the generated hash map.
At the end of the parsing, (Verify), the hash map is walked to ensure that every $param was used at least once.
The new code will also reject an attempt to define the same $param twice. The old code would silently accept this and use the last value.