-
Notifications
You must be signed in to change notification settings - Fork 616
Adding support for PostgreSQL's CustomOperator(String) #1299
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
Conversation
This code adds the following PGroonga operators to the BinaryOperator enum: PGroongaFullTextSearch for the &@ operator PGroongaEasyQuerySearch for the &@~ operator PGroongaSimilarSearch for the &@* operator PGroongaAdvancedSearch for the `&`` operator PGroongaArrayKeywordSearch for the &@| operator PGroongaArrayQuerySearch for the &@~| operator Additionally, the fmt::Display implementation has been updated to handle these new operators appropriately.
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.
I don't think this works. You didn't write any parsing code for these new operators.
And I think a better approach would be to have a CustomOperator(String)
, because anyone can define any operator, and it would be great if we were able to parse them independently of the particular case of pgroonga.
I think we need to work on this in the tokenizer.
The documentation for allowed characters in custom operators is here: https://www.postgresql.org/docs/current/sql-createoperator.html |
@lovasoa what would you of having something like this in the tokenizer.rs ?
|
No, you would have to integrate with the existing operator tokenization logic not to break it for other existing operators. It's a little bit technical, so if what you are interested in is just getting full text search to work for you, the easiest is probably for you to declare your own function that wraps pgroonga's custom operator, and can that function instead of the operator in your code to work around the current operator parsing bug. |
@alamb , currently, the tokenizer is dialect-independent. However, the same expression Do you think it would be okay to add partial support for custom operators, ignoring the ones that end in @ and are not followed by a whitespace? Or would you require full support for differentiated tokenization before merging support for custom operators? EDIT: Sorry, my bad. The tokenizer actually already has access to a dialect object. |
Fixes apache#1298 Fixes sqlpage/SQLPage#372 Closes apache#1299
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.
I think this PR can be closed in favor of #1302
This code adds the following PGroonga operators to the BinaryOperator enum:
PGroongaFullTextSearch for the &@ operator
PGroongaEasyQuerySearch for the &@~ operator
PGroongaSimilarSearch for the &@* operator
PGroongaAdvancedSearch for the `&`` operator
PGroongaArrayKeywordSearch for the &@| operator
PGroongaArrayQuerySearch for the &@~| operator
Additionally, the fmt::Display implementation has been updated to handle these new operators appropriately.