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

Problems with a search functionality

Vote:
 

I have a EPiServer 7 site that has a word search for pages. That is a very basic search page which code comes from old AlloyTech demosite. Search works fine when tested in localhost but when the same site is running in a demo server (a different place that is), a word search founds nothing on any pages. In the demo server there is EPiServer Search installed. What could cause this? What things in code should I check for – or what should I check in general? For this to work searchable pages should be indexed?

There is though (at least) one difference between the sites. The localhost site was created by using EPiServer project template of Visual studio but the basis for demo server’s site is done with EPiServer Deployment center. So that means that the localhost site stores indexed files in:

C:/folder/SiteName/AppData/
EPiServerFramework.config: <appData basePath=”..\AppData” />

and the demo server stores them in:

C:/EPiServer/VPP/SiteName/
EPiServerFramework.config: <appData basePath=”C:\EPiServer\VPP\SiteName” />

This is just a guess but could this be the cause for the problem?

Any ideas and/or hints are welcome…

#64025
Dec 07, 2012 13:15
Vote:
 

Check if you can reach your indexing service. Try to add your domain to the hosts file and point it to localhost.

Check your index to see if it has any content in it. You should be able to use LUKE I think.

#64027
Dec 07, 2012 15:19
Vote:
 

Are you using the SearchDataSource or the index based search?

#64041
Dec 08, 2012 5:07
Vote:
 

I'm using SearchDataSource. Whether is essential or not, but Search.aspx looks like this:

<asp:Panel DefaultButton="SearchButton01" CssClass="searchpanel01" runat="server">
  <asp:TextBox ID="SearchTextBox01" runat="server" />
  <asp:Button ID="SearchButton01" OnClick="SearchButton01_Click" runat="server" />
</asp:Panel>

<EPiServer:SearchDataSource ID="Searcher01" PageLink="<%# EPiServer.Core.PageReference.StartPage %>" runat="server">
  <SelectParameters>
    <asp:ControlParameter ControlID="SearchTextBox01" Name="SearchQuery" PropertyName="Text" />
  </SelectParameters>
</EPiServer:SearchDataSource>

<asp:ListView DataSourceID="Searcher01" ID="ListViewSearch" runat="server" OnItemDataBound="ListViewSearch_ItemDataBound">
  <LayoutTemplate>
    <p><EPiServer:Translate Text="/search/results" runat="server" /></p>
    <p id="itemPlaceHolder" runat="server"></p>
  </LayoutTemplate>
  <ItemTemplate>
    <EPiServer:Property ID="SearchProp02" PropertyName="PageLink" CustomTagName="h3" CssClass="search_itemtitle" runat="server" />
    <asp:Literal ID="previewText" runat="server" />
    <EPiServer:Property ID="SearchProp03" PropertyName="Introduction" Visible="false" runat="server" />
    <EPiServer:Property ID="SearchProp04" PropertyName="MainBody" Visible="false" runat="server" />
  </ItemTemplate>
  <EmptyDataTemplate>
    <p><EPiServer:Translate Text="/search/noresults" runat="server" /></p>
    </EmptyDataTemplate>
</asp:ListView>

...and its codebehind:

protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
//save the contents of querystring to string
string searchQuery = Request.QueryString["search"];
//...and if string isn't empty or that there is something written in the textbox (header.ascx)
if (searchQuery != null)
{
//put the content of querystring to a searchpage's textbox
SearchTextBox01.Text = searchQuery;
//...and do the search
Searcher01.DataBind();
}
}

if (CurrentPage.LanguageID == "fi")
{
//search only Finnish pages
Searcher01.LanguageBranches = "fi";
SearchButton01.Text = "Hae";
}
else if (CurrentPage.LanguageID == "en")
{
//search only English pages
Searcher01.LanguageBranches = "en";
SearchButton01.Text = "Search";
}
}

protected void ListViewSearch_ItemDataBound(object sender, ListViewItemEventArgs e)
{
Property searchProp03 = (Property)e.Item.FindControl("SearchProp03");
Property searchProp04 = (Property)e.Item.FindControl("SearchProp04");
Literal previewText = (Literal)e.Item.FindControl("previewText");

//show the contents of property "introduction" in literal
//but limit the amount of text shown (parameter "maxTextLengthToReturn" of StripHtml)
if (searchProp03.InnerProperty != null && searchProp03.InnerProperty.Value != null)
{
previewText.Text = "<p class=\"search_itemtext\">" + TextIndexer.StripHtml(searchProp03.InnerProperty.Value.ToString(), 230) + "</p>";
}
//if there isn't content in "Introduction", show the contents of property "MainBody" instead
//...and limit the amount of text shown
else if (searchProp04.InnerProperty != null && searchProp04.InnerProperty.Value != null)
{
previewText.Text = "<p class=\"search_itemtext\">" + TextIndexer.StripHtml(searchProp04.InnerProperty.Value.ToString(), 230) + "</p>";
}
}

protected void SearchButton01_Click(object sender, EventArgs e)
{
Searcher01.DataBind();
}


:)

 

 

#64052
Dec 10, 2012 8:19
Vote:
 

A stupid question: how should I check whether or not I can reach the indexing service? :)


By the way, indexing works somewhat because if I'll add some image under the Global Files, I indexes the image to "C:/EPiServer/VPP/SiteName/SiteGlobalFiles" but when I create a new page and publish it, it doesn't get indexed under "C:/EPiServer/VPP/SiteName/Index/Main". At least there isn't any folder with the Date modified -date that would be the same date when the page was published.

#64060
Dec 10, 2012 12:41
Vote:
 

http://<siteurl>/indexingservice/indexingservice.svc

#64071
Dec 10, 2012 15:26
Vote:
 

