I forgot to post the workaround for this. The problem disappeared when I explicitly set the LanguageBranch property of the SearchDataSource. That shouldn't be needed, it should select automatically. But it seems that in some situations with migrated/imported pages null LanguageBranch causes the null reference exception. I recently came across such a situation again and it was not related to EPiStore but to pages imported from a CMS 4 to CMS 5 site.
Do you have any idea why I'm getting "Pages Object reference not set to an instance of an object" and the same error log message as above from using the Online Center Search after converting the Master Language from en to en-GB using the Advanced Language Tool? I tried this on an isolated page, search worked before but not after conversion. Re-indexing does nothing to fix this.
Well, I can see a vague connection - both cases have some problem with the default language branch. Somehow it does not connect the "null" language branch to the default one. In my case I could set the language branch explicitly, but doing this in the Online Center Search is probably harder. I'm afraid I don't have access to the site I worked on back then to check if the Online Center search works there or not.
I have installed EPiStore 2.5, and I get a null reference exception from the SearchDataSource in the search user control. The stack trace is this:
at EPiServer.DataAccess.PageTextIndexDB.<>c__DisplayClass8.<SearchPages>b__7()
at EPiServer.DataAccess.DataAccessBase.<>c__DisplayClass1`1.<Execute>b__0()
at EPiServer.DataAccess.DatabaseFactory.Execute[TResult](Action`1 method)
at EPiServer.DataAccess.DataAccessBase.Execute[TResult](Action`1 action)
at EPiServer.DataAccess.PageTextIndexDB.SearchPages(TextSearchParameters searchParams, Int32 pageID, Int32 maxAllowedHits)
at EPiServer.Web.WebControls.SearchDataSource.Select(DataSourceSelectArguments arguments)
at EPiServer.Web.WebControls.GenericDataSourceView`1.ExecuteSelect(DataSourceSelectArguments arguments)
Any hints as to what might be going on in these compiler generated methods?
The search control is out of the box, but my database is a converted version from an old EPiStore 2.1 installation. I have managed to get everything else but the order history (not important) to work with the new templates.