Hello!
I have recently started working with Lucene 3.6.
I am creating an index with field names like,"Authors" for example..now if
my input text file contains a field called"AU" i want its contents to be
indexed in"Authors".Should I first identify these abbreviations and then
create fields_ or can I first create fields and then keep updating it-
please help.
For ex>
Document doc = new Document();
String files;
File folder = new File(pathToInputFolder);
File[] listOfFiles = folder.listFiles();
for (int i = 0; i < listOfFiles.length; i++) {
if (listOfFiles[i].isFile()) {
files = listOfFiles[i].getName();
if (files.endsWith(".txt") ||
files.endsWith(".TXT")) {
try {
// Open the file that
is the first command line parameter
FileInputStream fstream
= new FileInputStream(
listOfFiles[i].getAbsoluteFile());
// Get the object of
DataInputStream
DataInputStream in =
new DataInputStream(fstream);
BufferedReader br = new
BufferedReader(
new
InputStreamReader(in));
String strLine;
// Read File Line By
Line
while ((strLine =
br.readLine()) != null) {
* if
(strLine.contains("AU")) {
// if i create fields
in the beginning,should i use this
luceneIndexConfiguration.setOpenMode(IndexWriterConfig.OpenMode.APPEND);//
Field[] fields = new
Field[]{new Field("Authors", "",
Field.Store.YES, Field.Index.ANALYZED)
indexWriter.addDocument(doc);*
// Print the content on the console
System.out.println(strLine);
--
View this message in context:
http://lucene.472066.n3.nabble.com/Updating-a-Field-in-Lucene-3-6-Matching-abbreviations-to-full-field-names-tp3986604.html
Sent from the Lucene - Java Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]