[ 
https://issues.apache.org/jira/browse/SOLR-9396?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15412760#comment-15412760
 ] 

Hoss Man commented on SOLR-9396:
--------------------------------

Relevant comment from SOLR-9377...

Here's an example of what this failure looks like...

{noformat}
# start example
$ bin/solr -e techproducts
...

# disable autocommit & lazy field loading
$ curl --data-binary 
'{"set-property":{"updateHandler.autoSoftCommit.maxTime":"-1"},"set-property":{"query.enableLazyFieldLoading":false}}'
 -H 'Content-Type: application/json' 
'http://localhost:8983/solr/techproducts/config'
...

# re-index w/o doing a commit
$ bin/post -commit no -c techproducts example/exampledocs/*.xml
...

# do an RTG that involves:
#  - a function in the fl (so RTG uses a realtime searcher)
#  - a subquery in the fl that refers to field not otherwise included in the fl 
-- ie: price
#
# ...this will fail because the qubquery execution can't find a value for 
"$row.price" so
#    the sub-request query parsing fails
#
$ curl 
'http://localhost:8983/solr/techproducts/get?indent=true&id=SOLR1000&fl=id,product(popularity,3)&fl=xxx:%5Bsubquery%5D&xxx.q=%7B!field+f=price+v=$row.price%7D'
{
  "error":{
    "metadata":[
      "error-class","org.apache.solr.common.SolrException",
      "root-error-class","org.apache.solr.common.SolrException"],
    "msg":"while invoking xxx:[subquery] on 
doc=SolrDocument{id=stored,indexed,tokenized,omitNorms,indexOptions=DOCS<id:SOLR1000>,
 _version_=1542133",
    "code":400}}

{noformat}

here's the same problem demonstrated with a regular search...

{noformat}
# hack to force documentCache to not init properly (no straight forward way to 
disable via API)
# NOTE: expected to cause errors in log
$ curl --data-binary 
'{"set-property":{"query.documentCache.initialSize":"-1"}}' -H 'Content-Type: 
application/json' 'http://localhost:8983/solr/techproducts/config'

# do a simple query that involves:
#  - a subquery in the fl that refers to field not otherwise included in the fl 
(price)
#
# ...this will fail because the qubquery execution can't find a value for 
"$row.price" so
#    the sub-request query parsing fails
$ curl 
'http://localhost:8983/solr/techproducts/select?indent=true&q=id:SOLR1000&fl=id&fl=xxx:%5Bsubquery%5D&xxx.q=%7B!field+f=price+v=$row.price%7D'
<?xml version="1.0" encoding="UTF-8"?>
<response>

<lst name="error">
  <lst name="metadata">
    <str name="error-class">org.apache.solr.common.SolrException</str>
    <str name="root-error-class">org.apache.solr.common.SolrException</str>
  </lst>
  <str name="msg">while invoking xxx:[subquery] on 
doc=SolrDocument{id=stored,indexed,tokenized,omitNorms,indexOptions=DOCS&lt;id:SOLR1000&gt;}</str>
  <int name="code">400</int>
</lst>
</response>
{noformat}


----

The "right" way to fix this is to have 
{{SubQueryAugmenter.getExtraRequestFields()}} return the list of field names it 
expects to find in the docs being transformed, but unfortunately I can't think 
of an easy way to identify the list of all {{$row.\*}} params used in the 
subquery.



> [subquery] transformer doesn't automatically request needed fields, only 
> other fields in fl can be used as input to subquery
> ----------------------------------------------------------------------------------------------------------------------------
>
>                 Key: SOLR-9396
>                 URL: https://issues.apache.org/jira/browse/SOLR-9396
>             Project: Solr
>          Issue Type: Bug
>      Security Level: Public(Default Security Level. Issues are Public) 
>            Reporter: Hoss Man
>
> spinning off of SOLR-9377...
> the {{\[subquery\]}} transformer doesn't do anything to explicitly request 
> the document fields it needs in order to construct the subquery it executes 
> (ie every field {{foo}} to fill in {{$row.foo}})).  Which can lead to 
> unexpected errors when parsing/executing the subquery.
> The workaround is to only use the {{\[subquery\]}} transformer in conjunction 
> with an {{fl=\*}} glob, or explicitly list all fields needed.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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

Reply via email to