Private Sub Create_Index_Click(sender As Object, e As RoutedEventArgs) Handles Create_Index.Click 'Fetching Data from Databas Dim BibliDS As New DataSet Dim DataDS As New DataSet Dim dt As DataTable Dim strTagSbFld As String strTagSbFld = GetTagSbFldSQL() conn.Open() Dim strSQL As String = (strTagSbFld) adap.SelectCommand = New SqlCommand(strSQL, conn) adap.Fill(DataDS) conn.Close() DataDS.WriteXml("C:\Users\Shahrukh\Documents\Visual Studio 2012\Projects\Simple search1\Simple search1\New folder\Data.xml") 'MsgBox("XML Done") Dim directory As Directory = FSDirectory.GetDirectory("C:\Users\Shahrukh\Documents\Visual Studio 2012\Projects\Simple search1\Simple search1\New folder ") Dim analyzer As Lucene.Net.Analysis.Analyzer = New SimpleAnalyzer() Dim indexWriter As New IndexWriter(directory, analyzer) indexWriter.SetRAMBufferSizeMB(10.0) indexWriter.SetUseCompoundFile(False) indexWriter.SetMaxMergeDocs(10000) indexWriter.SetMergeFactor(100) dt = DataDS.Tables(0) If dt IsNot Nothing Then If dt.Rows.Count > 0 Then For Each dr As DataRow In dt.Rows 'Create the Document object Dim doc As New Document() For Each dc As DataColumn In dt.Columns 'Populate the document with the column name and value from our query doc.Add(New Field(dc.ColumnName, dr(dc.ColumnName).ToString(), Field.Store.YES, Field.Index.TOKENIZED)) Next ' Write the Document to the catalog indexWriter.AddDocument(doc) Next End If Else MsgBox("No Data") End If 'indexWriter.Optimize() 'Close the writer indexWriter.Flush() indexWriter.Close() End Sub
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)