[TYPO3-Solr] Term frequency solrj

huda barakat eng.huda.barakat at gmail.com
Wed Nov 2 13:35:15 CET 2016


Hi,	

I using SOLRJ to find term frequency for each term in a field, I wrote this code but it is not working:
this is my code:
##########################################

public static SolrRequest req;
public static void main(String[] args) throws SolrServerException,
IOException {
String urlString = "localhost:8983/solr/huda";
SolrClient solr = new HttpSolrClient.Builder(urlString).build();

SolrQuery query = new SolrQuery();
query.setQuery("*:*");  
SolrRequest<QueryResponse> req = new QueryRequest(query);
QueryResponse rsp = req.process(solr);

System.out.println("numFound: " + rsp.getResults().getNumFound());

TermsResponse termResp =rsp.getTermsResponse();
List<Term> terms = termResp.getTerms("name");
System.out.print(terms.size());
        }

###############################################

I got this :

Exception in thread "main" java.lang.NullPointerException at solr_test.solr.App2.main(App2.java:50)


More information about the TYPO3-project-solr mailing list