You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by GitBox <gi...@apache.org> on 2021/09/14 09:17:06 UTC

[GitHub] [skywalking] kezhenxu94 opened a new pull request #7710: Fix that `Query` cannot be updated after it's set in `SearchBuilder`

kezhenxu94 opened a new pull request #7710:
URL: https://github.com/apache/skywalking/pull/7710


   ### Fix that `Query` cannot be updated after it's set in `SearchBuilder`
   - [x] Add a unit test to verify that the fix works.
   - [x] Explain briefly why the bug exists and how to fix it.
   When `QueryBuilder` is set in `SearchBuilder`, the following updates to `QueryBuilder` (like `queryBuilder.must(Query.term(GROUP, "abc")` takes no effect, because when `SearchBuilder` accepts an `QueryBuilder`, it builds a `Query` from the builder and not keep the builder itself.
   This patch also fixes a serialization error of `MatchQuery`.
   - [x] If this pull request closes/resolves/fixes an existing issue, replace the issue number. Closes #<issue number>. NO
   - [x] Update the [`CHANGES` log](https://github.com/apache/skywalking/blob/master/CHANGES.md). NO NEED, not released yet.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [skywalking] wu-sheng merged pull request #7710: Fix that `Query` cannot be updated after it's set in `SearchBuilder`

Posted by GitBox <gi...@apache.org>.
wu-sheng merged pull request #7710:
URL: https://github.com/apache/skywalking/pull/7710


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [skywalking] kezhenxu94 commented on a change in pull request #7710: Fix that `Query` cannot be updated after it's set in `SearchBuilder`

Posted by GitBox <gi...@apache.org>.
kezhenxu94 commented on a change in pull request #7710:
URL: https://github.com/apache/skywalking/pull/7710#discussion_r708089826



##########
File path: oap-server/server-library/library-elasticsearch-client/src/main/java/org/apache/skywalking/library/elasticsearch/requests/search/MatchQuery.java
##########
@@ -38,10 +38,14 @@
         public void serialize(final MatchQuery value, final JsonGenerator gen,
                               final SerializerProvider provider)
             throws IOException {
-            gen.writeFieldName("match");
             gen.writeStartObject();
             {
-                gen.writeStringField(value.getName(), value.getText());
+                gen.writeFieldName("match");
+                gen.writeStartObject();
+                {

Review comment:
       > Just a code style?
   
   Yes, this is a kind of code style to make it easier to distinguish the written object structures, and help to write the correct `writeStartXxxx` / `writeEndXxx`, otherwise I have to count the number of `writeStartObject` / `writeEndObject` very carefully




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [skywalking] kezhenxu94 commented on a change in pull request #7710: Fix that `Query` cannot be updated after it's set in `SearchBuilder`

Posted by GitBox <gi...@apache.org>.
kezhenxu94 commented on a change in pull request #7710:
URL: https://github.com/apache/skywalking/pull/7710#discussion_r708089826



##########
File path: oap-server/server-library/library-elasticsearch-client/src/main/java/org/apache/skywalking/library/elasticsearch/requests/search/MatchQuery.java
##########
@@ -38,10 +38,14 @@
         public void serialize(final MatchQuery value, final JsonGenerator gen,
                               final SerializerProvider provider)
             throws IOException {
-            gen.writeFieldName("match");
             gen.writeStartObject();
             {
-                gen.writeStringField(value.getName(), value.getText());
+                gen.writeFieldName("match");
+                gen.writeStartObject();
+                {

Review comment:
       > Just a code style?
   
   Yes, this is a kind of code style to make it easier to distinguish the written object structures, and help to write the correct `writeStartXxxx` / `writeEndXxx`, otherwise I have to count the number of `writeStartObject` / `writeEndObject`




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [skywalking] wu-sheng commented on a change in pull request #7710: Fix that `Query` cannot be updated after it's set in `SearchBuilder`

Posted by GitBox <gi...@apache.org>.
wu-sheng commented on a change in pull request #7710:
URL: https://github.com/apache/skywalking/pull/7710#discussion_r708082277



##########
File path: oap-server/server-library/library-elasticsearch-client/src/main/java/org/apache/skywalking/library/elasticsearch/requests/search/MatchQuery.java
##########
@@ -38,10 +38,14 @@
         public void serialize(final MatchQuery value, final JsonGenerator gen,
                               final SerializerProvider provider)
             throws IOException {
-            gen.writeFieldName("match");
             gen.writeStartObject();
             {
-                gen.writeStringField(value.getName(), value.getText());
+                gen.writeFieldName("match");
+                gen.writeStartObject();
+                {

Review comment:
       What are these brackets for?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [skywalking] wu-sheng commented on a change in pull request #7710: Fix that `Query` cannot be updated after it's set in `SearchBuilder`

Posted by GitBox <gi...@apache.org>.
wu-sheng commented on a change in pull request #7710:
URL: https://github.com/apache/skywalking/pull/7710#discussion_r708084289



##########
File path: oap-server/server-library/library-elasticsearch-client/src/main/java/org/apache/skywalking/library/elasticsearch/requests/search/MatchQuery.java
##########
@@ -38,10 +38,14 @@
         public void serialize(final MatchQuery value, final JsonGenerator gen,
                               final SerializerProvider provider)
             throws IOException {
-            gen.writeFieldName("match");
             gen.writeStartObject();
             {
-                gen.writeStringField(value.getName(), value.getText());
+                gen.writeFieldName("match");
+                gen.writeStartObject();
+                {

Review comment:
       Just a code style?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org