Try our conversational search powered by Generative AI!

Episerver search - Object reference not set to an instance of an object.

Vote:
 

Hi,

 

I've tried to utilize the search functionality that comes with Episerver public page types, but I'm experiencing some problems.

 

I'm using Episerver 5.2.375.133

 

The search page seems to work on and off. Mostly off.

 

Either I get no result or the searchdata fails with "Object reference not set to an instance of an object."

 

The page type is registered with one prototype : "SearchRoot" (Page)

 

 

<EPiServer:SearchDataSource ID="SearchDataSource" runat="server" EnableVisibleInMenu="false">

 

<SelectParameters>
<EPiServer:PropertyParameter Name="PageLink" PropertyName="SearchRoot" />
     
<asp:controlparameter name="SearchQuery" controlid="SearchText" propertyname="Text"/>    <asp:controlparameter name="SearchFiles" controlid="SearchInFiles" propertyname="Checked"/>        <asp:controlparameter name="OnlyWholeWords" controlid="SearchOnlyWholeWords" propertyname="Checked"/>
</SelectParameters> 
</EPiServer:SearchDataSource>
        protected void SearchClick(object sender, EventArgs e)
        {
            SearchResult.Visible = true;
            NoSearchResult.Visible = false;
            SearchDataSource.DataBind();
        }

 

 

Stack trace:

 

 

 

at EPiServer.DataAccess.PageTextIndexDB.<>c__DisplayClass8.b__7() at EPiServer.DataAccess.DataAccessBase.<>c__DisplayClass1`1.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)

 

#36425
Jan 28, 2010 9:36
Vote:
 

I would upgrade to CMS 5 R2 SP2 (you're on SP1), then I would strip out most of the code so that you only have the SearchDataSource and a data control for displaying the result left. The code you're using is it the same as the code from PublicTemplates or any custom code there?

#36497
Jan 30, 2010 12:34
Vote:
 

Seems similar to this thread?

#36532
Feb 02, 2010 8:16
Vote:
 

Regarding the thread Magnus Paulsson is refering to, everything is converted into english languagebranch by using "Language settings" and choosing "English" under "Available languages".

The search engine still reports "Object reference not set to an instance of an object." as a exception on searchdatasource.

I have upgraded the site to episerver 5.2 SP2 and will try to strip down the page to see if I can find the error.

For answering Frederik Vig, yes - the code is copied from public templates. I haven't changed anything not even css.

It is therefore a challange to trip it even further to find the error.

Kind regards,

JHA

#36571
Feb 03, 2010 14:10
Vote:
 

Try to set the LanguageBranches property of the SearchDataSource to "en". It might still be the problem even if you don't have globalized content.

#36572
Feb 03, 2010 14:13
Vote:
 

Thanks a trillion, Magnus! That did it. However I'm curious why I had to set it. It works in the template so why should I have to use the Languagesbranch attribute on my site? I'm using "en" in web.config.

Another thing. The searchengine hits on the first and second level only. When I insert a searchquery that is supposed to hit on links on the third level I get no results. EnableVisualInMenu is currently false. I have to check up on that.

But again - thank you very much for solving the object failure error!

Kind regards,

Jon Haakon

 

#36575
Feb 03, 2010 14:45
Vote:
 

You're welcome :) I consider the behaviour a bug or a near-bug. I reported it long ago but EPiServer could not reproduce it. It does not appear in "normal" OOTB websites, but we can add your example of converted LanguageBranches to my example of migrated pages (from 4.62). If the LanguageBranches property is not set, the language should be auto-selected, and it is in most cases but not in our two examples.

I can't recall any problems with having neither deep-tree pages or menu-invisible pages show up in search results. As long as their properties are searchable it should work.

#36601
Feb 04, 2010 6:58
Vote:
 

Did you convert languages using the change languages tool from Adam? (http://blog.najmanowicz.com/2009/04/06/advanced-language-manipulation-tool-for-episerver/)

It does not change the language on keyword table (tblKeyword), which could be the problem.

/Steve

#37042
Feb 18, 2010 8:59
Vote:
 

No, I haven't converted anything. The site is based on a standard Episerver installation where English language branch was choosen.

I therefore assumed that the search function world work since I didn't change any language on the content.

But thank you for the link! Perhaps I could convert the content into norwegian language branch using this tool. The most important think

is that it works. :)

#37075
Feb 19, 2010 11:00
Vote:
 

The searchpage seems to only recognise the first level from the searchroot spesified on the searchpage.

It doen't hit on subpages/children. Is there a setting for searching on children of the searchroot?

Kind regards,

 

Jon Haakon

#37076
Feb 19, 2010 11:50
Vote:
 

Hello everyone, I can see from the dates that this thread is old.. however so is my code I have figured.

I am trying to understand this ""TextSearchParameters" and "PageTextIndexDB" which is from the EPiServer.Core.Html and EPiServer.DataAccess

This is how I find it working..

TextSearchParameters is used to check if there is something in the database that is containg the search word I passed in.

PageTextIndexDB have the method called "searchPages" where you can put in the word you are searching for, the  pageid(where it should start looking, example rootpage or startpage) and the maxcount (how many results do you want to show)?

I receive a list of object with ranks and I am guessing these ranks are based on how close the matching are between the searchword and the page? BUT..

I have a page called for example "test" and when I search for the word "test" I want this page to be the first on to be shown. But it is not even displayed in the list!!

If I however would rename this page to "test-test" , but still be searching for "test" then this page would be one of the first pages..

Do you have any ideas on what to do here then please let me know..

This problem has been haunting me a time now.. :(

#150914
Jul 01, 2016 15:32
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.