Search breaking

For general questions and discussions specific to the AbleCommerce GOLD ASP.Net shopping cart software.
Post Reply
KenPalmer
Lieutenant (LT)
Lieutenant (LT)
Posts: 54
Joined: Fri Sep 21, 2012 9:50 am

Search breaking

Post by KenPalmer » Thu Oct 18, 2012 10:38 am

I've published AbleCommerce Gold R2 (7.0.8.4487) to a development server. I'm testing this instance, and most of the site appears to work. But, when I select the "Product Finder" link from the home page, the Search.aspx page displays the following error.
=============
Server Error in '/' 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:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:
[ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index]
System.Collections.ArrayList.get_Item(Int32 index) +14161105
System.Collections.SyncArrayList.get_Item(Int32 index) +188
Lucene.Net.Search.Hits.HitDoc(Int32 n) +76
Lucene.Net.Search.Hits.Doc(Int32 n) +18
NHibernate.Search.Engine.DocumentExtractor.Extract(Hits hits, Int32 index) +40
NHibernate.Search.Query.FullTextQueryImpl.List(IList list) +463
NHibernate.Search.Query.FullTextQueryImpl.List() +399
CommerceBuilder.Products.ProductRepository.AdvancedSearch(String keyword, Int32 categoryId, Int32 manufacturerId, Boolean searchName, Boolean searchDescription, Boolean searchSKU, Decimal lowPrice, Decimal highPrice, Boolean onlyFeatured, String sortExpression, Int32 maximumRows, Int32 startRowIndex) +211
CommerceBuilder.Products.ProductRepository.AdvancedSearch(String keyword, Int32 categoryId, Int32 manufacturerId, Boolean searchName, Boolean searchDescription, Boolean searchSKU, Decimal lowPrice, Decimal highPrice, String sortExpression, Int32 maximumRows, Int32 startRowIndex) +177
CommerceBuilder.Products.ProductDataSource.AdvancedSearch(String keyword, Int32 categoryId, Int32 manufacturerId, Boolean searchName, Boolean searchDescription, Boolean searchSKU, Decimal lowPrice, Decimal highPrice, Int32 maximumRows, Int32 startRowIndex, String sortExpression) +201
AbleCommerce.Search.BindProductList() +423
AbleCommerce.Search.BindSearchResultsPanel() +182
AbleCommerce.Search.Page_Load(Object sender, EventArgs e) +1805
System.EventHandler.Invoke(Object sender, EventArgs e) +0
System.Web.UI.Control.LoadRecursive() +71
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3178

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.17929

=============

The Search.aspx page works without breaking when I run the site from localhost.

The AdvancedSearch.aspx page also has a problem in the development environment. It doesn't break, but it fails to return products when I search for them. If I search for products on localhost (my workstation) then it returns products.

These instances (localhost and development) point to the same development database. The development site displays the products, though I had to manually copy the images from the Assets/ProductImages folder to the development server. All of the products were loaded locally on my workstation via the admin interface.

Do I need to assign some special permissions to AbleCommerce on that server, or is there some file or files that I need to copy to that server? Thanks for your help.

KenPalmer
Lieutenant (LT)
Lieutenant (LT)
Posts: 54
Joined: Fri Sep 21, 2012 9:50 am

Re: Search breaking

Post by KenPalmer » Thu Oct 18, 2012 11:09 am

Additionally, when I select a link from the "Categories" list on the home page, the targeted category page doesn't display any related products. This behavior occurs in the development environment. Categories works properly on localhost.

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

Re: Search breaking

Post by Logan Rhodehamel » Thu Oct 18, 2012 12:00 pm

Well I think there are two things happening.

First I think you need to rebuild your indexes on the published site. From Website > Indexes menu. That will solve most of your symptoms I believe.

Secondly, there is a confirmed bug in the product finder when the search returns no products. That has been corrected and we are in the final stages of making an update release that will fix known issues.
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.

KenPalmer
Lieutenant (LT)
Lieutenant (LT)
Posts: 54
Joined: Fri Sep 21, 2012 9:50 am

Re: Search breaking

Post by KenPalmer » Thu Oct 18, 2012 12:06 pm

