Utility\SimpleSearch not working

For general questions and discussions specific to the AbleCommerce GOLD ASP.Net shopping cart software.
Post Reply
Calbeth
Ensign (ENS)
Ensign (ENS)
Posts: 20
Joined: Thu Oct 04, 2012 8:21 am

Utility\SimpleSearch not working

Post by Calbeth » Thu Oct 11, 2012 7:42 am

Hey gang,

The prefabbed SimpleSearch control isn't working as is. No matter what I enter as my keyword search phrase, I receive the error message, "Search keyword must be at least 1 characters in length excluding spaces and wildcards." I'm not redirected to a results page under any circumstance. I'm on a fresh install of AC Gold (not upgraded from 7).

I discovered the problem while working on a customization of the control (intended to search products, specifically). I'm pretty certain I've traced the issue to the way the control is supposed to handle errors. Search starts working when I comment out the ASP Button control SearchButton, from validation group to close, as such (see lines 7-8):

Code: Select all

<div class="simpleSearchPanel">
    <asp:Panel ID="SearchPanel" runat="server" CssClass="innerSection">
		<asp:ValidationSummary ID="SearchValidation" runat="server" ShowMessageBox="true" validationgroup="Search" Visible="true"/>
        <asp:TextBox ID="SearchPhrase" runat="server" CssClass="searchPhrase" 
         	  Text="Search Products by Model # or Keyword" MaxLength="60"></asp:TextBox>
        <asp:Button ID="SearchButton" runat="server" Text="Search"
			 OnClick="SearchButton_Click" CausesValidation="true" /><!--validationgroup="Search"
			 onclientclick="if(Page_ClientValidate('Search')){{window.location='{0}?k='+encodeURIComponent({1}.value);}}return false;" />-->
		<cb:SearchKeywordValidator ID="SearchPhraseValidator" runat="server" ControlToValidate="SearchPhrase" 
			ErrorMessage="Search keyword must be at least {0} characters in length excluding spaces and wildcards."
			Text="*" ValidationGroup="Search" Display="None" KeywordRequired="true"></cb:SearchKeywordValidator>     
    </asp:Panel>
</div>
However, that only partially solves the problem. Search will work as long the keyword can be matched somewhere to the database. If there's no match, I get a StackTrace error:

Code: Select all

Server Error in '/store' Application.

Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index

Source Error: 

Line 161:        {
Line 162:            Trace.Write(this.GetType().ToString(), "Begin BindProductList");
Line 163:            ProductList.DataSource = ProductDataSource.AdvancedSearch(_patternKeywords, _categoryId, _manufacturerId, true, true, true, 0, 0, _pageSize, (_hiddenPageIndex * _pageSize), SortResults.SelectedValue);
Line 164:            ProductList.DataBind();
Line 165:            NoSearchResults.Visible = (_searchResultCount == 0);
Any idea what might be causing the problem?

User avatar
jmestep
AbleCommerce Angel
Posts: 8164
Joined: Sun Feb 29, 2004 8:04 pm
Location: Dayton, OH
Contact:

Re: Utility\SimpleSearch not working

Post by jmestep » Thu Oct 11, 2012 2:34 pm

We have a Gold R2 site in development and the search works there. I don't get an error if there are no results either.
Judy Estep
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx

User avatar
Logan Rhodehamel
Developer
Developer
Posts: 4116
Joined: Wed Dec 10, 2003 5:26 pm

Re: Utility\SimpleSearch not working

Post by Logan Rhodehamel » Thu Oct 11, 2012 4:12 pm

The second thing you mention about search having trouble if there are no matching items - I believe looks similar to another bug that was reported and will be fixed with our next update.
Cheers,
Logan
Image.com

If I do not respond to an unsolicited private message, it's not because I'm ignoring you. It's because the answer to your question is valuable to others. Try the new topic button.

Post Reply