I’m working on the collapse/expand functionality. I query for books, and I want 
to collapse my search results on their tf1flrid, basically a family ID.  I also 
want to do an expand so I can see what titles were collapsed out.  I’m looking 
at the docs here: 
https://solr.apache.org/guide/8_11/collapse-and-expand-results.html 
<https://solr.apache.org/guide/8_11/collapse-and-expand-results.html>

Here’s a gist of my working query at 
https://gist.github.com/petdance/34259dee2944a455341748a0e2ef2092 
<https://gist.github.com/petdance/34259dee2944a455341748a0e2ef2092>

I make the query, I get back 18 titles.  There are rows in the result that have 
duplicated tf1flrid fields. This is what I expect.

Then I try it again, 

curl "$URL" --silent --show-error \
    -X POST \
    -F "q=title_tracings_t:\"$Q\"" \
    -F 'fl=title,flrid,tf1flrid' \
    -F 'fq={!collapse field=tf1flrid nullPolicy=expand}' \
    -F 'expand=true' \
    -F 'rows=50' \
    -F 'sort=tf1flrid asc' \
    -F 'wt=json' \
    | jq -S .

and here’s the results: 
https://gist.github.com/petdance/f203c7c2bf0178e0d0c1596999801ae5 
<https://gist.github.com/petdance/f203c7c2bf0178e0d0c1596999801ae5>

I get back 12 titles, and the rows with duplicated tf1flrid values that were 
duplicated in the first query (1638JX7 and 1638PQ3 ) have been collapsed. 
That’s also as I expect. However, I don’t have an “expand” section that shows 
what the collapsed fields were.  I don’t see any errors in my solr.log.

What am I doing wrong?  What do I need to do to get the expand section to be 
returned?

Thanks,
Andy

Reply via email to