November Happy Hour will be moved to Thursday December 5th.

Problem with Page Provider and Search

Vote:
 

Hi ,

I have a pageProvider in my code.With the help of which I am retrieving productinfo of various products in my database.

There is a usercontrol of SearchBox in my page. Search is working in everypage except the Pages which came from providers.

when I hit search Page get refreshed and same pagecome agin and againinspite of redirecting to searchPage with qurystring value?

Please Help...............:

 

#46594
Dec 20, 2010 11:29
Vote:
 

Let's take this from the top.

You have implemented a custom PageProvider to serve product pages from a database. Question: have you registered the custom PageProvider with search-capability?

For example:

 

<add name="CustomPageProvider" type="Some.Namespace, Assembly" entryPoint="999" capabilities="Edit,MultiLanguage,Search"></add>
    

The custom page provider must also implement FindPagesWithCriteria. See the following post for more information:http://world.episerver.com/Documentation/Items/Tech-Notes/EPiServer-CMS-5/EPiServer-CMS-5-R2/Page-Providers/

As for the redirect - I don't really understand what you're doing there? Are you doing Response.Redirect(someUrl)?

Edit: Note that custom page providers are not indexed and you cannot use full-text search for these.You could look into using Lucene.Net to implement functionality for this.

#46595
Edited, Dec 20, 2010 12:54
Vote:
 

Hi,

Thanks for the Reply. Yes I have registered customPageProvider.

capabilities="Edit,Search".

It was just a Episerver Search in the page Left Menu. which is working in all the pages except the PageProvider.

 protected void SearchClick(object sender, EventArgs e)
        {
           
            string searchText = Server.UrlEncode(tbxQueryBox.Text.Trim());
            PageReference searchPageRef = CurrentPage["SearchPage"] as PageReference;
            if (searchText == null || searchText.Length == 0 || searchPageRef == null)
                return;

            PageData searchPage = GetPage(searchPageRef);
            Response.Redirect(String.Format("{0}&quicksearch={1}", searchPage.LinkURL, searchText));
        
        }

 

#46597
Dec 20, 2010 13:04
Vote:
 

Pages served by custom page providers are not indexed for full-text search, unfortunately. You could look into Deane Barker's approach of using Lucene.Net to index files & pages in EPiServer. http://world.episerver.com/Blogs/Deane-Barker/Dates/2010/12/Lucene-Search-for-EPiServer/

#46598
Dec 20, 2010 13:21
Vote:
 

Hi,

This means the pages in the provider is not indexable. But I am not indexing the providers page.  Response.redirect should redirect it to diffrent page with the querystring value.

Response.Redirect(String.Format("{0}&quicksearch={1}", searchPage.LinkURL, searchText));

#46599
Dec 20, 2010 13:35
Vote:
 

Yep. Have you checked so that you're not returning early and not hitting Response.Redirect?

I'm guessing that CurrentPage["SearchPage"] as PageReference resolves as Null.

#46601
Dec 20, 2010 13:59
Vote:
 

Edit: I suggest you use UriSupport.AddQueryString(string url, string name, string value) to add query parameters to an existing URL.

#46602
Edited, Dec 20, 2010 14:01
Vote:
 

Hi,

Thanks for the reply.

U are right

 PageReference searchPageRef = CurrentPage["SearchPage"] as PageReference; here the searchPageRef is null only in the page creted by page provider. How do I get the pagerefrence of that page?

#46699
Dec 28, 2010 10:13
Vote:
 

Either the SearchPage-property needs to exist on the current page or it should be set as a dynamic property.

An option would be to create a "Site Settings"-section on the start page. You can always access the start page reference via PageReference.StartPage. By doing so you can retrieve the start page and access any site-wide properties you may need.

#46736
Jan 03, 2011 8:46
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.