[ http://issues.apache.org/jira/browse/SOLR-30?page=comments#action_12421456 ] Darren Erik Vengroff commented on SOLR-30: ------------------------------------------
Hi Phil, Thanks for posting this code. I look forward to having a Java search client be a part of Solr. I took an initial look through the code and have a few comments. 1. On the interface side, I like the general idea, but I think it could be extended a bit. Specifically, one of Solr's strengths is that it knows the type of the fields in each document. I'd like to see a hierarchy of Field classes that capture this. Right now, a field value is always a String, even though the Solr server comes back with things like <str name="id">45</str> <bool name="inStock">true</bool> <float name="price">19.95</float> ... that clearly indicate the type of each field that comes back. The SolrSearcher code ignores the type when it pulls out the value of each triple. This leaves the application that's using the SolrSearcher to have to maintain some kind of knowledge about the server-side schema, and keep that knowledge in sync with any changes on the server side. 2. I'd like to see the dependencies on JDOM and the Commons HttpClient removed if possible. The fewer external dependencies there are, the more broadly this code can be adopted. 3. I don't quite understand the use of the Integer type in many of the fields in Response. Is there a reason they can't just be ints? I see that in SolrSearcher you are using the constructor Integer(String) to parse String attribute values. But that doesn't mean you need to store the result as an Integer. Indeed you could use Integer.parseInt(String) instead and never have to construct a new object at all. > Java client code for performing searches against a Solr instance > ---------------------------------------------------------------- > > Key: SOLR-30 > URL: http://issues.apache.org/jira/browse/SOLR-30 > Project: Solr > Issue Type: New Feature > Components: search > Reporter: Philip Jacob > Priority: Minor > Attachments: solrsearcher-client.zip > > > Here are a few classes that connect to a Solr instance to perform searches. > Results are returned in a Response object. The Response encapsulates a > List<Map<String,Field>> that gives you access to the key data in the results. > This is the main part that I'm looking for comments on. > There are 2 dependencies for this code: JDOM and Commons HttpClient. I'll > remove the JDOM dependency in favor of regular DOM at some point, but I think > that the HttpClient dependency is worthwhile here. There's a lot that can be > exploited with HttpClient that isn't demonstrated in this class. The purpose > here is mainly to get feedback on the API of SolrSearcher before I start > optimizing anything. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira
