Search code examples
javasolrsolrj

Solr returns same result after adding document with SolrJ


I am trying to get the results from a Solr query, doing a simple /select?q=id:xx The problem is that its not returning anything when i use solr directly, but when i use SolrJ, like:

SolrQuery query = new SolrQuery();
query.setQuery(queryStr);
query.setRows(10);
QueryResponse rsp = solrServer.getSolrServer().query(query);

It returns the document added with no problem. How is that possible, i was thinking perhaps the SolrJ its sending an extra parameter internally but i couldnt find it.

I am using Solr 4.2.1


Solution

  • After doing some test i solved the problem, i had to use HttpSolrServer, instead of EmbeddedSolrServer, it seems EmbeddedSolrServer use their own data somehow, so i was managing 2 different datas. Using HttpSolrServer was the solution.