I tried to access indexingservice via url. In localhost it finds it - or at least the browser shows this:

...but when I try same for site in demo server, the browser tells that page can't be loaded and it gives this error text:

Exception details:

ServiceActivationException: The service '/IndexingService/IndexingService.svc' cannot be activated due to an exception during compilation. The exception message is: This collection already contains an address with scheme http. There can be at most one address per scheme in this collection. If your service is being hosted in IIS you can fix the problem by setting 'system.serviceModel/serviceHostingEnvironment/multipleSiteBindingsEnabled' to true or specifying 'system.serviceModel/serviceHostingEnvironment/baseAddressPrefixFilters'. Parameter name: item.

Stack trace:

[ServiceActivationException: The service '/IndexingService/IndexingService.svc' cannot be activated due to an exception during compilation.  The exception message is: This collection already contains an address with scheme http.  There can be at most one address per scheme in this collection. If your service is being hosted in IIS you can fix the problem by setting 'system.serviceModel/serviceHostingEnvironment/multipleSiteBindingsEnabled' to true or specifying 'system.serviceModel/serviceHostingEnvironment/baseAddressPrefixFilters'.
Parameter name: item.]
   at System.Runtime.AsyncResult.End[TAsyncResult](IAsyncResult result)
   at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult result)
   at System.Web.HttpApplication.AsyncEventExecutionStep.OnAsyncEventCompletion(IAsyncResult ar)

[Inner exception ArgumentException: This collection already contains an address with scheme http.  There can be at most one address per scheme in this collection. If your service is being hosted in IIS you can fix the problem by setting 'system.serviceModel/serviceHostingEnvironment/multipleSiteBindingsEnabled' to true or specifying 'system.serviceModel/serviceHostingEnvironment/baseAddressPrefixFilters'.
Parameter name: item]
   at System.ServiceModel.UriSchemeKeyedCollection.InsertItem(Int32 index, Uri item)
   at System.Collections.Generic.SynchronizedCollection`1.Add(T item)
   at System.ServiceModel.UriSchemeKeyedCollection..ctor(Uri[] addresses)
   at System.ServiceModel.ServiceHost..ctor(Type serviceType, Uri[] baseAddresses)
   at IndexingServiceHostFactory.CreateServiceHost(Type serviceType, Uri[] baseAddresses)
   at System.ServiceModel.Activation.ServiceHostFactory.CreateServiceHost(String constructorString, Uri[] baseAddresses)
   at System.ServiceModel.ServiceHostingEnvironment.HostingManager.CreateService(String normalizedVirtualPath)
   at System.ServiceModel.ServiceHostingEnvironment.HostingManager.ActivateService(String normalizedVirtualPath)
   at System.ServiceModel.ServiceHostingEnvironment.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath)

Nevertheless indexingserver's .svc-file is located in demo server in a following place:

c:\EPiserver\Sites\SiteName\IndexingService\

So, should I do something in IIS or what...? :)

#64125
Dec 11, 2012 11:10
Vote:
 

Do you have multiple bindings in IIS? For example * on port 17000 and then mydemo.test.com on 80? In that case you need to remove the binding for 17000 or add base address prefix filter just like the error says: system.serviceModel/serviceHostingEnvironment/baseAddressPrefixFilters

 

#64126
Dec 11, 2012 11:16
Vote:
 

Hi,

I'm having problem to configure the FTS as well.
When I add the 

<episerver.search.indexingservice>
    <clients>
      <!--
      add name="example" description="example" ipAddress="127.0.0.1/8,192.168.0.0/24" ip6Address="" allowLocal="true|false" readonly="true|false" / 
         -->
      <add name="my-key" description="local" allowLocal="true" readonly="false" />
    </clients>
    <namedIndexes defaultIndex="default">
      <indexes>
        <add name="default" directoryPath="C:\MyProject\Index" readonly="false" />
      </indexes>
    </namedIndexes>
  </episerver.search.indexingservice>

    

I get the following error:

The configuration section 'episerver.search.indexingservice' cannot be read because it is missing a section declaration

Is there a nice documentation/tutorial how to configure the FTS?

I have followed http://world.episerver.com/Blogs/Paul-Smith/Dates1/2011/5/EPiServer-Full-Text-Search-Now-Available-For-CMS-6-R2/ but with no luck.

Thanks!

#64135
Dec 11, 2012 12:23
Vote:
 

Mohsen: It complains that it can't find a section declaration for the episerver.search.indexingservice. Add it and it should be fine:


<section name="episerver.search.indexingservice" type="EPiServer.Search.IndexingService.Configuration.IndexingServiceSection, EPiServer.Search.IndexingService"/>

Although this should already be added automatically when you install the service on your site.

#64137
Dec 11, 2012 12:32
Vote:
 

At least that line can be found in Web.config -file created by CMS 7. :)

#64138
Dec 11, 2012 12:39
Vote:
 

Thanks Toni.

Stupid of me. Works now =)

#64139
Dec 11, 2012 12:40
Vote:
 

I feel rather stupid now too. :) All that needed to do was add one line

<serviceHostingEnvironmentmultipleSiteBindingsEnabled="true"/>

in Web.config inside the <system.serviceModel> -tag. Like this:

      <webHttpBinding>
        <binding name="IndexingServiceCustomBinding" maxBufferPoolSize="1073741824" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647">
          <readerQuotas maxStringContentLength="10000000" />
        </binding>
      </webHttpBinding>
    </bindings>
	<serviceHostingEnvironment multipleSiteBindingsEnabled="true"/>
  </system.serviceModel>


 ...and after that searchpage started to find text in pages. Yeehaw! :P

#64142
Edited, Dec 11, 2012 13:20
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* 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.