My wiki started returning incomplete search results.
A user will search for a term that they know is part of an article and the article isn't returned in the results.
They can browse to the article and see that the page does contain the search term.
This has happened frequently, so I've been trying to find a solution. I haven't been able to find anyone having this problem. The search index currently thinks there are 300 pages in the wiki, though there are actually 1193.
I followed the directions on the Screwturn site for rebuilding the index, including adjusting the timeout in the web.config. I ended up with several attempted rebuilds and around 70 errors between the attempts. I saw timeout errors and primary key violations. The rebuild wouldn't stay running very long, usually less than 10 minutes.
Has anyone had any success with rebuilding the index?
Has anyone seen the same sort of errors and been able to resolve them?
Does anyone know what I can expect to see when the rebuild is complete? I was thinking that I would see a new search index that referenced the 1193 pages, instead of 300. Is that correct?
Any help would be appreciated.
Below are three examples of the error messages I was seeing.
System.Data.SqlClient.SqlException: Violation of UNIQUE KEY constraint 'UQ_IndexDocument'. Cannot insert duplicate key in object 'dbo.IndexDocument'. The statement has been terminated. at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe) at System.Data.SqlClient.SqlCommand.ExecuteNonQuery() at ScrewTurn.Wiki.Plugins.SqlCommon.SqlClassBase.ExecuteNonQuery(DbCommand command, Boolean close, Boolean logError)
System.Data.SqlClient.SqlException: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding. The statement has been terminated. at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe) at System.Data.SqlClient.SqlCommand.ExecuteNonQuery() at ScrewTurn.Wiki.Plugins.SqlCommon.SqlClassBase.ExecuteNonQuery(DbCommand command, Boolean close, Boolean logError)
System.Data.SqlClient.SqlException: Violation of PRIMARY KEY constraint 'PK_IndexDocument'. Cannot insert duplicate key in object 'dbo.IndexDocument'. The statement has been terminated. at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe) at System.Data.SqlClient.SqlCommand.ExecuteNonQuery() at ScrewTurn.Wiki.Plugins.SqlCommon.SqlClassBase.ExecuteNonQuery(DbCommand command, Boolean close, Boolean logError)
(Update 7/30) I tried deleting the IndexDocument records and ran the rebuild again, but ended up with the same results. The index did not increase in size. I viewed the records on the IndexDocument table and they stop in the M articles of one of the namespaces. This explains why searches fail against words starting after M. Also, only two of the namespaces are being indexed. I watched the admin home page while the index was being rebuilt and waited for the wheels to stop spinning. Nothing seemed to change. I checked the system log and didn't see any errors. As soon as I restarted the application from the admin home page, the timeout error appeared in the log again. This leaves me with more questions than answers.
What is the indicator that the index has been successfully rebuilt, or that the index has stopped rebuilding? I thought this was the spinning wheels that run after the rebuild link has been clicked.
I've researched the timeout error and everything points to a timeout value that's too short and the forum posts say to update the timeout value in the .NET code, or adjust the query wait property on the server. Has anyone had success with this and what did you do?
Does anyone know what script is being run by the wiki to rebuild the index? Is it possible to run it manually from the SQL server?
Update: I had to give up on finding my answers. I did learn that you can force the index to rebuild one article at a time simply by updating the particles that are not listed in the IndexDocument table. While this does work, it results in some unexpected behavior when viewing the AllPages page from whichever namespace you're in. The AllPages page normally lists all articles (and the letter for each section) alphabetically. Once I did this forced update, the AllPages page would display the pages in alphabetical order, but the order of the sections would be similar to "#, A, B". The next batch of pages would be "B, C, K" and so on. Hardly ideal, but the search does work again. Just FYI for anyone else having probles, there is a workaround. This will have to be my final solution as the wiki is going to be retired and moved to a more robust (and supported!) knowledge base. Thanks Dreamwalker and Doug.