mkhludnev commented on code in PR #4880:
URL: https://github.com/apache/solr/pull/4880#discussion_r4048356717


##########
solr/core/src/java/org/apache/solr/search/join/ScoreJoinQParserPlugin.java:
##########
@@ -237,6 +256,94 @@ public void visit(QueryVisitor visitor) {
     }
   }
 
+  /**
+   * Creates a join query, delegating to {@link 
JoinUtil#createJoinQuery(String, boolean, String,
+   * Class, Query, IndexSearcher, ScoreMode)} for a numeric {@code 
fromField}/Point {@code toField}
+   * pair, or to {@link JoinUtil#createJoinQuery(String, boolean, String, 
Query, IndexSearcher,
+   * ScoreMode)} otherwise.
+   *
+   * @param fromField "foreign key" field name; any field type with a numeric 
{@link NumberType}
+   *     (not necessarily a Point field type) qualifies, as long as {@code 
docValues="true"} is set.
+   *     It doesn't need to be {@code indexed}.
+   * @param fromSchema schema holding {@code fromField}, used to detect 
numeric doc values
+   * @param toField "primary key" field name
+   * @param toSchema schema holding {@code toField}, used to detect numeric 
Point fields
+   * @param fromQuery the query to match documents on the from side
+   * @param fromSearcher the searcher that executed the specified fromQuery
+   * @param scoreMode instructs how scores from the fromQuery are mapped to 
the returned query
+   * @return a {@link Query} instance that can be used to join documents based 
on the values in the
+   *     from and to field
+   */
+  static Query createJoinQuery(
+      String fromField,
+      IndexSchema fromSchema,
+      String toField,
+      IndexSchema toSchema,
+      Query fromQuery,
+      IndexSearcher fromSearcher,
+      ScoreMode scoreMode)
+      throws IOException {
+    final SchemaField fromSchemaField = fromSchema.getFieldOrNull(fromField);

Review Comment:
   then, it can't obtain numeric class, and fall back to string DV join via 
Lucene that can lately fail if it's a typo in a field; or happily join over 
fields which are present in index but absent in schema. It's odd but it's 
working now. So, we can keep it as is. 



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to