title: How can I search on list of values using Lucene Query interface
body: <p>Simplistic Problem description:</p>
  
  <p>Lucene index has two fields per document: ID and NAME.</p>
  
  <p>I want to make a query using the Lucene Query interface such that I can find all the documents where ID is 1 OR 2 OR 3 OR so on. The IDs to be searched will be in a list and can potentially have upto 30 elements.</p>
  
  <p>If I was using the query parser I would have done something like</p>
  
  <pre><code>ID:(1 OR 2 OR 3)
  </code></pre>
  
  <p>But the application is already heavily committed to the Query interface and I want to follow the current pattern. Only way I can think of doing this with Query interface is create n term queries and group them using the Boolean query as below</p>
  
  <pre><code>BooleanQuery booleanQuery = new BooleanQuery();
  (String searchId : lstIds)
  {
      booleanQuery.add(new TermQuery(new Term("ID", searchId)), BooleanClause.Occur.SHOULD);
  }
  </code></pre>
  
  <p>But is there a better/more efficient way of doing this?</p>