Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Lucene: Java-User

Updating a Field in Lucene 3.6*Matching abbreviations to full field names

 

 

Lucene java-user RSS feed   Index | Next | Previous | View Threaded


menorca89 at gmail

May 29, 2012, 7:07 AM

Post #1 of 2 (145 views)
Permalink
Updating a Field in Lucene 3.6*Matching abbreviations to full field names

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: java-user-unsubscribe [at] lucene
For additional commands, e-mail: java-user-help [at] lucene


menorca89 at gmail

May 29, 2012, 8:07 AM

Post #2 of 2 (140 views)
Permalink
Re: Updating a Field in Lucene 3.6*Matching abbreviations to full field names [In reply to]

i have to make multiple such fields..and am iterating over them..so i guess i
have to create all fields together in a block first...like
"affiliations"..etc..how do i map the abbreviations to the full names_

--
View this message in context: http://lucene.472066.n3.nabble.com/Updating-a-Field-in-Lucene-3-6-Matching-abbreviations-to-full-field-names-tp3986604p3986610.html
Sent from the Lucene - Java Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe [at] lucene
For additional commands, e-mail: java-user-help [at] lucene

Lucene java-user RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.