The document discusses the open source search platform Solr, describing how it provides a RESTful web interface and Java client for full text search capabilities. It covers installing and configuring Solr, adding and querying data via its HTTP API, and using the SolrJ Java client library. The presentation also highlights key Solr features like faceting, filtering, and scaling for performance.
32. Getting Data Out http://localhost:8080/comix/select/?q=data&indent=on { "responseHeader":{ "status":0, "QTime":1, "params":{ "wt":"json", "rows":["1", "1"], "start":"0", "indent":"on", "q":"data", "version":"2.2"}}, "response":{"numFound":2,"start":0,"docs":[ { "feature_id":"3", "release_date":"1992-05-07", "id":"strip.3136", "timestamp":"2008-02-28T10:06:01.682Z"}] }} JSON format
33.
34.
35.
36.
37.
38.
39.
40.
41. Adding Docs w/SolrJ Given Map<String, String> fields; CommonsHttpSolrServer server = new CommonsHttpSolrServer( url ); SolrInputDocument doc= new SolrInputDocument(); for (Map.Entry<String, String> e : fields.entrySet()){ doc.addField(e.getKey(), e.getValue()); } UpdateResponse res = server .add( doc);
42. Deleting Docs w/SolrJ CommonsHttpSolrServer server = new CommonsHttpSolrServer( url ); UpdateResponse res; res = server .deleteById("100"); res = server .deleteByQuery("city:paris");
43. Simple Query CommonsHttpSolrServer server = new CommonsHttpSolrServer( url ); SolrQuery query = new SolrQuery(); query.setQuery("dance"); QueryResponse rsp = server .query(query);
44. More Interesting Query CommonsHttpSolrServer server = new CommonsHttpSolrServer( url ); SolrQuery query = new SolrQuery(); query.setQuery("dance"); query.setFacet( true ); query.addFacetField("city"); query.setFacetMinCount(1); query.addSortField( "price", SolrQuery.ORDER.asc ); QueryResponse rsp = server .query(query);