Search all keywords instead of any

For general questions and discussions specific to the AbleCommerce 7.0 Asp.Net product.
Post Reply
seanhoward
Ensign (ENS)
Ensign (ENS)
Posts: 17
Joined: Fri Oct 02, 2009 3:01 pm

Search all keywords instead of any

Post by seanhoward » Thu Dec 10, 2009 5:25 pm

I desperately need to change the simple and advanced search functions on the customer side to match "all" the keywords provided instead of just "any" of them. I also need (only a little less deperately so) the search function on the merchant side to search the "search keywords" field. Please don't make me beg...

OK, now I'm begging.

Sean

User avatar
AbleMods
Master Yoda
Master Yoda
Posts: 5170
Joined: Wed Sep 26, 2007 5:47 am
Location: Fort Myers, Florida USA

Re: Search all keywords instead of any

Post by AbleMods » Fri Dec 11, 2009 11:17 am

Welcome to my world...search blows right now

Only way around it (assuming the latest CommerceBuilder DLL) on the visitor side is to enclose the search keywords with quotation marks. I'm about ready to just force them so the search works as expected in multi-word search phrases.
Joe Payne
AbleCommerce Custom Programming and Modules http://www.AbleMods.com/
AbleCommerce Hosting http://www.AbleModsHosting.com/
Precise Fishing and Hunting Time Tables http://www.Solunar.com

seanhoward
Ensign (ENS)
Ensign (ENS)
Posts: 17
Joined: Fri Oct 02, 2009 3:01 pm

Re: Search all keywords instead of any

Post by seanhoward » Fri Dec 11, 2009 1:34 pm

Hey, thanks Joe! I didn't realize the simple search worked that way. However, that doesn't solve my problem, because...

Right now the search is

FTSCatalog Like Keyword1 Or FTSCatalog Like Keyword2 Or FTSCatalog Like Keyword(N)

And I'd like it to be

FTSCatalog Like Keyword1 And FTSCatalog Like Keyword2 And FTSCatalog Like Keyword(N)

Joe's solution forces the search crit to be

FTSCatalog Like Keyword(Original Whole String).

I know its more complicated than that, and I'd fix it myself, but it's built into the CommerceBuilder class, and I don't have the source. My question to the Devs is: do I need the source? If so, I'll buy it. Is it possible to fix this, or do I really have to build my own search? If so, I'll make it, but I have to get an answer so I can get started!!!


Sean

seanhoward
Ensign (ENS)
Ensign (ENS)
Posts: 17
Joined: Fri Oct 02, 2009 3:01 pm

Re: Search all keywords instead of any

Post by seanhoward » Fri Dec 11, 2009 2:32 pm

Update:

This is (almost) EXACTLY what I want:

SELECT * FROM dbo.ac_Products WHERE CONTAINS(*, '"Keyword1"') AND CONTAINS (*,'"Keyword2*"') AND CONTAINS (*,'"Keyword(n)*"')

Specifically NOT this:

SELECT * FROM dbo.ac_Products WHERE CONTAINS(*, '"Keyword1" AND "Keyword2" AND "Keyword(n)"')

The difference? All keywords must be found in all individual colums in the second example. All keywords must be found in all collective columns in the first example, which is really what I need.

Take the search "1957 Dodge"
On the row:
Title,SearchKeywords
"1954-1966 Dodge U.S. Parts Interchange Manual", "1955,1956,1957"

The first search will return this row because "Dodge" is found in the first column and "1957" is found in the second. The second search will not find this row because it is looking for "1957" AND "Dodge" to be in both columns.

I'm formulating a workaround for the advanced search replacing the SelectMethod and SelectCountMethod calls-by-property with my own SQL. Stay tuned.

seanhoward
Ensign (ENS)
Ensign (ENS)
Posts: 17
Joined: Fri Oct 02, 2009 3:01 pm

Re: Search all keywords instead of any

Post by seanhoward » Sat Dec 12, 2009 5:25 pm

Ok. I figured it out on my own. It is possible to insert your own search logic into the search pages and have AC display the results. it took me about 13 hours to refactor the Search control but I spent most of that formulating and refining my query against the FTS Catalog. The above code is essentially similar to the code I implemented in my search algo. Good luck! You can do it!!!

Post Reply