Thanks for the quick response Logan! I'll rebuild the indexes and will let you know the results.

KenPalmer
Lieutenant (LT)
Lieutenant (LT)
Posts: 54
Joined: Fri Sep 21, 2012 9:50 am

Re: Search breaking

Post by KenPalmer » Thu Oct 18, 2012 12:20 pm

Logan, your advice fixed all of the problems that I reported earlier in this thread. I logged into the Merchant Dashboard, and selected Website > Indexes > Rebuild Index. That fixed all of the search problems.

There are 2 more minor issues that I noticed.
1. The message that shows when the search index was last rebuilt did not update. It still shows 9/24/2012. I logged out and exited the app, then went back into it. And that message still did not change. That's minor.
2. When first accessing the log-in page, the Captcha number image is not displayed. I can get it to show up by entering my username and password. This is for the general "Login" page for the site (i.e. http://root/Login.aspx). The merchant login page doesn't appear to have this problem (i.e. http://root/Admin/Login.aspx).

Thanks again for your help.

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

Re: Search breaking

Post by Logan Rhodehamel » Thu Oct 18, 2012 12:38 pm

KenPalmer wrote:1. The message that shows when the search index was last rebuilt did not update. It still shows 9/24/2012. I logged out and exited the app, then went back into it. And that message still did not change. That's minor.
It will be updated the next time the application restarts. The date is held in an in-memory cache that doesn't recognize the update has taken place. This is another problem we fixed.
KenPalmer wrote:2. When first accessing the log-in page, the Captcha number image is not displayed. I can get it to show up by entering my username and password. This is for the general "Login" page for the site (i.e. http://root/Login.aspx). The merchant login page doesn't appear to have this problem (i.e. http://root/Admin/Login.aspx).
The general login page is geared at customers rather than admin users and so it will only show captcha by default if you have it turned on for non-admin users. If you do have this turned on and it's not showing, it's a bug. Otherwise this behavior is intentional - when we recognize that you are an admin user trying to use the customer login we respect the merchant password policy and display captcha if needed.
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.

KenPalmer
Lieutenant (LT)
Lieutenant (LT)
Posts: 54
Joined: Fri Sep 21, 2012 9:50 am

Re: Search breaking

Post by KenPalmer » Thu Oct 18, 2012 4:25 pm

Thanks for both explanations Logan. Regarding the re-indexing, is that something I'll need to do periodically? What types of activities would trigger the need for me to re-index the site?

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

Re: Search breaking

Post by Logan Rhodehamel » Fri Oct 19, 2012 1:23 pm

Reindexing would typically be required if you move the install from one server to another, or if you add / remove items from your database outside of using our application. Under normal operation reindexing wouldn't be required. So for example if you add or modify a product from our administration panel the index is updated incrementally.
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.

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

Re: Search breaking

Post by jmestep » Sat Oct 20, 2012 8:37 am

Ken, I watched the indexing files as I was editing products and every time I saved a product, the date changed on some of the files and if I did a search for the product I had added or edited, it turned up in the search right away after I saved the product.
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

rlopez
Lieutenant Commander (LCDR)
Lieutenant Commander (LCDR)
Posts: 96
Joined: Mon Mar 15, 2004 1:08 pm
Contact:

Re: Search breaking

Post by rlopez » Wed Nov 28, 2012 1:35 am

I just found this as a problem as well. When typing a single P/N or word in the search it is returning ok results. However, if we type a (word and double space) the search breaks here is the error below. I'm running Dev version R2 4808. This is a huge issue and when live customer won't understand not to use spaces between words when searching. Iv'e been searching the forums but have not seen anyone else with this problem. If there is a fix please help.




Server Error in '/' Application.
--------------------------------------------------------------------------------

'*' or '?' not allowed as first character in WildcardQuery
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: Lucene.Net.QueryParsers.ParseException: '*' or '?' not allowed as first character in WildcardQuery

Source Error:


Line 34: {
Line 35: _hiddenPageIndex = AlwaysConvert.ToInt(HiddenPageIndex.Value);
Line 36: _searchResultCount = ProductDataSource.AdvancedSearchCount(_patternKeywords, _categoryId, _manufacturerId, true, true, true, 0, 0, SortResults.SelectedValue.StartsWith("IsFeatured"));
Line 37: _lastPageIndex = ((int)Math.Ceiling(((double)_searchResultCount / (double)_pageSize))) - 1;
Line 38: if (_lastPageIndex < 0) _lastPageIndex = 0;


Source File: c:\inetpub\wwwroot\Boatingsolutionsgold\Search.aspx.cs Line: 36

Stack Trace:


[ParseException: '*' or '?' not allowed as first character in WildcardQuery]
Lucene.Net.QueryParsers.QueryParser.GetWildcardQuery(String field, String termStr) +422
Lucene.Net.QueryParsers.QueryParser.Term(String field) +633
Lucene.Net.QueryParsers.QueryParser.Clause(String field) +283
Lucene.Net.QueryParsers.QueryParser.Query(String field) +79
Lucene.Net.QueryParsers.QueryParser.Clause(String field) +319
Lucene.Net.QueryParsers.QueryParser.Query(String field) +215
Lucene.Net.QueryParsers.QueryParser.Parse(String query) +138

[ParseException: Cannot parse 'StoreId:1 AND VisibilityId:[000 TO 000] AND (Name:mercury* OR Summary:mercury* OR Description:mercury* OR ExtendedDescription:mercury* OR Sku:mercury* OR ModelNumber:mercury* OR MetaKeywords:mercury*) AND (Name:* OR Summary:* OR Description:* OR ExtendedDescription:* OR Sku:* OR ModelNumber:* OR MetaKeywords:*) AND (Name:pistons* OR Summary:pistons* OR Description:pistons* OR ExtendedDescription:pistons* OR Sku:pistons* OR ModelNumber:pistons* OR MetaKeywords:pistons*)': '*' or '?' not allowed as first character in WildcardQuery]
Lucene.Net.QueryParsers.QueryParser.Parse(String query) +343
CommerceBuilder.Products.ProductRepository.a(String A_0, Int32 A_1, Int32 A_2, Boolean A_3, Boolean A_4, Boolean A_5, Decimal A_6, Decimal A_7, Boolean A_8, String A_9, Int32 A_10, Int32 A_11) +3035
CommerceBuilder.Products.ProductRepository.AdvancedSearchCount(String keyword, Int32 categoryId, Int32 manufacturerId, Boolean searchName, Boolean searchDescription, Boolean searchSKU, Decimal lowPrice, Decimal highPrice, Boolean onlyFeatured) +182
CommerceBuilder.Products.ProductDataSource.AdvancedSearchCount(String keyword, Int32 categoryId, Int32 manufacturerId, Boolean searchName, Boolean searchDescription, Boolean searchSKU, Decimal lowPrice, Decimal highPrice, Boolean onlyFeatured) +175
AbleCommerce.Search.InitializePagingVars(Boolean forceRefresh) in c:\inetpub\wwwroot\Boatingsolutionsgold\Search.aspx.cs:36
AbleCommerce.Search.BindSearchResultsPanel() in c:\inetpub\wwwroot\Boatingsolutionsgold\Search.aspx.cs:125
AbleCommerce.Search.Page_Load(Object sender, EventArgs e) in c:\inetpub\wwwroot\Boatingsolutionsgold\Search.aspx.cs:106
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +25
System.EventHandler.Invoke(Object sender, EventArgs e) +0
System.Web.UI.Control.LoadRecursive() +71
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3064




--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.272
Rick L.
https://www.boatingsolutions.com
We make boat repair easy!

User avatar
david-ebt
Captain (CAPT)
Captain (CAPT)
Posts: 253
Joined: Fri Dec 31, 2010 10:12 am

Re: Search breaking

Post by david-ebt » Wed Nov 28, 2012 9:33 am

rlopez,

One thing you can do is put a try/catch around the searches. This will catch this problem and any other lingering search issues so at least they don't throw an error to your users. They'll just return no search results. That seems like a small step forward.

Change the InitializePagingVars and BindProductList functions to:

Code: Select all

private void InitializePagingVars(bool forceRefresh)
{
    Trace.Write(this.GetType().ToString(), "Begin InitializePagingVars");
    if (!_pagingVarsInitialized || forceRefresh)
    {
        _hiddenPageIndex = AlwaysConvert.ToInt(HiddenPageIndex.Value);

        try
        {
            _searchResultCount = ProductDataSource.AdvancedSearchCount(_patternKeywords, _categoryId, _manufacturerId, true, true, true, 0, 0,
                    SortResults.SelectedValue.StartsWith("IsFeatured"));
        }
        catch 
        {
            _searchResultCount = 0;
        }
        _lastPageIndex = ((int)Math.Ceiling(((double)_searchResultCount / (double)_pageSize))) - 1;
        if (_lastPageIndex < 0) _lastPageIndex = 0;
        if (_hiddenPageIndex > _lastPageIndex) _hiddenPageIndex = _lastPageIndex;
        _pagingVarsInitialized = true;
    }
    Trace.Write(this.GetType().ToString(), "End InitializePagingVars");
}

Code: Select all

protected void BindProductList()
{
    Trace.Write(this.GetType().ToString(), "Begin BindProductList");
    try
    {
        ProductList.DataSource = ProductDataSource.AdvancedSearch(_patternKeywords, _categoryId, _manufacturerId, true, true, true, 0, 0, _pageSize, 
                    (_hiddenPageIndex * _pageSize), SortResults.SelectedValue);
    }
    catch 
    {
        ProductList.DataSource = null;
    }
    ProductList.DataBind();
    NoSearchResults.Visible = (_searchResultCount == 0);
    int minimumPageSize = AlwaysConvert.ToInt(PageSizeOptions.Items[0].Value);
    int totalResults;

    try
    {
        totalResults = ProductDataSource.AdvancedSearchCount(_patternKeywords, _categoryId, _manufacturerId, true, true, true, 0, 0);
    }
    catch
    {
        totalResults = 0;
    }
    PageSizePanel.Visible = totalResults > minimumPageSize;
    Trace.Write(this.GetType().ToString(), "End BindProductList");
}
David
http://www.ecombuildertoday.com
Enhanced Reporting for AbleCommerce
Image

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

Re: Search breaking

Post by Logan Rhodehamel » Wed Nov 28, 2012 11:06 am

I am fairly certain the search issue was corrected in the service patch for R2. There was a news feed announcement about it IIRC. See here:
http://help.ablecommerce.com/upgrades/a ... h_gold.htm
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.

User avatar
david-ebt
Captain (CAPT)
Captain (CAPT)
Posts: 253
Joined: Fri Dec 31, 2010 10:12 am

Re: Search breaking

Post by david-ebt » Wed Nov 28, 2012 11:14 am

The problem noted by rlopez does occur with R2. It occurs if you put two spaces between your search terms, like "hello[space][space]there".
David
http://www.ecombuildertoday.com
Enhanced Reporting for AbleCommerce
Image

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

Re: Search breaking

Post by Logan Rhodehamel » Wed Nov 28, 2012 12:00 pm

Even after the service pack is applied?

Edit: R2 is build 4487. R2SP1 is build 4808. If you are running R2 build 4808 (you can check the admin footer) and still seeing this problem that will be important to get reported.
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.

rlopez
Lieutenant Commander (LCDR)
Lieutenant Commander (LCDR)
Posts: 96
Joined: Mon Mar 15, 2004 1:08 pm
Contact:

Re: Search breaking

Post by rlopez » Wed Nov 28, 2012 1:50 pm

I should have been more clear. When I upgraded to R2 4487 I did not catch this problem. After applying the patch which is the upgrade to R2SP1 build 4808 this is when i recognised this problem while testing. So all software is up to date at this time. I will report this as a Bug.
Rick L.
https://www.boatingsolutions.com
We make boat repair easy!

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

Re: Search breaking

Post by jmestep » Thu Nov 29, 2012 7:33 am

Logan, you might also want to check on double plus signs in search. I had to patch an Able 7 site that had links coming in from a paid search that ended up with double plus signs. It might have been double spaces converting to double plus signs, though. I just put a replace around the search phrase because we can expect the source code to handle every weird thing a customer might put in.
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

Post Reply