Retrieve Object from Solr

前端 未结 3 1605
梦毁少年i
梦毁少年i 2020-12-06 14:03

So, I have a java based web project that displays information retrieved from 3 separate services, hosted on different servers, I use Apache Http Client to

3条回答
  •  旧巷少年郎
    2020-12-06 14:59

    String id; //input parameter to search with
    SolrQuery q = new SolrQuery();
    q.set("q","id:" + id);
    q.set("fl","*"); // fetch all fields to map to corresponding POJO
    
    QueryResponse queryResponse = solrClient.query("My Collection Name", q);
    
    //because I search by ID, I expect a list of just one element
    MyPojo myPojo = queryResponse.getBeans(MyPojo.class).get(0);
    

提交回复
热议问题