lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 4568] - new IndexReader.terms(myterm) skips over first term
Date Fri, 25 May 2007 11:28:12 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=4568>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=4568


christian.mallwitz@xbridge.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|FIXED                       |




------- Additional Comments From christian.mallwitz@xbridge.com  2007-05-25 04:28 -------
Please see my code below: I create a index with two documents. When using term()
I get all terms, when using term(new Term(...)) I only get one. I'm using
lucene-2.1.0. The code produces the following output on my machine:

INFO: term(): contents:London
INFO: term(): unused:foobar
INFO: term(new Term()): unused:foobar

Code:

        Directory store = new RAMDirectory();
        IndexWriter writer = new IndexWriter(store, new WhitespaceAnalyzer(), true);

        Document doc1 = new Document();
        doc1.add(new Field(FIELD_NAME, "London", Field.Store.YES,
Field.Index.TOKENIZED));
        writer.addDocument(doc1);
        
        Document doc2 = new Document();
        doc2.add(new Field("unused", "foobar", Field.Store.YES,
Field.Index.TOKENIZED));
        writer.addDocument(doc2);
        
        writer.optimize();
        writer.close();

        IndexReader indexReader = null;
        TermEnum termEnum = null;
        
        try
        {
            indexReader = IndexReader.open(store);
            
            termEnum = indexReader.terms();
            
            while (termEnum.next()) { LOGGER.log(Level.INFO, "term(): " +
termEnum.term()); }
            
            termEnum = indexReader.terms(new Term(FIELD_NAME, ""));
            
            while (termEnum.next()) { LOGGER.log(Level.INFO, "term(new Term()):
" + termEnum.term()); }
        }
        finally
        {
            if (indexReader != null) { indexReader.close(); }
        }


-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


Mime
View raw message