Support for the JSON Facet API in SolrJ was very recently committed via https://issues.apache.org/jira/browse/SOLR-12965 <https://issues.apache.org/jira/browse/SOLR-12965>. This missed the cut-off for 7.6 but will be included in 7.7 (if there is one) and/or 8.0. You may be able to use the patch there to see if there are gaps or bugs that could be fixed before 7.7 / 8.0.
Jason, who did the work on that issue, also presented on SolrJ at the Activate conference, you may find it interesting: https://www.youtube.com/watch?v=ACPUR_GL5zM <https://www.youtube.com/watch?v=ACPUR_GL5zM> If you do find the time to write some docs, I’d be happy to give you some editing help. Just open a Jira issue when/if you’ve got something and we can go from there. > On Nov 30, 2018, at 9:53 AM, Thomas L. Redman <tomred...@mchsi.com> wrote: > > Hi Shawn, thanks for the prompt reply! > >> On Nov 29, 2018, at 4:55 PM, Shawn Heisey <apa...@elyograg.org> wrote: >> >> On 11/29/2018 2:01 PM, Thomas L. Redman wrote: >>> Hi! I am wanting to do nested facets/Grouping/Expand-Collapse using SolrJ, >>> and I can find no API for that. I see I can add a pivot field, I guess to a >>> query in general, but that doesn’t seem to work at all, I get an NPE. The >>> documentation on SolrJ is sorely lacking, the documentation I have found is >>> less than a readme. Are there any books that provided a good tretise on >>> SolrJ specifically? Does SolrJ support these more advanced features? >> >> I don't have any specific details for that use case. > > Check out page 498 of the PDF, that includes a brief but powerful discussion > of the JSON Facet API. For just one example, I am interested in faceting a > nominal field within a date range bucket. Example: I want to facet > publication_date field into YEAR buckets, and within each YEAR bucket, facet > on author to get the most prolific authors in that year, AND to also facet > genre with the same bucket to find out how much scifi, adventure and so on > was produced that year. From what I am seeing, beyond pivots(and pivots won’t > support this specific use case), I don’t see this capability is supported by > the SolrJ API, but this is a hugely powerful feature, and needs to be > supported. > > Furthermore, I want to be able to support a vaste range of facets within a > single query, perhaps including some collapse and expand, groupings and so on. > >> >> If you share the code that gives you NPE, somebody might be able to help you >> get it working. > > I haven’t looked in to this enough to drop it in somebody elses' lap at this > point, I suspect I am not using the API correctly. And since this won’t allow > what I want, I’m not too worried about it. > >> >> The best place to find documentation for SolrJ is actually SolrJ itself -- >> the javadocs. Much of that can be accessed pretty easily if you are using >> an IDE to do your development. Here is a link to the top level of the SolrJ >> javadocs: >> >> https://lucene.apache.org/solr/7_5_0/solr-solrj/index.html >> <https://lucene.apache.org/solr/7_5_0/solr-solrj/index.html> > > The JavaDocs are limited. I surmise from tracing the code a bit though that I > need to rely less on methods provided directly by SolrQuery, and add > parameters using methods of the superclasses more frequently. Those > superclass methods add simply key value pairs. Still not sure this will allow > me the flexibility I need, particularly if the JSON Facet API is not > supported. > >> >> There's some documentation here, in the official reference guide: >> >> https://lucene.apache.org/solr/guide/7_5/using-solrj.html >> <https://lucene.apache.org/solr/guide/7_5/using-solrj.html> > > This is an excellent document. It would be wonderful if a document of this > caliber was provided solely for SolrJ in the form of a tutorial. The existing > online tutorial says nothing about how to do anything beyond a simple query. > I notice in this document most of the examples of how to issue queries, for > example, use curl to issue query. Simply put, this is not a practical > approach for the typical user. That being the case, people need to build real > UIs around applications that hide the intricacies of the search API. I would > rather not build my own API, since SolrJ is already in place, and seems quite > powerful. I have been using it for a few years, but really just to do queries. > > I might be interested in contributing to such a document, provided it is > sufficiently succinct. I find myself quite busy these days. But I think I > would really have to ramp up my understanding of SolrJ to be of any use. Is > there any such document in the works, or any interested parties? I am NOT a > good writer, I would need somebody to review my work for both accuracy and > grammar. > > Also, if the JSON API supported by SolrJ, or is there any plan to support?