title: Lucene - searching for a numeric value field
body: <p>ok, i have searched for this in the past two hours with results that only give's tips,
  and not even one complete code to the rescue ( how would noobs learn if they cant see some samples ? )</p>
  
  <p>i have created an index like so:</p>
  
  <pre><code>Directory directory = FSDirectory.Open(new System.IO.DirectoryInfo(Server.MapPath("/data/channels/")));
  Analyzer analyzer = new StandardAnalyzer(Version.LUCENE_29);
  IndexWriter writer = new IndexWriter(directory, analyzer, true, Lucene.Net.Index.IndexWriter.MaxFieldLength.UNLIMITED);
  Document doc = new Document();
  doc.Add(new Field("ID", "0", Field.Store.YES, Field.Index.NO));
  doc.Add(new Field("parentID", "0", Field.Store.YES, Field.Index.NO));
  doc.Add(new Field("Title", "Root", Field.Store.YES, Field.Index.ANALYZED));
  writer.AddDocument(doc);
  writer.Optimize();
  writer.Close();
  </code></pre>
  
  <p>Now, i want to search for the field <code>ID</code> Where the value equals <code>0</code> ( to get the single record i have there )....</p>
  
  <p>but, a simple search like this:</p>
  
  <pre><code>Directory directory = FSDirectory.Open(new System.IO.DirectoryInfo(Server.MapPath("/data/channels")));
  Analyzer analyzer = new Lucene.Net.Analysis.Standard.StandardAnalyzer(Version.LUCENE_29);
  Searcher searcher = new Lucene.Net.Search.IndexSearcher(IndexReader.Open(directory, true));
  Query query = new Lucene.Net.QueryParsers.QueryParser(Version.LUCENE_29, "ID", analyzer).Parse("0");
  Hits hits = searcher.Search(query);
  </code></pre>
  
  <p>returns no results.
  i have read about <code>NumericRange</code>, <code>KeywordAnalyzer</code> and some more things,
  but since none of them provides a sample i could not figure out how to do it.</p>
  
  <p>please, kind people, give me an example of how to make this thing work.</p>