solr找到与查询结果相似的文档
当然 mlt.fl 也可以添加多个field ,用逗号隔开就行了
?
//相关搜索查询List relationList = new ArrayList();query = new SolrQuery();query.setQuery("title:"+ query_char.toString()+" AND type:2222"); query.addField("title"); query.setStart(0); query.setRows(10); query.setParam("mlt", "true"); query.setParam("mlt.fl", "title"); query.setParam("mlt.mintf", "100"); query.setParam("mlt.mindf", "1"); try {QueryResponse response = server.query(query);SolrDocumentList docs = response.getResults();for (SolrDocument doc : docs) {Snaphost host = new Snaphost();System.out.println(doc.getFieldValue("title").toString());host.setKeyword(doc.getFieldValue("title").toString());relationList.add(host);}} catch (SolrServerException e) {e.printStackTrace();}
?
?