On 3/26/2018 11:19 AM, Webster Homer wrote: > You may say that the String in the constructor is "meant to be query > syntax", nothing in the Javadoc says anything about the expected syntax. > Since there is also a method to set the query, it seemed reasonable to > expect that it would take the output of the toString method. (or some other > serialization method)
You're right that the javadoc is not very specific. It says this: Parameters: q - query string In general in Solr, "query string" is understood to be something you would put in the "q" parameter when you send a query. Or maybe the "fq" parameter. The javadoc could definitely be improved. The javadoc for the toString specifically used here is a little more specific. (SolrQuery inherits from SolrParams, and that's where the toString method is defined): https://lucene.apache.org/solr/6_6_0/solr-solrj/org/apache/solr/common/params/SolrParams.html#toString-- It says "so that the URL may be unambiguously pasted back into a browser." > So how would a user play back logged queries? This seems like an important > use case. I can parse the toString output, It seems like the constructor > should be able to take it. > If not a constructor and toString, methods, I don't see methods to > serialize and deserialize the query > Being able to write the complete query to a log is important, but we also > want to be able to read the log and submit the query to solr. Being able to > playback the logs allows us to trouble shoot search issues on our site. It > also provides a way to create load tests. > > Yes I can and am going to create this functionality, it's not that > complicated, but I don't think it's unreasonable to think that the existing > API should handle it. Yes, that would be great capability to have. But it hasn't been written yet. A method like "parseUrlString" on SolrQuery would be a good thing to have. Thanks, Shawn