I am beginner in solr i am trying to query solr from the java application (on play framework). I have included the following jar files to my lib directory
apache-solr-solrj-*.jar
commons-codec-1.3.jar
commons-httpclient-3.1.jar
commons-io-1.4.jar
jcl-over-slf4j-1.5.5.jar
slf4j-api-1.5.5.jar
as instructed in http://www.solrtutorial.com/solrj-tutorial.html
and my code is
import org.apache.solr.client.solrj.SolrServerException;
import org.apache.solr.client.solrj.impl.HttpSolrServer;
import org.apache.solr.common.SolrInputDocument;
import org.apache.solr.client.solrj.SolrQuery;
import org.apache.solr.client.solrj.response.QueryResponse;
import org.apache.solr.common.SolrDocumentList;
public static Result getRecipesAndVariants(String searchString){
JsonNode jnode = null;
HttpSolrServer solr = new HttpSolrServer("http://localhost:8983/solr/dbcollection");
SolrQuery query = new SolrQuery();
query.setQuery("fiction");
query.setFields("id","title","author");
query.setStart(0);
query.set("defType", "edismax");
QueryResponse response = solr.query(query);
SolrDocumentList results = response.getResults();
for (int i = 0; i < results.size(); ++i) {
System.out.println("from solr : "+results.get(i));
}
I am getting the error as error: cannot find symbol HttpSolrServer solr = new HttpSolrServer("http://localhost:8983/solr/dbcollection"); Kindly Help please