Page 1 of 1
Search returning all items
Posted: Sun Feb 22, 2009 3:09 pm
by dadkind
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
Re: Search returning all items
Posted: Mon Feb 23, 2009 7:20 am
by mazhar
Re: Search returning all items
Posted: Mon Feb 23, 2009 9:27 am
by mazhar
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.
Re: Search returning all items
Posted: Tue Feb 24, 2009 11:37 am
by sohaib
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
Re: Search returning all items
Posted: Tue Feb 24, 2009 11:44 am
by dadkind
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
Re: Search returning all items
Posted: Fri Mar 06, 2009 11:22 pm
by dadkind
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
Re: Search returning all items
Posted: Fri Apr 17, 2009 3:07 am
by industry
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?
Re: Search returning all items
Posted: Fri Apr 17, 2009 6:16 am
by jmestep
This is working OK on two sites that were upgrades to 7.0.2 upgrade with the search in the left nav.
Re: Search returning all items
Posted: Tue Apr 21, 2009 7:36 am
by industry
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");
}
}
Re: Search returning all items
Posted: Tue Apr 21, 2009 8:04 am
by mazhar
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
from scriptlet just mark it as hidden like
Code: Select all
[[ConLib:CategorySearchSidebar Visible="false"]]
Re: Search returning all items
Posted: Tue Apr 21, 2009 8:33 am
by industry
Thank you, that works
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
Re: Search returning all items
Posted: Tue Apr 21, 2009 8:39 am
by mazhar
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);
Re: Search returning all items
Posted: Mon Apr 27, 2009 7:10 am
by igavemybest
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?
Re: Search returning all items
Posted: Tue May 12, 2009 4:15 pm
by sdlong02
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.