title: lucene 4.x user-defined Filter, the DocsEnum in getDocIdSet(....) returns null and fail to work
body: <p>I make use of lucene 4.0 to build my search engine. I need to define a Filter when searching. The filter code like this will work fine:</p>
  
  <pre><code>public DocIdSet getDocIdSet(AtomicReaderContext context, Bits acceptDocs)
          throws IOException {
              String[] target_real_names = {"eMule"};
      OpenBitSet obs = new OpenBitSet(context.reader().maxDoc());
      for(String target_real_name : target_real_names){
          TermQuery query=new TermQuery(new Term(Fields.PROJECT_REAL_NAME,target_real_name)); 
          IndexSearcher indexSearcher=new IndexSearcher(context.reader());  
          TopDocs docs=indexSearcher.search(query,context.reader().maxDoc());  
          ScoreDoc[] scoreDocs=docs.scoreDocs;  
          if (scoreDocs.length==1) {  
              obs.set(scoreDocs[0].doc);  
          }  
      }
      return obs;
  }
  </code></pre>
  
  <p>but the code like this fail to work:</p>
  
  <pre><code>public DocIdSet getDocIdSet(AtomicReaderContext context, Bits acceptDocs)
          throws IOException {
      OpenBitSet obs = new OpenBitSet(context.reader().maxDoc());
              String[] target_real_names = {"eMule"};
      for(String target_real_name : target_real_names){
          DocsEnum de = context.reader().termDocsEnum(new Term(Fields.PROJECT_REAL_NAME, target_real_name));
          if(de.nextDoc()!= -1){
              obs.set((long)de.docID());
          }
      }
      return obs;
  }
  </code></pre>
  
  <p>In this piece of code, the de will be null, I don't know why. Any one can help me?</p>