lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robert A. Decker" <dec...@robdecker.com>
Subject Field.Text arguments
Date Wed, 27 Mar 2002 23:22:36 GMT
I'm confused about using Fields.

Here's the two methods that are confusing me:
public static final Field Text(String name, Reader value)
public static final Field Text(String name, String value)

The difference is that one takes a reader and the other a string.

I have a field that will have pretty large contents after running through
my analyzer (1500 to 6000 characters).

When I use the second of the two methods above my string is not run
through the analyzer, but is stored in the index.

When I use the first method, by passing in a StringReader based of the
String, I don't get anything indexed at all (and therefore it's difficult
to know if it was analyzed).


Is there some other Field type that I should be using for text that I want
analyzed and indexed, and that the text can be fairly long?


Here's a rough order of I'm doing things. FragmentAnalyzer is my own
custom class that seems to normally work:

Document document = new Document();
Reader reader = new StringReader(text);
document.add(Field.Text("contents", reader));
...
FragmentAnalyzer analyzer = new FragmentAnalyzer();
IndexWriter writer = new IndexWriter(pathToIndex, analyzer,
isCreateNewIndex);
writer.addDocument(document);
writer.close();


rob


--
To unsubscribe, e-mail:   <mailto:lucene-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:lucene-user-help@jakarta.apache.org>


Mime
View raw message