@@ -0,0 +1,2053 @@
+package com.github.rnewson.couchdb.lucene;%0A%0Aimport static org.hamcrest.CoreMatchers.is;%0Aimport static org.junit.Assert.assertThat;%0A%0Aimport java.io.IOException;%0A%0Aimport org.apache.lucene.analysis.standard.StandardAnalyzer;%0Aimport org.apache.lucene.document.Document;%0Aimport org.apache.lucene.document.NumericField;%0Aimport org.apache.lucene.index.IndexReader;%0Aimport org.apache.lucene.index.IndexWriter;%0Aimport org.apache.lucene.index.IndexWriter.MaxFieldLength;%0Aimport org.apache.lucene.search.IndexSearcher;%0Aimport org.apache.lucene.search.NumericRangeQuery;%0Aimport org.apache.lucene.search.Sort;%0Aimport org.apache.lucene.search.SortField;%0Aimport org.apache.lucene.search.TopDocs;%0Aimport org.apache.lucene.search.TopFieldDocs;%0Aimport org.apache.lucene.store.Directory;%0Aimport org.apache.lucene.store.RAMDirectory;%0Aimport org.apache.lucene.util.Version;%0Aimport org.junit.Test;%0A%0Apublic class LuceneTest %7B%0A%0A    @Test%0A    public void testNumerics() throws Exception %7B%0A        final Directory dir = new RAMDirectory();%0A        final IndexWriter writer = new IndexWriter(dir, new StandardAnalyzer(Version.LUCENE_CURRENT), true,%0A                MaxFieldLength.UNLIMITED);%0A        add(writer, 1);%0A        add(writer, 2);%0A        add(writer, 10);%0A        add(writer, 100);%0A        writer.close();%0A%0A        final IndexReader reader = IndexReader.open(dir, true);%0A        final IndexSearcher searcher = new IndexSearcher(reader);%0A%0A        final TopDocs td = searcher.search(NumericRangeQuery.newIntRange(%22int%22, 2, 10, true, true), 10);%0A        assertThat(td.totalHits, is(2));%0A%0A        final TopFieldDocs tfd = searcher.search(NumericRangeQuery.newIntRange(%22int%22, 0, 5, true, true), null, 10,%0A                new Sort(new SortField(%22int%22, SortField.INT)));%0A        assertThat(tfd.totalHits, is(2));%0A%0A        reader.close();%0A    %7D%0A%0A    private void add(final IndexWriter writer, final int value) throws IOException %7B%0A        final Document doc = new Document();%0A        doc.add(new NumericField(%22int%22).setIntValue(value));%0A        writer.addDocument(doc);%0A    %7D%0A%0A%7D%0A

add test for new numeric support.