Search returning all items

For general questions and discussions specific to the AbleCommerce 7.0 Asp.Net product.
Post Reply
dadkind
Lieutenant Commander (LCDR)
Lieutenant Commander (LCDR)
Posts: 105
Joined: Thu Jan 22, 2009 3:32 pm

Search returning all items

Post by dadkind » Sun Feb 22, 2009 3:09 pm

Hello All,

I have a SimpleSearch control in the header of my site pages.

If I enter a phrase (e.g. "knife") the control redirects me to "~/Search.aspx?k=knife".

But I see all the items in my database ("Displaying items 1-15 of 600").

The "Narrow or Expand" results sidebar seems to be correct in that the proper categories (containing knives) are listed and the proper product count is shown.

Clicking on an item in the Narrow or Expand box brings up the proper limited list of "knives".

How do I get the SearchPage to render the proper (reduced) list of items on initial load?

Thanks,
-tomas

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: Search returning all items

Post by mazhar » Mon Feb 23, 2009 7:20 am

It may be helpful
viewtopic.php?f=42&t=7690

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: Search returning all items

Post by mazhar » Mon Feb 23, 2009 9:27 am

Here is a workaround to run the CategorySearchSidebar from ConLib/Custom folder properly. I have attached the Modified files. Once you move the CategorySearchSidebar to CobLib/Custom folder you need to adjust its class name from ConLib_CategorySearchSidebar to ConLib_Custom_CategorySearchSidebar in both
ascx and cs files. I have attached the ConLib/Custom files in attachment so you can check them to adjust you version of custom folder.

You need to install the attached files in same order in which they are in attachment means the ICategorySearchSidebar.cs will go to App_Code and SearchPage.ascx and SearchPage.ascx.cs will go in ConLib/Custom folder. In fact SearchPage.ascx.cs file is modified so it should also go to the custom folder. You can then make use both search page and side bar from custom folder.

User avatar
sohaib
Developer
Developer
Posts: 1079
Joined: Fri Jan 23, 2004 1:38 am

Re: Search returning all items

Post by sohaib » Tue Feb 24, 2009 11:37 am

Note that this has already been fixed in 7.0.2.
It is always good to upgrade to latest version.
There are a lot of other fixes and improvements
http://help.ablecommerce.com/upgrades/a ... _7.0.2.htm

dadkind
Lieutenant Commander (LCDR)
Lieutenant Commander (LCDR)
Posts: 105
Joined: Thu Jan 22, 2009 3:32 pm

Re: Search returning all items

Post by dadkind » Tue Feb 24, 2009 11:44 am

We are running 7.0.2 already.

I'm re-installing the updates to make sure I didn't miss a step.

Hopefully that will fix it.

Thanks,
-tomas

sohaib wrote:Note that this has already been fixed in 7.0.2.
It is always good to upgrade to latest version.
There are a lot of other fixes and improvements
http://help.ablecommerce.com/upgrades/a ... _7.0.2.htm

dadkind
Lieutenant Commander (LCDR)
Lieutenant Commander (LCDR)
Posts: 105
Joined: Thu Jan 22, 2009 3:32 pm

Re: Search returning all items

Post by dadkind » Fri Mar 06, 2009 11:22 pm

OK. I have verified that we are running 7.0.2
We still have the problem.
1. We have a SimpleSearch control on the Header of the page.
2. If I enter "book" in the box, I am redirected to "~/search.aspx?k=book" and all my products are returned.
3. The "CategorySearch" right panel correctly displays the proper product count. and If I click the links there, the proper number of products are displayed in the search results panel.

Any suggestion on what else could be wrong? 7.0.2 doesn't seem to be the fix.

-tomas
sohaib wrote:Note that this has already been fixed in 7.0.2.
It is always good to upgrade to latest version.
There are a lot of other fixes and improvements
http://help.ablecommerce.com/upgrades/a ... _7.0.2.htm

industry
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 37
Joined: Fri Apr 03, 2009 4:17 am

Re: Search returning all items

Post by industry » Fri Apr 17, 2009 3:07 am

We're having the same problem

We only want a simply search in the left hand nav, but whenever you type something in it returns all items :?:

Any ideas?

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

Re: Search returning all items

Post by jmestep » Fri Apr 17, 2009 6:16 am

This is working OK on two sites that were upgrades to 7.0.2 upgrade with the search in the left nav.
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

industry
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 37
Joined: Fri Apr 03, 2009 4:17 am

Re: Search returning all items

Post by industry » Tue Apr 21, 2009 7:36 am

industry wrote:We're having the same problem

We only want a simply search in the left hand nav, but whenever you type something in it returns all items :?:

Any ideas?
Anyone got any ideas? - im upgraded to 7.0.2 but still anything entered into the simplesearch returns ALL items

Here is the ascx.cs code - anything wrong here?

Code: Select all

using System;
using CommerceBuilder.Utility;

public partial class ConLib_SimpleSearch : System.Web.UI.UserControl
{
    protected void Page_Init()
    {
        string handleEnterScript = "if(event.which || event.keyCode){if ((event.which == 13) || (event.keyCode == 13)) {document.getElementById('"
            + SearchButton.UniqueID + "').click();return false;}} else {return true}; ";

        SearchPhrase.Attributes.Add("onkeydown", handleEnterScript);
    }

    protected void SearchButton_Click(object sender, EventArgs e)
    {
        string safeSearchPhrase = StringHelper.StripHtml(SearchPhrase.Text);
        if (!string.IsNullOrEmpty(safeSearchPhrase))
            Response.Redirect("~/Search.aspx?k=" + Server.UrlEncode(safeSearchPhrase));
        Response.Redirect("~/Search.aspx");
    }
}

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: Search returning all items

