Hello,

I juste made some junit test using some IntegerRangeQuery's, and I get some strange results. I attached the junit test I used. It fails on the last assert. I am expecting only one result: the date between 1981 and 1983, but I get 2
The test output is:

term = date:1980
term = date:1982
term = date:1984
q = date=[1981 TO 1983]
Document<stored/uncompressed,indexed,tokenized<date:1982>>
Document<stored/uncompressed,indexed,tokenized<date:1984>>

Do you have any idea?

Antoine


Randy Puttick wrote:

My fault, I forgot to attach it.  I've added it now.  Let me know how
this works for you.

Randy Puttick

-----Original Message-----
From: Antoine Brun [mailto:[EMAIL PROTECTED] Sent: Friday, August 19, 2005 8:11 AM
To: java-dev@lucene.apache.org
Subject: about numeric range searching with large value sets patches

Hello,

I am trying to integrate the patches for the numeric range searching and

the org.apache.lucene.util.Sort class that was posted as an attachment imports a org.apache.lucene.util.IntStack which I can't find.
Can anyone add this class?
Maybe as an attachment to http://issues.apache.org/bugzilla/show_bug.cgi?id=36135

Thank you


      Antoine Brun

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



/*
 * Created on 15 avr. 2005
 */
package opsys.lucene.test.search;

import java.io.IOException;

import junit.framework.TestCase;
import opsys.lucene.server.search.IntegerRangeQuery;

import org.apache.lucene.analysis.WhitespaceAnalyzer;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.IndexWriter;
import org.apache.lucene.index.TermEnum;
import org.apache.lucene.search.Hits;
import org.apache.lucene.search.IndexSearcher;
import org.apache.lucene.store.RAMDirectory;

public class IntegerRangeQueryTestCase extends TestCase {
    
    private RAMDirectory directory;
    private IndexSearcher searcher;
    
    public void setUp() throws Exception {
        directory = new RAMDirectory();
        
        IndexWriter writer = new IndexWriter(directory, new WhitespaceAnalyzer(), true);
        Document doc1 = new Document();
        doc1.add(new Field("date", "1980", Field.Store.YES, Field.Index.TOKENIZED));
        writer.addDocument(doc1);
        
        Document doc2 = new Document();
        doc2.add(new Field("date", "1982", Field.Store.YES, Field.Index.TOKENIZED));
        writer.addDocument(doc2);
        
        Document doc3 = new Document();
        doc3.add(new Field("date", "1984", Field.Store.YES, Field.Index.TOKENIZED));
        writer.addDocument(doc3);
        writer.close();
        
        searcher = new IndexSearcher(directory);
    }
    
    public void tearDown() throws Exception {
        searcher.close();
    }
    
    /**
     * On cherche un term qui n'est pas das le document original mais pour lequel on a une liste de synonyme
     * @throws IOException
     */
    public void testIntegerRangeQuery() throws IOException {
        
        IndexReader ir = IndexReader.open(directory);
        TermEnum te = ir.terms();
        int i = 0;
        while (te.next()) {
            i++;
            System.out.println("term = " + te.term());
        }
        assertEquals(3, i);
        
        IntegerRangeQuery q = new IntegerRangeQuery("date", new Integer(1981), new Integer(1983), true);
        System.out.println("q = " + q);
        Hits hits = searcher.search(q);
        for (int j=0; j<hits.length();j++ ) {
            System.out.println(hits.doc(j).toString());
        }
        assertEquals(1, hits.length());
    }
    
}

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to