Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Document Searching

Document Searching

Scheduled Pinned Locked Moved Visual Basic
databasecsharpsql-serversysadmin
7 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    MacOwl
    wrote on last edited by
    #1

    I am trying to find some direction on document searching. We have a Desktop application (VB.NET) and I want to incorporate document searching into the application. The application runs on a terminal server and accesses a standalone SQL server. I am currently looking into using the Indexing Service on a file server to index the documents(and possibly Exchange)) and then I will query the catalog(s), either directly from my application or, from my SQL server. When searching this topic I find that almost all of the discussions/examples revolve around web sites and searching web content. There seems to be no mention of doing this for a desktop application. Am I on the right track? Any pointers on: -Querying index catalogs (VB.Net)? -Running SQL queries on remote index servers -Performance. -Other options...

    N 2 Replies Last reply
    0
    • M MacOwl

      I am trying to find some direction on document searching. We have a Desktop application (VB.NET) and I want to incorporate document searching into the application. The application runs on a terminal server and accesses a standalone SQL server. I am currently looking into using the Indexing Service on a file server to index the documents(and possibly Exchange)) and then I will query the catalog(s), either directly from my application or, from my SQL server. When searching this topic I find that almost all of the discussions/examples revolve around web sites and searching web content. There seems to be no mention of doing this for a desktop application. Am I on the right track? Any pointers on: -Querying index catalogs (VB.Net)? -Running SQL queries on remote index servers -Performance. -Other options...

      N Offline
      N Offline
      Nick Otten
      wrote on last edited by
      #2

      Hello, I'm not completely sure to what you mean, but if your looking for a way to search for items in a directory (both network drive or local drive) you can use the following code:

      Dim filenames = My.Computer.FileSystem.GetFiles("C:", FileIO.SearchOption.SearchAllSubDirectories, "*.txt")
      For Each filename As String In filenames
      messagebox.show(filename)
      Next

      'NOTE if your system gives errors add the following line on top of your class: Imports System.IO

      this example will look for .txt files on your c drive and display each of there file paths in a messagebox. since this function uses the windows search function it will work faster if you got your drives indexed. also narrowing down your search path will speed things up. for querying things from a SQL database you can just push a query text to the server while declaring it as a "SqlCommand" (dont forget to add Imports System.Data.SqlClient on top of your code). here[^] is a tutorial. its for ado.net but it works the same in a vb.net desktop application.

      M 1 Reply Last reply
      0
      • N Nick Otten

        Hello, I'm not completely sure to what you mean, but if your looking for a way to search for items in a directory (both network drive or local drive) you can use the following code:

        Dim filenames = My.Computer.FileSystem.GetFiles("C:", FileIO.SearchOption.SearchAllSubDirectories, "*.txt")
        For Each filename As String In filenames
        messagebox.show(filename)
        Next

        'NOTE if your system gives errors add the following line on top of your class: Imports System.IO

        this example will look for .txt files on your c drive and display each of there file paths in a messagebox. since this function uses the windows search function it will work faster if you got your drives indexed. also narrowing down your search path will speed things up. for querying things from a SQL database you can just push a query text to the server while declaring it as a "SqlCommand" (dont forget to add Imports System.Data.SqlClient on top of your code). here[^] is a tutorial. its for ado.net but it works the same in a vb.net desktop application.

        M Offline
        M Offline
        MacOwl
        wrote on last edited by
        #3

        No, I want to be able to search content. I want to have a form in my application where the user types search terms and I return a list of documents that the content thereof matches the search criteria.

        N 1 Reply Last reply
        0
        • M MacOwl

          No, I want to be able to search content. I want to have a form in my application where the user types search terms and I return a list of documents that the content thereof matches the search criteria.

          N Offline
          N Offline
          Nick Otten
          wrote on last edited by
          #4

          You mean content from inside the document? like a word or sentence?

          M 1 Reply Last reply
          0
          • N Nick Otten

            You mean content from inside the document? like a word or sentence?

            M Offline
            M Offline
            MacOwl
            wrote on last edited by
            #5

            Yes. I have Index Server cataloging the content already and I have a test windows app that queries the content of the catalog using OLEDB. This works fine when I run it on the index server. The problem is that I can't access the catalog from another machine. Is there an easier way???

            N 1 Reply Last reply
            0
            • M MacOwl

              Yes. I have Index Server cataloging the content already and I have a test windows app that queries the content of the catalog using OLEDB. This works fine when I run it on the index server. The problem is that I can't access the catalog from another machine. Is there an easier way???

              N Offline
              N Offline
              Nick Otten
              wrote on last edited by
              #6

              So basically what you now have is a database with the cataloged content of all the items? Then i think the best way to go is to indeed use that database. If its a oledb you should be able to access it trough code. if it gives errors check if the permissions of the database allow a external user to read from it. And that there isnt a firewall blocking your path.

              1 Reply Last reply
              0
              • M MacOwl

                I am trying to find some direction on document searching. We have a Desktop application (VB.NET) and I want to incorporate document searching into the application. The application runs on a terminal server and accesses a standalone SQL server. I am currently looking into using the Indexing Service on a file server to index the documents(and possibly Exchange)) and then I will query the catalog(s), either directly from my application or, from my SQL server. When searching this topic I find that almost all of the discussions/examples revolve around web sites and searching web content. There seems to be no mention of doing this for a desktop application. Am I on the right track? Any pointers on: -Querying index catalogs (VB.Net)? -Running SQL queries on remote index servers -Performance. -Other options...

                N Offline
                N Offline
                Nick Otten
                wrote on last edited by
                #7

                Hey, Sorry for the double awsner but i ran into this today

                Dim filenames = My.Computer.FileSystem.FindInFiles("C:\", "text you want to find", True, FileIO.SearchOption.SearchAllSubDirectories)

                arguments: 1. root folder, 2. searched text, 3. ignore capital, 4. seachoption. returntype: a array of file locations (string)

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups