You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@solr.apache.org by "joel-bernstein (via GitHub)" <gi...@apache.org> on 2023/05/19 19:10:33 UTC

[GitHub] [solr] joel-bernstein opened a new pull request, #1651: SOLR-16807: DenseVectorField breaks '*' copyFields

joel-bernstein opened a new pull request, #1651:
URL: https://github.com/apache/solr/pull/1651

   https://issues.apache.org/jira/browse/SOLR-XXXXX
   
   <!--
   _(If you are a project committer then you may remove some/all of the following template.)_
   
   Before creating a pull request, please file an issue in the ASF Jira system for Solr:
   
   * https://issues.apache.org/jira/projects/SOLR
   
   For something minor (i.e. that wouldn't be worth putting in release notes), you can skip JIRA. 
   To create a Jira issue, you will need to create an account there first.
   
   The title of the PR should reference the Jira issue number in the form:
   
   * SOLR-####: <short description of problem or changes>
   
   SOLR must be fully capitalized. A short description helps people scanning pull requests for items they can work on.
   
   Properly referencing the issue in the title ensures that Jira is correctly updated with code review comments and commits. -->
   
   
   # Description
   
   Please provide a short description of the changes you're making with this pull request.
   
   # Solution
   
   Please provide a short description of the approach taken to implement your solution.
   
   # Tests
   
   Please describe the tests you've developed or run to confirm this patch implements the feature or solves the problem.
   
   # Checklist
   
   Please review the following and check all that apply:
   
   - [ ] I have reviewed the guidelines for [How to Contribute](https://wiki.apache.org/solr/HowToContribute) and my code conforms to the standards described there to the best of my ability.
   - [ ] I have created a Jira issue and added the issue ID to my pull request title.
   - [ ] I have given Solr maintainers [access](https://help.github.com/en/articles/allowing-changes-to-a-pull-request-branch-created-from-a-fork) to contribute to my PR branch. (optional but recommended)
   - [ ] I have developed this patch against the `main` branch.
   - [ ] I have run `./gradlew check`.
   - [ ] I have added tests for my changes.
   - [ ] I have added documentation for the [Reference Guide](https://github.com/apache/solr/tree/main/solr/solr-ref-guide)
   


-- 
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: issues-unsubscribe@solr.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org


[GitHub] [solr] joel-bernstein merged pull request #1651: SOLR-16807: DenseVectorField breaks '*' copyFields

Posted by "joel-bernstein (via GitHub)" <gi...@apache.org>.
joel-bernstein merged PR #1651:
URL: https://github.com/apache/solr/pull/1651


-- 
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: issues-unsubscribe@solr.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org


[GitHub] [solr] joel-bernstein commented on pull request #1651: SOLR-16807: DenseVectorField breaks '*' copyFields

Posted by "joel-bernstein (via GitHub)" <gi...@apache.org>.
joel-bernstein commented on PR #1651:
URL: https://github.com/apache/solr/pull/1651#issuecomment-1559426891

   Just pushed a positive case as separate DocumentBuilder test. Adding a catchAll to the main DocumentBuilder test caused an a failure in a non-vector test method so I split it out to its own test.


-- 
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: issues-unsubscribe@solr.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org


[GitHub] [solr] joel-bernstein commented on a diff in pull request #1651: SOLR-16807: DenseVectorField breaks '*' copyFields

Posted by "joel-bernstein (via GitHub)" <gi...@apache.org>.
joel-bernstein commented on code in PR #1651:
URL: https://github.com/apache/solr/pull/1651#discussion_r1200992172


##########
solr/core/src/java/org/apache/solr/update/DocumentBuilder.java:
##########
@@ -322,13 +325,18 @@ private static boolean addCopyFields(
       // Dense Vector Fields can only be copied to same field type
       if (originalFieldType instanceof DenseVectorField
           && !(destinationField.getType() instanceof DenseVectorField)) {
-        throw new SolrException(
-            SolrException.ErrorCode.BAD_REQUEST,
-            "The copy field destination must be a DenseVectorField: " + destinationField.getName());
+        if (schema.getCopySources(destinationField.getName()).contains("*")) {
+          continue;
+        } else {
+          throw new SolrException(
+              SolrException.ErrorCode.BAD_REQUEST,
+              "The copy field destination must be a DenseVectorField: "
+                  + destinationField.getName());
+        }
       }
 
       // check if the copy field is a multivalued or not
-      if (!destinationField.multiValued() && destHasValues) {

Review Comment:
   Wasn't tidy, not sure exactly what happened. Must have fat fingered it.



-- 
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: issues-unsubscribe@solr.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org


[GitHub] [solr] joel-bernstein commented on a diff in pull request #1651: SOLR-16807: DenseVectorField breaks '*' copyFields

Posted by "joel-bernstein (via GitHub)" <gi...@apache.org>.
joel-bernstein commented on code in PR #1651:
URL: https://github.com/apache/solr/pull/1651#discussion_r1201070607


##########
solr/core/src/java/org/apache/solr/update/DocumentBuilder.java:
##########
@@ -322,13 +325,18 @@ private static boolean addCopyFields(
       // Dense Vector Fields can only be copied to same field type
       if (originalFieldType instanceof DenseVectorField
           && !(destinationField.getType() instanceof DenseVectorField)) {
-        throw new SolrException(
-            SolrException.ErrorCode.BAD_REQUEST,
-            "The copy field destination must be a DenseVectorField: " + destinationField.getName());
+        if (schema.getCopySources(destinationField.getName()).contains("*")) {
+          continue;
+        } else {
+          throw new SolrException(
+              SolrException.ErrorCode.BAD_REQUEST,
+              "The copy field destination must be a DenseVectorField: "
+                  + destinationField.getName());
+        }
       }
 
       // check if the copy field is a multivalued or not
-      if (!destinationField.multiValued() && destHasValues) {

Review Comment:
   Learned something new:
   
   https://docs.oracle.com/javase/specs/jls/se7/html/jls-15.html#jls-15.22.2
   
   The '&' behaves like a boolean logical operator with boolean operands. So '&&' is the same as '&' in this case. I'm 90% sure I didn't fat finger this. tidy didn't seem to make this change, possibly intellj did.



-- 
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: issues-unsubscribe@solr.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org


[GitHub] [solr] joel-bernstein commented on a diff in pull request #1651: SOLR-16807: DenseVectorField breaks '*' copyFields

Posted by "joel-bernstein (via GitHub)" <gi...@apache.org>.
joel-bernstein commented on code in PR #1651:
URL: https://github.com/apache/solr/pull/1651#discussion_r1200986049


##########
solr/core/src/java/org/apache/solr/update/DocumentBuilder.java:
##########
@@ -322,13 +325,18 @@ private static boolean addCopyFields(
       // Dense Vector Fields can only be copied to same field type
       if (originalFieldType instanceof DenseVectorField
           && !(destinationField.getType() instanceof DenseVectorField)) {
-        throw new SolrException(
-            SolrException.ErrorCode.BAD_REQUEST,
-            "The copy field destination must be a DenseVectorField: " + destinationField.getName());
+        if (schema.getCopySources(destinationField.getName()).contains("*")) {
+          continue;
+        } else {
+          throw new SolrException(
+              SolrException.ErrorCode.BAD_REQUEST,
+              "The copy field destination must be a DenseVectorField: "
+                  + destinationField.getName());
+        }
       }
 
       // check if the copy field is a multivalued or not
-      if (!destinationField.multiValued() && destHasValues) {

Review Comment:
   Wondering 'tidy' did this. I'll put it back the way it was and run tidy.



##########
solr/core/src/java/org/apache/solr/update/DocumentBuilder.java:
##########
@@ -322,13 +325,18 @@ private static boolean addCopyFields(
       // Dense Vector Fields can only be copied to same field type
       if (originalFieldType instanceof DenseVectorField
           && !(destinationField.getType() instanceof DenseVectorField)) {
-        throw new SolrException(
-            SolrException.ErrorCode.BAD_REQUEST,
-            "The copy field destination must be a DenseVectorField: " + destinationField.getName());
+        if (schema.getCopySources(destinationField.getName()).contains("*")) {
+          continue;
+        } else {
+          throw new SolrException(
+              SolrException.ErrorCode.BAD_REQUEST,
+              "The copy field destination must be a DenseVectorField: "
+                  + destinationField.getName());
+        }
       }
 
       // check if the copy field is a multivalued or not
-      if (!destinationField.multiValued() && destHasValues) {

Review Comment:
   Wondering if 'tidy' did this. I'll put it back the way it was and run tidy.



-- 
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: issues-unsubscribe@solr.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org


[GitHub] [solr] HoustonPutman commented on a diff in pull request #1651: SOLR-16807: DenseVectorField breaks '*' copyFields

Posted by "HoustonPutman (via GitHub)" <gi...@apache.org>.
HoustonPutman commented on code in PR #1651:
URL: https://github.com/apache/solr/pull/1651#discussion_r1200954916


##########
solr/core/src/java/org/apache/solr/update/DocumentBuilder.java:
##########
@@ -322,13 +325,18 @@ private static boolean addCopyFields(
       // Dense Vector Fields can only be copied to same field type
       if (originalFieldType instanceof DenseVectorField
           && !(destinationField.getType() instanceof DenseVectorField)) {
-        throw new SolrException(
-            SolrException.ErrorCode.BAD_REQUEST,
-            "The copy field destination must be a DenseVectorField: " + destinationField.getName());
+        if (schema.getCopySources(destinationField.getName()).contains("*")) {
+          continue;
+        } else {
+          throw new SolrException(
+              SolrException.ErrorCode.BAD_REQUEST,
+              "The copy field destination must be a DenseVectorField: "
+                  + destinationField.getName());
+        }
       }
 
       // check if the copy field is a multivalued or not
-      if (!destinationField.multiValued() && destHasValues) {

Review Comment:
   was this on purpose?



-- 
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: issues-unsubscribe@solr.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org


[GitHub] [solr] joel-bernstein commented on a diff in pull request #1651: SOLR-16807: DenseVectorField breaks '*' copyFields

Posted by "joel-bernstein (via GitHub)" <gi...@apache.org>.
joel-bernstein commented on code in PR #1651:
URL: https://github.com/apache/solr/pull/1651#discussion_r1200982690


##########
solr/core/src/java/org/apache/solr/update/DocumentBuilder.java:
##########
@@ -322,13 +325,18 @@ private static boolean addCopyFields(
       // Dense Vector Fields can only be copied to same field type
       if (originalFieldType instanceof DenseVectorField
           && !(destinationField.getType() instanceof DenseVectorField)) {
-        throw new SolrException(
-            SolrException.ErrorCode.BAD_REQUEST,
-            "The copy field destination must be a DenseVectorField: " + destinationField.getName());
+        if (schema.getCopySources(destinationField.getName()).contains("*")) {
+          continue;
+        } else {
+          throw new SolrException(
+              SolrException.ErrorCode.BAD_REQUEST,
+              "The copy field destination must be a DenseVectorField: "
+                  + destinationField.getName());
+        }
       }
 
       // check if the copy field is a multivalued or not
-      if (!destinationField.multiValued() && destHasValues) {

Review Comment:
   Nope. Fixing.



-- 
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: issues-unsubscribe@solr.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org


[GitHub] [solr] joel-bernstein commented on a diff in pull request #1651: SOLR-16807: DenseVectorField breaks '*' copyFields

Posted by "joel-bernstein (via GitHub)" <gi...@apache.org>.
joel-bernstein commented on code in PR #1651:
URL: https://github.com/apache/solr/pull/1651#discussion_r1201070607


##########
solr/core/src/java/org/apache/solr/update/DocumentBuilder.java:
##########
@@ -322,13 +325,18 @@ private static boolean addCopyFields(
       // Dense Vector Fields can only be copied to same field type
       if (originalFieldType instanceof DenseVectorField
           && !(destinationField.getType() instanceof DenseVectorField)) {
-        throw new SolrException(
-            SolrException.ErrorCode.BAD_REQUEST,
-            "The copy field destination must be a DenseVectorField: " + destinationField.getName());
+        if (schema.getCopySources(destinationField.getName()).contains("*")) {
+          continue;
+        } else {
+          throw new SolrException(
+              SolrException.ErrorCode.BAD_REQUEST,
+              "The copy field destination must be a DenseVectorField: "
+                  + destinationField.getName());
+        }
       }
 
       // check if the copy field is a multivalued or not
-      if (!destinationField.multiValued() && destHasValues) {

Review Comment:
   Learned something new:
   
   https://docs.oracle.com/javase/specs/jls/se7/html/jls-15.html#jls-15.22.2
   
   The '&' behaves like a boolean logical operator in with boolean operands. So '&&' is the same as '&' in this case. I'm 90% sure I didn't fat finger this. tidy didn't seem to make this change, possibly intellj did.



-- 
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: issues-unsubscribe@solr.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org