Toon posts:

[VB.NET 2005] Index Service

Pagina: 1
Acties:

Verwijderd

Topicstarter
Ik heb 2 vragen over Index Service.
Hoe kan je vanuit de code een directory toevoegen ?
Hoe kan je vanuit de code opvragen hoever die is met indexeren ?
Ik heb tot nu toe voor elkaar gekregen om catalogs aan te maken en te verwijderen.
Zoeken in catalogs en resultaten in een datagridview weergeven.
De catalogs opvragen en informatie eruit halen

Visual Basic .NET:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
'catalog aanmaken
        obj.Stop()
        obj.AddCatalog("ICT", "D:\ICT_Catalog")
        obj.Start()
        MessageBox.Show("Succesfully Added")

'catalogs opvragen
        Dim isFoundCatalog As Boolean = obj.FindFirstCatalog
        Dim sCatalogList As String
        While isFoundCatalog
            Dim Catalog As CIODMLib.ICatAdm = obj.GetCatalog
            sCatalogList &= "Name: " & Catalog.CatalogName & ", "
            sCatalogList &= "Loc: " & Catalog.CatalogLocation & ", "
            sCatalogList &= "Running: " & Catalog.IsCatalogRunning & ControlChars.NewLine
            isFoundCatalog = obj.FindNextCatalog()
        End While
        MsgBox(sCatalogList)

'catalogs zoeken
        Dim con As OleDbConnection
        Dim cmd As New OleDbCommand
        con = New OleDbConnection("Provider=\MSIDXS.1\;Data Source=ICT;Integrated Security .=")
        cmd.Connection = con
        cmd.CommandText = "select doctitle, filename, vpath, rank, characterization from scope() " & _
        " where FREETEXT(Contents, '" + TextBox1.text + "') order by rank desc "
        con.Open()
        Dim da As OleDbDataAdapter = New OleDbDataAdapter(cmd)
        cmd.ExecuteNonQuery()
        Dim ds As DataSet = New DataSet
        Dim dt As DataTable = New DataTable
        da.Fill(ds, "SearchResult")
        dt = ds.Tables(0)
        DataGridView1.DataSource = dt

Verwijderd

Topicstarter
ik was vergeten erbij te zetten wat die obj is

Visual Basic .NET:
1
Private obj As New CIODMLib.AdminIndexServerClass 'referentie naar Indexing Service Administration Type Library 1.0
Ik hoop dat dit iets verduidelijkt