On 9/25/2014 8:43 AM, Erick Erickson wrote: > You can call anything from SolrJ that you can call from a URL. > SolrJ has lots of convenience stuff to set particular parameters, > parse the response, etc... But in the end it's communicating > with Solr via a URL. > > Take a look at something like SolrQuery for instance. It has a nice > command setFacetPrefix. Here's the entire method: > > public SolrQuery setFacetPrefix( String field, String prefix ) > { > this.set( FacetParams.FACET_PREFIX, prefix ); > return this; > } > > which is really > this.set( "facet.prefix", prefix ); > All it's really doing is setting a SolrParams key/value > pair which is equivalent to > &facet.prefix=blahblah > on a URL. > > As I remember, there's a "setPath" method that you > can use to set the destination for the request to > "suggest" (or maybe "/suggest"). It's something like > that.
Yes, like Erick says, just use SolrQuery for most accesses to Solr on arbitrary URL paths with arbitrary URL parameters. The "set" method is how you include those parameters. The SolrQuery method Erick was talking about at the end of his email is setRequestHandler(String), and you would set that to "/suggest". Full disclosure about what this method actually does: it also sets the "qt" parameter, but with the modern example Solr config, the qt parameter doesn't do anything -- you must actually change the URL path on the request, which this method will do if the value starts with a forward slash. Thanks, Shawn