title: Avoiding Two Queries in Solr
body: <p>Recently, I asked a question about how can I retrieve docids of all terms (inverted index). Please refer <a href="https://stackoverflow.com/questions/23061238/how-do-i-get-inverted-index-using-solrj">this question</a></p>
  
  <p>Now using the query,</p>
  
  <pre><code>http://localhost:8983/solr/terms?terms.fl=tags&amp;terms.sort=index
  
  
      &lt;response&gt;
  &lt;lst name="responseHeader"&gt;
  &lt;int name="status"&gt;0&lt;/int&gt;
  &lt;int name="QTime"&gt;2&lt;/int&gt;
  &lt;/lst&gt;
  &lt;lst name="terms"&gt;
  &lt;lst name="tags"&gt;
  &lt;int name="AbRam"&gt;2&lt;/int&gt;
  &lt;int name="Amitabh"&gt;2&lt;/int&gt;
  &lt;int name="Anjaam"&gt;2&lt;/int&gt;
  &lt;int name="Aryan"&gt;2&lt;/int&gt;
  &lt;int name="Baazigar"&gt;2&lt;/int&gt;
  &lt;int name="Bachchan"&gt;2&lt;/int&gt;
  &lt;int name="Barry"&gt;2&lt;/int&gt;
  &lt;int name="Biography"&gt;2&lt;/int&gt;
  &lt;int name="Bollywood"&gt;2&lt;/int&gt;
  &lt;int name="Chakde"&gt;2&lt;/int&gt;
  &lt;/lst&gt;
  &lt;/lst&gt;
  &lt;/response&gt;
  </code></pre>
  
  <p>Now, to find out doc Ids of all these terms, I will be making a search using solrj to the solr-index. I am certainly sure I don't need to query two times, but could not find any other solution. Is it possible using Lucene library (I am trying to access solr index using Lucene to see if I can retrieve docids corresponding to all terms.) ?</p>