I'd like to use the SOLR search engine with my SmartGWT app. Interaction with SOLR is through a standard HTTP GET with a variety of search options specified as query params. The results can be returned as JSON. Here's an example request URL;
The response can look like this.
What is the best way to map the response data so I can bind it to various grids or other UI widgets. For example, I'd like to bind "response:docs" to one grid and "facet_counts:facet_queries" to another.
Also, notice that each "record" in response:docs has a couple of normal fields (name, id) but also others that are arrays (color, sku, size). I'd like to treat the arrays like a nested datasource so that they could expand into a nested grid in the main "response:docs" grid. An example would be much appreciated.
Code:
http://balboa:8085/apache-solr-1.4.0/core0/select/?indent=on&q=red&wt=json&facet=true&facet.mincount=1&start=3&rows=3&facet.query=price:[*+TO+100]&facet.query=price:[100+TO+*]
Code:
{ "responseHeader":{ "status":0, "QTime":0, "params":{ "facet":"true", "facet.mincount":"1", "indent":"on", "start":"3", "facet.query":["price:[* TO 100]", "price:[100 TO *]"], "q":"red", "wt":"json", "rows":"3"}}, "response":{"numFound":126,"start":3,"docs":[ { "name":"JUMPSUITS ", "id":"1520004", "price":[30.0,30.0,30.0,30.0], "color":[ "Red ", "Red ", "Red ", "Red "], "sku":[ "1010297", "1010305", "1010313", "1010347"], "size":[ "No Size ", "S 3 ", "S 4 ", "Girls 9 "]}, { "name":"BELL PEP. ORN./RED ", "id":"413005 ", "price":[4.0], "color":[ "Red "], "sku":[ "413005"], "size":[ ". "]}, { "name":"ORNAMENT,RED POMEGRA ", "id":"486076 ", "price":[4.5], "color":[ "Red Pomegranate "], "sku":[ "486076"], "size":[ ". "]}] }, "facet_counts":{ "facet_queries":{ "price:[* TO 100]":123, "price:[100 TO *]":8}, "facet_fields":{}, "facet_dates":{}}}
Also, notice that each "record" in response:docs has a couple of normal fields (name, id) but also others that are arrays (color, sku, size). I'd like to treat the arrays like a nested datasource so that they could expand into a nested grid in the main "response:docs" grid. An example would be much appreciated.
Comment