title: Are IFilters necessary to index full text documents using Lucene.NET
body: <p>I am moving allong in my project and come to a crossroads dealing with the file content. I  have successfully created a working index that has some classification fields but I am know looking to have keyword search applied to the file contents. My issue is I am not sure if passing lucene a reader would translate to the API indexing the entire file contents. I did some searching online and found suggestions that an IFilter would be needed is that true? It seems somewhat complicated. Anyways my code for indexing file contents is below and does not work(if a reader is passed it fails). Ideally, I would like to be able to process doc and docx files.  Any help is much appreciated. </p>
  
  <p>My code creating a reader</p>
  
  <pre><code>public void setFileText()
          {
  
              var FD = new System.Windows.Forms.OpenFileDialog();
              StreamReader reader;
              if (FD.ShowDialog() == System.Windows.Forms.DialogResult.OK)
              {
                  string fileToOpen = FD.FileName;
                  reader = new StreamReader(fileToOpen);
              }
              else
              {
                  reader = null;
              }
              this.FileText =  reader;
          }
  }
  </code></pre>
  
  <p>My code to add the document to the index</p>
  
  <pre><code> private static void _addToLuceneIndex(MATS_Doc Data, IndexWriter writer)
          {
              // remove older index entry
          //    Query searchQuery = new TermQuery(new Term("Id", Data.Id.ToString()));
            //  writer.DeleteDocuments(searchQuery);
  
              // add new index entry
              Document doc = new Document();
  
              // add lucene fields mapped to db fields
  
              doc.Add(new Field("Id", Data.Id.ToString(), Field.Store.YES, Field.Index.NOT_ANALYZED));
              if (!string.IsNullOrEmpty(Data.Title))
                  doc.Add(new Field("Title", Data.Title, Field.Store.YES, Field.Index.NOT_ANALYZED));
              if (!string.IsNullOrEmpty(Data.Plant))
                  doc.Add(new Field("Plant", Data.Plant, Field.Store.YES, Field.Index.NOT_ANALYZED));
              if (!string.IsNullOrEmpty(Data.Containment))
                  doc.Add(new Field("Containment", Data.Containment, Field.Store.YES, Field.Index.NOT_ANALYZED));
              if (!string.IsNullOrEmpty(Data.Part))
                  doc.Add(new Field("Part", Data.Part, Field.Store.YES, Field.Index.NOT_ANALYZED));
              if (!string.IsNullOrEmpty(Data.Operation))
                  doc.Add(new Field("Operation", Data.Operation, Field.Store.YES, Field.Index.NOT_ANALYZED));
              if (!string.IsNullOrEmpty(Data.Geometry))
                  doc.Add(new Field("Geometry", Data.Geometry, Field.Store.YES, Field.Index.NOT_ANALYZED));
              if (Data.FileText != null)
                  doc.Add(new Field("Text", Data.FileText));
              // add entry to index
              writer.AddDocument(doc);
          }
  </code></pre>