lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From me89 <>
Subject Updating a Field in Lucene 3.6*Matching abbreviations to full field names
Date Tue, 29 May 2012 14:07:35 GMT
I have recently started working with Lucene 3.6.
I am creating an index with field names like,"Authors" for 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(
							// 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  
						   Field[] fields = new Field[]{new Field("Authors", "",
Field.Store.YES, Field.Index.ANALYZED)
// Print the content on the console

View this message in context:
Sent from the Lucene - Java Users mailing list archive at

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message