List of usage examples for org.apache.solr.common.params ModifiableSolrParams clear
public void clear()
From source file:org.lanes.text.mining.Similarity.java
License:Open Source License
public ArrayList<String> getArticleTitles(ModifiableSolrParams params) { ArrayList<String> titles = new ArrayList<String>(); try {//w ww. j a va2 s . c om QueryResponse response = solrserver.query(params); for (SolrDocument doc : response.getResults()) { Collection<String> fnames = doc.getFieldNames(); for (String fname : fnames) { Matcher matchername = Pattern.compile("titleText").matcher(fname); if (matchername.find()) { String title = (String) doc.getFieldValue(fname); titles.add(title); } } } params.clear(); } catch (Exception e) { //System.err.println (e.getMessage()); } return titles; }
From source file:org.lanes.text.mining.Similarity.java
License:Open Source License
private Double[] sendQuery(ModifiableSolrParams params) { double n = 0; double f = 0; try {//from w ww . ja v a 2 s .c o m QueryResponse response = solrserver.query(params); n = (double) response.getResults().getNumFound(); for (SolrDocument doc : response.getResults()) { Collection<String> fnames = doc.getFieldNames(); for (String fname : fnames) { Matcher matcherfname = Pattern.compile("totaltermfreq").matcher(fname); if (matcherfname.find()) { f = (Double) doc.getFieldValue(fname); } } } params.clear(); } catch (Exception e) { //System.err.println (e.getMessage()); } Double[] outputs = new Double[2]; outputs[0] = n; outputs[1] = f; return outputs; }