class SolrController {

    @RequestMapping("/queryAllOne")
    public String queryAllOne() throws IOException, SolrServerException {
 /*  //第一种方式
        Map<String, String> queryParamMap = new HashMap<String, String>();
        queryParamMap.put("q", "*:*");
        //queryParamMap.put("f1", "id,name");
        queryParamMap.put("f1", "id:88");
        queryParamMap.put("sort", "id asc");
        MapSolrParams mapSolrParams = new MapSolrParams(queryParamMap);
        solrClient.query(mapSolrParams);

        for (Map.Entry<String, String[]> mapSolrParam : mapSolrParams) {

            System.out.println("solrDocument==============" + mapSolrParam);
        }

        return mapSolrParams;*/

        SolrQuery query = new SolrQuery();

        // 给query设置一个主查询条件：关键词
        query.setQuery("*:*");
        query.add("q", "name:然");

        QueryResponse response = solrClient.query(query);

        SolrDocumentList docs = response.getResults();

        long numFound = docs.getNumFound();

        System.out.println("总共查询到的文档数量： " + numFound);

        return docs.toString();

    }

}