How to enable multiple keywords search

Helpdesk for my helpdesk software

Moderator: mkoch227

Post Reply
deserteagle369
Posts: 94
Joined: Wed Feb 29, 2012 2:00 am

How to enable multiple keywords search

Post by deserteagle369 »

Script URL:
Version of script:
Hosting company:
URL of phpinfo.php:
URL of session_test.php:
What terms did you try when SEARCHING for a solution:

Write your message below:
If more than one keywords is input in "Ask a question:", no result will return unless those two keywords are conjunction, that's mean if you search in kb with a article has "php scripts support system" in subject or content, then with the keywords "php support" seperate with space nothing return, "php scripts" will return one result.

I think it's better to enable more than one keywords search, at least two, those keywords can seperate with space or connect with "+" or "and".
Eagle
Life is a journey.
Klemen
Site Admin
Posts: 10145
Joined: Fri Feb 11, 2005 4:04 pm

Re: How to enable multiple keywords search

Post by Klemen »

Add more articles to the knowledgebase and it should work better, because of the way how mysql fulltext search works (it ignores keywords under 4 chars and ignores keywords found in 50% of entries).
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
deserteagle369
Posts: 94
Joined: Wed Feb 29, 2012 2:00 am

Re: How to enable multiple keywords search

Post by deserteagle369 »

I think it's not the number of articles, I have more than 3000 articles in kb.

If two keywords seperate by space, there should be some code to handle the space like below:

Code: Select all

$arr=preg_split('/[\s,]+/',$query);
then do the query like this
SELECT * from hesk_kb_articles WHERE condition1 and condition2
Eagle
Life is a journey.
Klemen
Site Admin
Posts: 10145
Joined: Fri Feb 11, 2005 4:04 pm

Re: How to enable multiple keywords search

Post by Klemen »

If you do it like this you well either get even worse results or increase database load a lot if you add % around keywords.

Like said, fulltext search isn't perfect, but it works fine for most of the time. If you have problems with keyword "support" it's probably because it is included in too many articles. "PHP" would be ignored by the search because it is too short (unless you edit your MySQL configuration options to include shorter words).
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
deserteagle369
Posts: 94
Joined: Wed Feb 29, 2012 2:00 am

Re: How to enable multiple keywords search

Post by deserteagle369 »

sorry for confusion, my exaple is not good because "php" is less than 4 letters and "support" is too common.

My point is fullext of mysql can't work on Simple Chinese(also Japaness and Korea) because there is no space between the word like that in english, so mysql can not seperate the word to index in fulltext.

I try to find a way to work out for Simple Chinese, my plan is like this:

1. use fulltext in kb suggestion when user type in, because fulltext work in number and english, it will show some results;

2. use multiple keyword search in kb search when press "enter", if user input Simple Chinese, no suggestion article will show, but user press "enter" to start search, some article will show up.
Eagle
Life is a journey.
Post Reply