Timothy Potter created SOLR-9691:
------------------------------------

             Summary: Streaming expressions need to be able to use a metric 
computed by the facet stream as a field in other streams.
                 Key: SOLR-9691
                 URL: https://issues.apache.org/jira/browse/SOLR-9691
             Project: Solr
          Issue Type: Improvement
      Security Level: Public (Default Security Level. Issues are Public)
          Components: eaming Expressions
    Affects Versions: 6.2.1
            Reporter: Timothy Potter


Using 6.2.1, I want to use a facet stream to do an intermediate count and then 
sum up the counts in a rollup stream, i.e. something like:

{code}
rollup(
  sort(
    hashJoin(
      search(products,
                  q="*:*",
                  fl="product_id,model_num",
                  sort="product_id asc",
                  qt="/export",
                  partitionKeys="product_id"),
      hashed=facet(transactions, q="*:*", buckets="product_id", 
bucketSizeLimit=1000000, bucketSorts="product_id asc", count(*)),
      on="product_id"
    ), 
    by="model_num asc"
  ), 
  over="model_num",
  sum(count(*))
)
{code}

Basically, I want to get a count of each product_id from the transactions 
collection (# of transactions per product) and then join that with the products 
table to generate a projection containing:

{code}
{
  "result-set": {
    "docs": [
      {
        "product_id": "1234",
        "count(*)": 4,
        "model_num": "X"
      },
      {
        "product_id": "5678",
        "count(*)": 5,
        "model_num": "Y"
      },
      ...
    ]
  }
}
{code}

This works, but the outer rollup doesn't recognize the count(*) as a field. I 
get this error:

{code}
{
  "result-set": {
    "docs": [
      {
        "EXCEPTION": "Invalid expression sum(count(*)) - expected 
sum(columnName)",
        "EOF": true
      }
    ]
  }
}
{code}



--
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