Re: How to add a field to hold a Java map object?

2013-02-13 Thread Cheng
Here is my code to add Java map object into Lucene: Map map = new HashMap<>(); map.put("栋", "6"); map.put("号", "202"); Fieldable fd = new Field("testMap", map.toString(), Store.YES, Index.NO); Document d = new Document(); d.add(fd); try { writer.addDocument(d); writer.commit(); } catch (Except

Re: How to add a field to hold a Java map object?

2013-02-13 Thread Cheng
http://lucene.apache.org/core/4_0_0-BETA/core/org/apache/lucene/document/StringField.html I found StringField API here, however, it seems that StringField can't be found and thus not compiled. My lucene is 3.5 On Wed, Feb 13, 2013 at 4:54 AM, Ian Lea wrote: > Assuming you mean the String repre

IndexReader.reopen() If Index Has Been Rebuilt

2013-02-13 Thread Wendy Meadows
We're using Lucene 3.3.0 and have an index with close to 10 million documents. When the application is started and the first search is performed, we open a read only IndexReader by calling IndexReader.open(directoryString, true). For all following searches, we check if the indexReader is current

Re: How to add a field to hold a Java map object?

2013-02-13 Thread Ian Lea
Assuming you mean the String representation of a Map, the same way you do any other String: use StringField or an analyzer that keeps the characters you want it to. Maybe WhitespaceAnalyzer. -- Ian. On Wed, Feb 13, 2013 at 1:34 AM, Cheng wrote: > Hi, > > How can I add field to hold a Java map