Important Notice from AspDotNetStorefront
It is with dismay that we report that we have been forced, through the action of hackers, to shut off write-access to this forum. We are keen to leave the wealth of material available to you for research. We have opened a new forum from which our community of users can seek help, support and advice from us and from each other. To post a new question to our community, please visit: http://forums.vortx.com
Results 1 to 10 of 10

Thread: Searching

  1. #1
    chrismartz is offline Senior Member
    Join Date
    Apr 2010
    Posts
    339

    Default Searching

    When I do a search for a SKU and search for an item such as "B-5054", I am not able to search. It always asks me to enter more than 3 characters. I changed the minimum search length to a 1 and it still says I don't have the minimum search characters. Why doesn't the search like the "-"?

  2. #2
    AspDotNetStorefront Staff - Scott's Avatar
    AspDotNetStorefront Staff - Scott is offline Administrator
    Join Date
    Mar 2007
    Location
    Ashland, OR
    Posts
    2,390

    Default

    We use a regular expression for validating the search term entered, that allows 0-9, a-z, A-Z, and the space char. Anything else will cause that to break unless the string before the offending character is more than the minimum search length.

    If you have the source, you can change that regex. That's in the AspDotNetStorefrontControls project, in Search.cs - line 399.

  3. #3
    chrismartz is offline Senior Member
    Join Date
    Apr 2010
    Posts
    339

    Default

    Thanks Scott! For those wondering, here is what I change my regular expression to be:

    Code:
    [0-9a-zA-Z  -]
    By default it is just "[0-9a-zA-Z ]" so I added the - in there so we can search by our sku's which contain a -.

  4. #4
    chrismartz is offline Senior Member
    Join Date
    Apr 2010
    Posts
    339

    Default

    Is there any problem with allowing single and double quotes in this search box? The reason I ask is because of sql injections and I'm wanting to make sure you handle those elsewhere before I allow single quotes.

  5. #5
    AspDotNetStorefront Staff - Scott's Avatar
    AspDotNetStorefront Staff - Scott is offline Administrator
    Join Date
    Mar 2007
    Location
    Ashland, OR
    Posts
    2,390

    Default

    Nothing is written to the database during search and I don't see anything in the sproc that could be at risk from something like this so you would probably be ok, but I think I would probably skip that just to be on the safe side if it were my store.

  6. #6
    chrismartz is offline Senior Member
    Join Date
    Apr 2010
    Posts
    339

    Default

    I noticed that the advanced search allows the apostrophe by default. Should I add code to escape the single quotes or should I be ok? The problem is that some of our products have an apostrophe in their name and if I put it in the search (e.g. Elmer's) I am told that the search needs to be longer than 1 character.

  7. #7
    AspDotNetStorefront Staff - Scott's Avatar
    AspDotNetStorefront Staff - Scott is offline Administrator
    Join Date
    Mar 2007
    Location
    Ashland, OR
    Posts
    2,390

    Default

    I think you'll be ok allowing apostrophes.

  8. #8
    ahaid is offline Junior Member
    Join Date
    Jan 2009
    Posts
    24

    Default

    Quote Originally Posted by chrismartz View Post
    Thanks Scott! For those wondering, here is what I change my regular expression to be:

    Code:
    [0-9a-zA-Z  -]
    By default it is just "[0-9a-zA-Z ]" so I added the - in there so we can search by our sku's which contain a -.
    Thank you for providing this. It was very helpful!

    ASPDNSF - you should make this a stringresource so ppl don't have to have the source code to alter it.

  9. #9
    PowerProducts is offline Member
    Join Date
    Oct 2010
    Location
    Spokane, WA
    Posts
    40

    Default

    I am trying to find the folder described above.
    I run a multi store and i could not find AspDotNetStorefrontControls project



    the only file that fit the term "aspdotnetstorefrontcontrols" was a dll file. Do we need to decompile it and then edit and then recompile?

    I also looked for in Search.cs thinking it was a file, but i could not find that either.

  10. #10
    gilligan is offline Junior Member
    Join Date
    Oct 2010
    Posts
    25

    Default Do we have to keep asking for a fix for the search engine?