title: How to add multiple AND Boolean Queries for lucene
body: <p>I have a 10 million lucene documents that look this:</p>
  
  <pre><code>{
       "0": 230,
       "1": 12,
       "2": 611,
       "3": 800
  }
  </code></pre>
  
  <p>I am trying to find all documents were all fields are less than 10. Here is the lucene code I have:</p>
  
  <pre><code>BooleanQuery bq = new BooleanQuery();
  bq.Add(NumericRangeQuery.NewIntRange("0", 1, 10, true, true), Occur.MUST);
  bq.Add(NumericRangeQuery.NewIntRange("1", 1, 10 , true, true), Occur.MUST);
  bq.Add(NumericRangeQuery.NewIntRange("2", 1, 10, true, true), Occur.MUST);
  //bq.Add(NumericRangeQuery.NewIntRange("3", 1, 1000, true, true), Occur.MUST);
  
  TopDocs hits = searcher.Search(bq, 10);
  int counter = 0;
  foreach (ScoreDoc scoreDoc in hits.ScoreDocs)
  {
  
     Lucene.Net.Documents.Document doc = searcher.Doc(scoreDoc.Doc);
     Console.WriteLine("3: " + doc.Get("3"));
     counter++;
  }
  </code></pre>
  
  <p>The problem I am having is when ever I check all 4 properties to see if all 4 properties are between 1 and 10 I get no results. When I check the first 3 properties I get the correct results. But when I add the forth I get nothing. As you can see the forth boolean clause is commented out because it will produce no results. I even made the forth property check across the whole range between 1 and 1000 and I still got no results. Am I doing something wrong? Here is how I build the index.</p>
  
  <pre><code>public static void BuildIndex()
  {
      Directory directory = FSDirectory.Open(new System.IO.DirectoryInfo("C:\\Users\\Luke\\Desktop\\1"));
      Analyzer analyzer = new Lucene.Net.Analysis.Standard.StandardAnalyzer(Lucene.Net.Util.Version.LUCENE_30);
      IndexWriter writer = new IndexWriter(directory, analyzer, new IndexWriter.MaxFieldLength(100000));
  
  
      for (int x = 0; x &lt; 10000000; x++)
      {
          Document doc = new Document();
          doc.Add(new NumericField("id", 100000, Field.Store.YES, true).SetIntValue(x));
          for (int i = 0; i &lt; 5; i++)
          {
              doc.Add(new NumericField(i.ToString(), 100000, Field.Store.YES, true).SetIntValue(rand.Next(1, 1000)));
          }
  
          writer.AddDocument(doc);
          if (x % 500 == 0)
          {
              Console.WriteLine(x);
          }
      }
  
      writer.Optimize();
      writer.Flush(true, true, true);
      writer.Dispose();
      directory.Dispose();
  
      Console.WriteLine("done");
      Console.Read();
  }
  </code></pre>