indexing service query with classic ASP

Discussion in 'C#' started by geckoskin, Oct 30, 2008.

  1. #1
    I inherited some ancient code as part of redesigning a client's website. It is supposed to contact the indexing service on the local machine to search through files in the webroot and return results.

    when i initially looked at indexing service, it was not even running, having been disabled at some point in the past, but the websearch had still been returning results - presumably cached from when the service had run previously. after starting the service, creating a new catalog with the same name that was referenced in the code, letting the index populate, and re-running the search on the site, it still returned the exact same results. when i run a search through the index service directly, the results are wildly different than what the page displays.

    it doesn't seem to be querying the new catalog i have created. the names match up, but as i am not familiar with any of this i could be missing something obvious.

    ---------------------------------------------------------------------

    'Get results from each of the catalogs. We'll append them on to an array.
    dim vResults
    set vResults = server.CreateObject("Scripting.Dictionary")

    'Call GetResults for each catalog
    GetResultsSite vResults,"CATALOGNAME",sSearchText

    -----snip... stuff that displayed the results went here-----

    sub GetResultsSite(vResultsDict, sCatalog, sQuery)

    on error goto 0

    dim oQuery
    set oQuery = Server.CreateObject("MSSearch.Query")

    'Set query parameters
    oQuery.Catalog = "query://localhost/" & sCatalog
    oQuery.MaxRecords = 5000
    oQuery.Query = sQuery
    oQuery.Columns = "DocTitle, Description, Rank, vpath"
    oQuery.AllowEnumeration = true

    ' Create the recordset holding the search results.
    'on error resume next
    set RS = oQuery.CreateRecordSet("sequential")

    ----------snip the rest of the function that dealt with excluding the admin directory and error handling------
     
    geckoskin, Oct 30, 2008 IP
  2. ranabra

    ranabra Peon

    Messages:
    125
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    I can give you 2 different leads:
    I don't think it is using the indexing service at all at the moment. the service was not running and I seriously doubt that the results came from cache

    Also, "oQuery.Catalog = "query://localhost/" & sCatalog" - are you 1000% sure the path is correct?
     
    ranabra, Oct 31, 2008 IP
  3. geckoskin

    geckoskin Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    i am not any % sure actually :) when i searched online for the syntax to query index service, it looked nothing like the code here; i figured this was just an alternate method for performing the query. if it is not contacting index service then what is it contacting?

    as for the path, we definitely want to search the files on localhost and sCatalog is definitely the catalog name in index service, that is all i know though - i assumed query:// was a method to communicate with index service.
     
    geckoskin, Oct 31, 2008 IP