Post by mazhar » Tue Apr 21, 2009 8:04 am

industry wrote:
industry wrote:We're having the same problem

We only want a simply search in the left hand nav, but whenever you type something in it returns all items :?:

Any ideas?
Anyone got any ideas? - im upgraded to 7.0.2 but still anything entered into the simplesearch returns ALL items

Here is the ascx.cs code - anything wrong here?

Code: Select all

using System;
using CommerceBuilder.Utility;

public partial class ConLib_SimpleSearch : System.Web.UI.UserControl
{
    protected void Page_Init()
    {
        string handleEnterScript = "if(event.which || event.keyCode){if ((event.which == 13) || (event.keyCode == 13)) {document.getElementById('"
            + SearchButton.UniqueID + "').click();return false;}} else {return true}; ";

        SearchPhrase.Attributes.Add("onkeydown", handleEnterScript);
    }

    protected void SearchButton_Click(object sender, EventArgs e)
    {
        string safeSearchPhrase = StringHelper.StripHtml(SearchPhrase.Text);
        if (!string.IsNullOrEmpty(safeSearchPhrase))
            Response.Redirect("~/Search.aspx?k=" + Server.UrlEncode(safeSearchPhrase));
        Response.Redirect("~/Search.aspx");
    }
}
I think there seems to be something wrong with search page showing search results. How did you customized the search page it self. Did you hide the CategorySearchSidebar? I guess search page lsits all products if it doesn't found CategorySearchSidebar available on page. Try following fix instead of removing

Code: Select all

[[ConLib:CategorySearchSidebar]]
from scriptlet just mark it as hidden like

Code: Select all

[[ConLib:CategorySearchSidebar Visible="false"]]

industry
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 37
Joined: Fri Apr 03, 2009 4:17 am

Re: Search returning all items

Post by industry » Tue Apr 21, 2009 8:33 am

Thank you, that works :D

As an follow on from this though, is it possible to use the simplesearch to search on the full description as well as the product title, as currently it only searches on title

Regards,
Ian

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: Search returning all items

Post by mazhar » Tue Apr 21, 2009 8:39 am

Hmm try following trick I think it will work. Edit ConLib/SearchPage.ascx.cs file and locate following line of code in it

Code: Select all

ProductList.DataSource = ProductDataSource.NarrowSearch(_Keywords, this.CategoryId, _ManufacturerId, 0, 0, _PageSize, (_HiddenPageIndex * _PageSize), SortResults.SelectedValue);
and make it look like

Code: Select all

//ProductList.DataSource = ProductDataSource.NarrowSearch(_Keywords, this.CategoryId, _ManufacturerId, 0, 0, _PageSize, (_HiddenPageIndex * _PageSize), SortResults.SelectedValue);
        ProductList.DataSource = ProductDataSource.AdvancedSearch(_Keywords, this.CategoryId, _ManufacturerId, true, true, true, 0, 0, _PageSize, (_HiddenPageIndex * _PageSize), SortResults.SelectedValue);

User avatar
igavemybest
Captain (CAPT)
Captain (CAPT)
Posts: 388
Joined: Sun Apr 06, 2008 5:47 pm

Re: Search returning all items

Post by igavemybest » Mon Apr 27, 2009 7:10 am

Since the page just sits there, and the user thinks the search didnt work (they just dont know it is in the process because it takes a second), does anyone have a solution as to easily add the AC7 modal popup with the thinking timer until the search results page loads?

sdlong02
Lieutenant Commander (LCDR)
Lieutenant Commander (LCDR)
Posts: 95
Joined: Mon Jan 19, 2009 2:33 pm

Re: Search returning all items

Post by sdlong02 » Tue May 12, 2009 4:15 pm

mazhar wrote:Hmm try following trick I think it will work. Edit ConLib/SearchPage.ascx.cs file and locate following line of code in it

Code: Select all

ProductList.DataSource = ProductDataSource.NarrowSearch(_Keywords, this.CategoryId, _ManufacturerId, 0, 0, _PageSize, (_HiddenPageIndex * _PageSize), SortResults.SelectedValue);
and make it look like

Code: Select all

//ProductList.DataSource = ProductDataSource.NarrowSearch(_Keywords, this.CategoryId, _ManufacturerId, 0, 0, _PageSize, (_HiddenPageIndex * _PageSize), SortResults.SelectedValue);
        ProductList.DataSource = ProductDataSource.AdvancedSearch(_Keywords, this.CategoryId, _ManufacturerId, true, true, true, 0, 0, _PageSize, (_HiddenPageIndex * _PageSize), SortResults.SelectedValue);
Mazhar, I went ahead and tried to implement this code in my SearchPage.ascx.cs exactly as you stated

Code: Select all

//ProductList.DataSource = ProductDataSource.NarrowSearch(_Keywords, this.CategoryId, _ManufacturerId, 0, 0, _PageSize, (_HiddenPageIndex * _PageSize), SortResults.SelectedValue);
        ProductList.DataSource = ProductDataSource.AdvancedSearch(_Keywords, this.CategoryId, _ManufacturerId, true, true, true, 0, 0, _PageSize, (_HiddenPageIndex * _PageSize), SortResults.SelectedValue);
but there's something peculiar about the search results that appear from this. I haven't really been able to pinpoint exactly where the search is looking, but sometimes it'll pick up random text from products I don't mean to find. And usually only when I use single words.

When I look at the page, I can usually find a term matching the search in the description, leading me to believe it's working, however when I try to be more exact with text in a description, for example instead of "game" I use "video game" (both are in the description) then the search finds nothing, whereas just "game" finds the product.

Also, the exact text in the description is "... video games", but searching "game" works and "games" does not.

Post Reply