views:

54

answers:

2

I'm on a project that is being upgraded from vbscript to ASP.NET MVC. It used Microsoft Index Server to index Word and PDF files on a Windows Server 2003 machine. It simply opened an OleDbConnection using a connection string like "Provider=\"MSIDXS\";Data Source=\"docSearch\";".

After researching a bit, I learned that Index Server is obsolete ("Note Indexing Service is obsolete as of Windows XP. Instead, use Windows Search." - http://msdn.microsoft.com/en-us/library/ms690580) and Windows Search is the successor.
So, in my new MVC app, I'm trying to connect using OleDbConnection with a connection string like "Provider=Search.CollatorDSO;Extended Properties=\"Application=Windows\"".

I have a method that takes in a formatted query and executes the search - here is the query that gets executed using OleDb:

string.Format("SELECT System.FileName FROM SystemIndex WHERE CONTAINS('{0}')", query)

Now, when I call my method in a test class, it works fine (i.e. returns results... myDataReader.HasRows is true). But, when I call the same method from my MVC Controller, it returns no results - myDataReader.HasRows is false - using the same query. My guess is something to do with permissions and IIS not being able to access the index. How can I get IIS to have access to the index? How can I expose the index to a ASP.NET web page? If Index Server is obsolete, and this functionality isn't supported in Windows Search, what am I supposed to use?

Thanks!

+2  A: 

I would not change just because it is not supported unless you are having a specific problem with Indexing Service or need a feature from the newer version.

I would get connection string from ISearchQueryHelper

Does the service have the correct permissions? Have you checked the Windows Search 3.0/4.0 SDK?

I see you are on the forum (http://social.msdn.microsoft.com/Forums/en-US/windowsdesktopsearchdevelopment/thread/7b9eead4-d938-42c6-ba2b-2c238a7706f9)

I am not sure Windows Search can really replace Indexing Service for Web sites. For instance, there is only one index called "SystemIndex" which contains everything on the local system. Therefore, how would you limit the results to just a Web site?

I believe you need to use "enterprise search" or "search server", which I have no experience with.

Since the results for both Indexing Service and Windows Search are ADO.NET, the presentation does not change much. The API is different enough that you will need to make many changes. For instance, there is no "scope" in Windows Search. When I changed over my personal "desktop search" application, it took an hour to make the change, but two days to duplicate all the functionality that I had with Indexing Service because of the API changes. I made this change because Windows Search is better when searching for code snippets in my "Code Library"

For standard queries with no regular-expressions or wild-cards or non-standard properties, both perform the same. Indexing Service always retrieves data quicker, but may not perform some queries that are "too expensive". Windows Search can take a long time retrieving the data depending on the query. Typically, these "long queries" are the "too expensive" queries of Indexing Service. "Long queries" can also result from any query that retrieves a property that is not contained in the index.

I am still using Indexing Service for my web sites on Windows Server 2003 and do not plan to make any changes because it is not as easy as I expected and there is no compelling reason to do.

AMissico
I mostly thought the new search would improve performance, and it seemed like it would be easy to switch... but I'm still unclear if Windows Search is meant to be queried from a web site, since it requires a user be logged in to run (as opposed to a system service). This would make me think Indexing Service is a better fit.
davekaro
Scratch that bit about it requires a user to be logged in. I thought I read that on the MSDN forum somewhere, but the Windows Search Overview says it runs even when nobody is logged in.
davekaro
I am not sure that Windows Search can really replace Indexing Service for Web sites. For instance, there is only one index called SystemIndex which contains everything on the local system.
AMissico
I believe you need to use "enterprise search" or "search server", which I have no experience with.
AMissico
Since the results for both *Indexing Service* and *Windows Search* are ADO.NET, the presentation does not change much. The API is different enough that you will need to make many changes. For instance, there is no "scope" in *Windows Search*. I changed my personal "desktop search" application, but I am still using *Indexing Service* for my web sites and do not plan to make any changes. Think of it this way, DDE and DAO are unsupported, but still ship with the operating system.
AMissico
All I'm using Indexing Service or Windows Search for is to allow the user to search the contents of PDF/DOC files in a given directory on the server from a website. No other websites run on the server, and this specific directory would be the only directory indexed - so the SystemIndex should work fine. The other thought I had was to scrape the text from PDF/DOC files and just store the text in SQL Server - like here: http://blogs.msdn.com/b/sqlcat/archive/2010/02/03/full-text-indexing-terabytes-of-files-with-sql-server-and-cloud-storage.aspx
davekaro
A: 

I found my answer here http://stackoverflow.com/questions/3151551/asp-net-oledb-code-breaks-when-deployed-on-iis7. By impersonating a user that has access to the index.

davekaro