Waspman
Posts: 948
|
Posted: 09/19/2014, 3:04 AM |
|
It's done in the advanced search function, but it seems you cant just add this to a page.
So I want to do a "contains any of the words in the string" search.
Is there a way to this?
_________________
http://www.waspmedia.co.uk |
|
|
Waspman
Posts: 948
|
Posted: 09/19/2014, 3:21 AM |
|
Just found this...
SELECT id, article FROM mytable WHERE MATCH(article) AGAINST ('+word1 +word2' IN BOOLEAN MODE)
does return result, but is very slow.
At the same time, another query
SELECT id, article FROM mytable WHERE MATCH(article) AGAINST ('+word1' IN BOOLEAN MODE) AND MATCH(article) AGAINST ('+word2' IN BOOLEAN MODE)
returns the same result, but could be 100 times faster...
So I'm looking at passing a string slicing it up and building the query.
What do you think?
_________________
http://www.waspmedia.co.uk |
|
|
Oper
Posts: 1195
|
Posted: 09/19/2014, 5:23 AM |
|
i will go with the 2nd
and sending the Full SQL during Before Build Select Event
_________________
____________________________
http://www.7bz.com (Free CMS,CRM Developed in CCS)
http://www.PremiumWebTemplate.com
Affiliation Web Site Templates
Please do backup first |
|
|
Waspman
Posts: 948
|
Posted: 09/19/2014, 7:37 AM |
|
OK, I've got it working. So the users adds "tags" to a search box and they're passed, sliced and rebuilt into the sql with each of the words an OR option.
Any Ideas how I can make the records that have more of the keywords appear closer to the top of the results?
:)
_________________
http://www.waspmedia.co.uk |
|
|
Oper
Posts: 1195
|
Posted: 09/22/2014, 5:25 AM |
|
Big table i will do nothing.
Small Table i will create a Temporary Relevance Counter.
How big are your table?
MySQL or MSSQL?
if MySQL, Version?
INNDODB or MyISAM?
_________________
____________________________
http://www.7bz.com (Free CMS,CRM Developed in CCS)
http://www.PremiumWebTemplate.com
Affiliation Web Site Templates
Please do backup first |
|
|
|