Okay - this is probably a dumb question, but I'll ask a style question
here also to help;
I want to build an index of chemical names and associated numbers with
them in lucene. I'm using the below code extract but when I come to the
code to add the Field.Keyword and Field.Text to the index, the compiler
tells me that
[C# Error] WinForm.cs(110): 'Lucene.Net.Documents.Field' does not
contain a definition for 'Keyword'
[C# Error] WinForm.cs(111): 'Lucene.Net.Documents.Field' does not
contain a definition for 'Text'
Can someone tell me what I'm doing wrong?
Second part of the question is in terms of searching for details
regarding Chemicals in Lucene, at the moment I have planned to add the
name and the index-number so we can identify the rest of the material.
Should I add other fields of fixed-text regarding each material, such as
CAS numbers (where there can be 1-50 of them), physical properties and
so forth, or am I better/is it more efficient to stick to traditional
search methods for these?
Karl
(ps - this is being written with borland c# 2006 implementation).
using System;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.IO;
using System.Text.RegularExpressions;
using Lucene.Net.Documents;
using Lucene.Net.Index;
using Lucene.Net.Analysis.Standard;
namespace CSharpTest1
{
public class FileReadStrings {
public static void ReadStrings( ) {
String line;
StreamReader f = new StreamReader("c:\\temp\\dictextract.txt");
while((line=f.ReadLine()) != null) {
String[] strings = line.Split(new char[]{ Convert.ToChar(9)});
if (strings.Length == 2) {
Document Doc = new Document();
Doc.add( Field.Keyword( "CW", strings[ 0]));
Doc.add( Field.Text( "NAME", strings[ 1]));
} //if
Console.WriteLine(line);
} //while
f.Close();
}
private static void AddIndex() {
IndexWriter writer = new IndexWriter("c:\\temp\\", new
StandardAnalyzer(), true);
Console.WriteLine( writer.DocCount());
writer.Optimize();
writer.Close();
}
}
}
________________________________________________________________________
This email has been scanned for all viruses by the MessageLabs SkyScan
service. For more information on a proactive anti-virus service working
around the clock, around the globe, visit http://www.hi-speed.net.au
________________________________________________________________________