package solrbook.client.servlet; import org.apache.solr.client.solrj.SolrQuery; import org.apache.solr.client.solrj.SolrServer; import org.apache.solr.client.solrj.impl.HttpSolrServer; import org.apache.solr.client.solrj.response.QueryResponse; import org.apache.solr.common.SolrDocument; import org.apache.solr.common.SolrDocumentList; public class Client { public static void main(String... args) throws Exception { final SolrServer solr = new HttpSolrServer("http://172.17.0.1:8983/solr/talkja"); final SolrQuery solrQuery = new SolrQuery(); solrQuery.set("q", ":"); final QueryResponse response = solr.query(solrQuery); final SolrDocumentList results = response.getResults(); System.out.println(results.size()); for (SolrDocument document : results) { System.out.println(document.get("url")); System.out.println(document.get("id")); System.out.println(document.get("title")); System.out.println(document.get("name")); } } }