코드는 다음과 같습니다 :solrJ 오류가 HttpSolrServer 및 SolrServer
import java.net.MalformedURLException;
import org.apache.solr.client.solrj.SolrServer;
import org.apache.solr.client.solrj.SolrServerException;
import org.apache.solr.client.solrj.impl.HttpSolrServer;
import org.apache.solr.client.solrj.response.QueryResponse;
import org.apache.solr.common.params.ModifiableSolrParams;
public class SolrQuery {
public static void main(String[] args) throws MalformedURLException, SolrServerException {
SolrServer server = new HttpSolrServer("http://localhost:8080/solr");
ModifiableSolrParams params = new ModifiableSolrParams();
params.set("q", "1");
QueryResponse response = server.query(params);
System.out.println("response = " + response);
}
}
하지만 난 프로그램을 실행하려고 할 때, 난 오류 :
Exception in thread "main" java.lang.Error: Unresolved compilation problems:
SolrServer cannot be resolved to a type
HttpSolrServer cannot be resolved to a type
The type org.apache.solr.common.params.SolrParams cannot be resolved. It is indirectly referenced from required .class files
어떻게 해결할 수 있습니까?
컬렉션 이름에 url 또는 컬렉션 이름을 추가하십시오. – vinod
@vinod 나는 solr에서 새롭다, 더 특정 일 수 있는가? –
답을 확인하십시오. – vinod