I wanted to ask if there is a quick way of getting content of a document into a single document field. All the examples i have seen have relatively short strings. I cannot save an entire journal article into a string and indexthat is there a quick way of telling lucene to index all the words in a file? I am using Lucene.net 3.03 for this application.
Asked
Active
Viewed 1,140 times
0
-
1Could use iFilter to extract words. You get words with no formatting. Paid there is Aspose for formatted text. – paparazzo Feb 13 '13 at 18:04
-
What is the format of the document and what do you mean by journal article? – paparazzo Feb 13 '13 at 20:27
2 Answers
0
You can just pass a System.IO.TextReader
to a Field
. If the file is plain text, or something like it, you should just be able to open the Reader on it, and pass it directly into the Field, like:
System.IO.TextReader reader = new StreamReader("path/to/my/file.txt");
Field field = new Field("fieldName", reader);
document.add(field);

femtoRgon
- 32,893
- 7
- 60
- 87
-
I like this idea!!! Are readers availabe in C# if so what namespace do I need to reference? – TheCodeNovice Feb 13 '13 at 18:21
-
That's my best shot at the C# version. Not really a C# dev, to be honest, so if I messed something up, please feel free to edit. – femtoRgon Feb 13 '13 at 20:21