I just did a quick check on Solr 9 and expand / collapse was working. Here is the output:
https://gist.github.com/joel-bernstein/6f7f3ee12d5375630f3311c5dbd693ee Is it possible that the expand component isn't registered in your deployment? The expand component is a default component but have you overridden the defaults? Joel Bernstein http://joelsolr.blogspot.com/ On Tue, May 31, 2022 at 12:49 PM Andy Lester <[email protected]> wrote: > 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
