Dear Lucene team, I would like to create index files for the below xml file using Lucene.Net dll v2.9. I used the below code, but its not working. Please guide me to create index files for the below xml file. Thanks in advance
<NewsHistory> <News> <Story eid="34151"> <Stream>8742656</Stream> <Identifier>KDILI00D9L36</Identifier> <GroupIdentifier></GroupIdentifier> <VersionType>ORIGINAL</VersionType> <Action>ADD_1STPASS</Action> <WireNumber>25</WireNumber> <WireCode>BN</WireCode> <Language>ENGLISH</Language> <Time>20090115 13:30:00.000</Time> <HotLevel>2</HotLevel> <Headline>*U.S. INITIAL JOBLESS CLAIMS ROSE 54,000 TO 524,000 LAST WEEK</Headline> <Type>PLAIN</Type> <Text> China’s statistics bureau said it condemns leaks of economic data and those responsible</Text> </Story> <Story eid="34151"> <Stream>8742656</Stream> <Identifier>KDILI03T6SQU</Identifier> <GroupIdentifier></GroupIdentifier> <VersionType>ORIGINAL</VersionType> <Action>ADD_1STPASS</Action> <WireNumber>25</WireNumber> <WireCode>BN</WireCode> <Language>ENGLISH</Language> <Time>20090115 13:30:00.000</Time> <HotLevel>0</HotLevel> <Headline>*U.S. INITIAL JOBLESS CLAIMS ROSE 54,000 TO 524,000 LAST WEEK</Headline> <Type>PLAIN</Type> <Text> China’s foreign-exchange reserves exceeded $3 trillion for the first time</Text> </Story> </News> <NewsHistory> Code =========== indexFileLocation = @"C:\Index"; Lucene.Net.Store.Directory dir = FSDirectory.GetDirectory(indexFileLocation, true); //create an analyzer to process the text Lucene.Net.Analysis.Analyzer analyzer = new Lucene.Net.Analysis.Standard.StandardAnalyzer(); IndexWriter indexWriter = new IndexWriter(indexFileLocation, new StandardAnalyzer(), true); TextReader txtReader = new StreamReader(@"C:\NewsMetaData.xml"); //create a document, add in a single field Document doc = new Document(); Field fldContent = new Field("contents", txtReader, Field.TermVector.YES); doc.Add(fldContent); //write the document to the index indexWriter.AddDocument(doc); //optimize and close the writer indexWriter.Optimize(); indexWriter.Close();