3

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.

  1. 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.

  2. 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?

  3. 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.

Darth Jed
  • 31
  • 2
  • First thing to do I think is make a backup! ;) Then delete all items in the indexdocument table then rebuild the index again. If you still have the issue log an issue at http://stw.codeplex.com as it looks like a bug – Dreamwalker May 23 '13 at 12:44
  • I finally have time to get back to this issue. I have version 3.0.4.560. I have a clone of the production wiki to test on without worrying about interrupting what little service it can provide now. I'll try Dreamwalker's idea and also the index rebuild and let you know the results. – Darth Jed Jul 18 '13 at 15:35

2 Answers2

1

Check for a page with no page content and delete these pages - that fixed my index.

G   SYSTEM  Page OnTime-Tools created
G   wkrzystek   Page update requested for OnTime-Tools
E   SQL Server Pages Storage Provider+SYSTEM    System.Data.SqlClient.SqlException: Transaction (Process ID 173) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction.
E   SQL Server Pages Storage Provider+SYSTEM    Page indexing error for OnTime-Tools (skipping page): System.NullReferenceException: Object reference not set to an instance of an object.
E   SYSTEM  http://websrv01/matrixwiki/Edit.aspx
System.Web thrown System.Web.HttpUnhandledException
E   SYSTEM  PageContent could not be retrieved for page OnTime-Tools - returning empty    

We had the same problem - we only had 510 of 670 pages in our index and the content stopped after "O". I couldn't find any other solutions so I started going through the SQL Log table. I noticed that a page was added but there was a SQL deadlock trying to store the page content. After that set of errors, every time a page was modified and the index was trying to update, it generated a "PageContent could not be retrieved" message and the index stopped there.

Fruity Geek
  • 7,351
  • 1
  • 32
  • 41
  • To get to the log, go to the Wiki's home page, Click the Administration link, then click the System Log tab at the top of the page. – bshacklett Jan 13 '14 at 16:54
0

I was just trying to fight this same issue and checked here to see if anyone else had a solution. Here are the results of my investigations.

I performed an index rebuild and then restarted the application but it still only says that 20 of my 123 total pages are indexed. I remember this being 20 the last time I checked as well so it seems like it is stuck. I don't see any errors in the system log. The version of this installation is 3.0.5.600 (the newest).

I have a few ScrewTurn installations so I just checked another installation that seems to search correctly and see that all 190 pages are indexed! The version of this installation is 3.0.2.500.

I wonder if indexing pages is broken in the newest version. Can you share what version you are running? Maybe a check of the changes between these two versions will highlight the problem.

Doug Knudsen
  • 935
  • 9
  • 15