Returning search results for hyphenated words

In this board you can talk about general questions about phpMyFAQ

Moderator: Thorsten

Post Reply
alanb
Posts: 5
Joined: Fri Nov 04, 2011 4:20 pm

Returning search results for hyphenated words

Post by alanb »

Forgive me if this has been covered before, I have searched but found nothing.

I have items in PHPMyFaq V.2.7.0 which have hyphenated names e.g.Pro-4.

The database is MySQL and I understand that MySQL treats hyphens as delimiters and so is not returning any results. I also understand that there are ways around this so if anyone can suggest a workaround I would be very grateful.

Thanks

Alan
JochenS
Posts: 121
Joined: Wed Feb 16, 2011 3:51 pm
Location: Schönaich
Contact:

Re: Returning search results for hyphenated words

Post by JochenS »

Hi Alan,
I my public installation (see my footer) the hyphen works like it should. MySQL only use it, if there is a blank in front of it. You can search for kombi-3-plus.

Is the term Pro-4 a single word? If not, you need to use wildcards like Pro-4*.

Another workaround could be, to put the search term in double quotes "Pro-4"
Our public FAQ is proudly powered by phpMyFAQ: http://vhtfaq.ge51.honeywell.de/
alanb
Posts: 5
Joined: Fri Nov 04, 2011 4:20 pm

Re: Returning search results for hyphenated words

Post by alanb »

Hi Jochen

Thanks for the reply. Unfortunately, using "" does not produce any results.

I have installed version 2.6.19 and it returns searches for hyphens or 3 letters perfectly. I have installed both V2.7.0 and V2.6.19 on 3 separate sites to compare search results, each version using it's own discreet database.

In each case, V2.6.19 will return a search on 3 charachters and/or hyphenated words (e.g pro or pro-4) correctly (even highlighting the search charachters in the result) whereas V2.7.0 returns no results at all.

At this stage, it looks as though I will have to step back to V2.6.19 although that may give me some cosmetic headaches.

Assuming I do this, is it feasible to backup existing data created by V2.7 and re-import it to V2.6 (except for the admin and user data) which I can do with Navicat? The table structure looks the same but I would like to be sure.

Many thanks for your help

Alan
jason102178
Posts: 200
Joined: Tue Nov 02, 2010 9:08 am
Location: United States-Ohio
Contact:

Re: Returning search results for hyphenated words

Post by jason102178 »

Hi alanb,

Just wanted to let you know that in version 2.7 you can not search for only 3 letters it has to be a minimum of 4 letters.
phpMyFAQ Quality Assurance / Forum Moderator
Amazon.com Wishlist
JochenS
Posts: 121
Joined: Wed Feb 16, 2011 3:51 pm
Location: Schönaich
Contact:

Re: Returning search results for hyphenated words

Post by JochenS »

Hi Alan,
which browser are you using?
When you look on the "HTML source code" in the browser (with right click), how does your search term looks like? Could you post this one?

What are results searching in phpMyAdmin?

Code: Select all

SELECT faqdata.id AS id, faqdata.lang AS lang, faqdata.solution_id AS solution_id, faqcategoryrelations.category_id AS category_id, faqdata.thema AS question, faqdata.content AS answer FROM faqdata LEFT JOIN faqcategoryrelations ON faqdata.id = faqcategoryrelations.record_id AND faqdata.lang = faqcategoryrelations.record_lang WHERE MATCH (faqdata.thema, faqdata.content, faqdata.keywords) AGAINST ('"Pro-4"' IN BOOLEAN MODE) AND faqdata.lang = 'en' AND faqdata.active = 'yes'

Have you seen this one: viewtopic.php?f=2&t=12433&p=35304

I couldn't believe that somebody likes the 2.6 search better :?: The very last chance before you downgrade to 2.6 you could exchange the /inc/PMFsearch folder...

Jochen
Our public FAQ is proudly powered by phpMyFAQ: http://vhtfaq.ge51.honeywell.de/
alanb
Posts: 5
Joined: Fri Nov 04, 2011 4:20 pm

Re: Returning search results for hyphenated words

Post by alanb »

Hi Jochen

First, Thanks for taking so much trouble - I really do appreciate it.

As for browsers. I personally have tried in Firefox, I.E. Safari and Opera. Most of the visitors to the site use Firefox. Results are the same in that a search containing 2 letters or more is returned by V2.6 but not by V2.7. Odd.

As for threads regarding altering MySql.ini to allow 3 letter Full Text Searches. Yes, I have read that and others which also suggest that a line in the ini file which sets a hyphen charachter as a delimiter can also be commented out. Whilst I don't have access to the ini file, I would have to go through the hosting company, the fact that 2.6 will return records from a 2 charachter search leads me to think that there is no need to go down this route.

I ran the query you included in your last post in Navicat directly on the database. Here is the result:

Code: Select all

[SQL] SELECT faq_faqdata.id AS id, faq_faqdata.lang AS lang, faq_faqdata.solution_id AS solution_id, faq_faqcategoryrelations.category_id AS category_id, faq_faqdata.thema AS question, faq_faqdata.content AS answer FROM faq_faqdata LEFT JOIN faq_faqcategoryrelations ON faq_faqdata.id = faq_faqcategoryrelations.record_id AND faq_faqdata.lang = faq_faqcategoryrelations.record_lang WHERE MATCH (faq_faqdata.thema, faq_faqdata.content, faq_faqdata.keywords) AGAINST ('"Pro-4"' IN BOOLEAN MODE) AND faq_faqdata.lang = 'en' AND faq_faqdata.active = 'yes'

Affected rows: 0
Time: 0.032ms
I have also copied and replaced the /inc/PMF_Search folder from 2.6 install to the 2.7 install. No change I'm afraid.

As for do I prefer 2.6? Not really as I prefer the look and functionality of 2.7 but I can't get past the fact that 2.7 isn't returning searches for 3 letters (which solves the hyphenation problem) where 2.6 is returning searches on 2 letters and above. I can't think of any reason why this should be as I cannot imagine that any of the search functionality would have been changed. It seems to be a real mystery.

Hope to hear from you again.

Best wishes

Alan
JochenS
Posts: 121
Joined: Wed Feb 16, 2011 3:51 pm
Location: Schönaich
Contact:

Re: Returning search results for hyphenated words

Post by JochenS »

Hmm,

I am at the end of my knowledge... What I am writing applies to the "advanced search", I am not sure about the "Instant response"

1.) Browser: Using firefox is OK. The question was how the quotes are translated in the browser. But if the direct MySQL test has no results, this is not the issue.
2.) MySQL query. Is the query faulty. Have you tried other search terms?
3.) There is a fallback search implemented. If there is no result from the boolean search a standard search is executed. This should work for one search term
4.) If coping the old search doesn't help, it is also not a MySQL query issue.

I have a couple of new questions:
Which MySQL connection do you use? (screenshot of dashboard)
Where is your searchterm included? Question, Answer, keywords ... (tags are not considered)
Have you seen this one http://www.phpmyfaq.de/documentation.2.7.en.php#2e?
Does it help to change the search relevance settings?
Please copy the 2.7.1 Could you go back to the /inc/PMF_Search, change the line 100 to

Code: Select all

 if (0 == $this->dbHandle->num_rows($this->resultSet)) {
Does this help?

Perhaps Thorsten help us, if he is back from holiday.
Our public FAQ is proudly powered by phpMyFAQ: http://vhtfaq.ge51.honeywell.de/
alanb
Posts: 5
Joined: Fri Nov 04, 2011 4:20 pm

Re: Returning search results for hyphenated words

Post by alanb »

Hi Jochen

Genius :P

Yes, on changing the code in PMF_Search/Databse/MySql.php at line 100, the problem seems to be solved. V2.7 is now responding to 2 letter and more searches.

I will do some more extensive testing later but thank you so much for this. I hope that it has been useful to you also in terms of a possible bug fix.

Being slightly cheeky, one feature of the search results in V2.6 I did like was the highlighted search terms within the result set which doesn't happen (at least not for me) in 2.7. Any chance of a return of this feature as I believe that users often find it helpful when looking for the one result they wish to find.

If I do encounter any further issues I'll post again.

Thanks again

Alan
JochenS
Posts: 121
Joined: Wed Feb 16, 2011 3:51 pm
Location: Schönaich
Contact:

Re: Returning search results for hyphenated words

Post by JochenS »

Hi Alan,

thanks. I've entered a entry in github for this.
https://github.com/thorsten/phpMyFAQ/issues/338
Being slightly cheeky, one feature of the search results in V2.6 I did like was the highlighted search terms within the result set which doesn't happen (at least not for me) in 2.7. Any chance of a return of this feature as I believe that users often find it helpful when looking for the one result they wish to find.
I have seen this also on my installation but, haven't the chance to dig deeper into.
https://github.com/thorsten/phpMyFAQ/issues/339
Our public FAQ is proudly powered by phpMyFAQ: http://vhtfaq.ge51.honeywell.de/
alanb
Posts: 5
Joined: Fri Nov 04, 2011 4:20 pm

Re: Returning search results for hyphenated words

Post by alanb »

Hi Jochens

What do you mean "One guy fixed this"? It was you who fixed it my friend, I only did as I was asked.

Hope it helps others as this is a really good faq package. Thanks to all of you who put it together and make it available.

Regards the highlighting, would you be good enough to let me know if you do find a fix for that?

Best wishes

Alan
Thorsten
Posts: 15561
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Re: Returning search results for hyphenated words

Post by Thorsten »

Hi,

I think the highlighting got lost in the 2.7 releases, sorry for that. I'll check it.

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
Thorsten
Posts: 15561
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Re: Returning search results for hyphenated words

Post by Thorsten »

Hi,

the highlighting is fixed with https://github.com/thorsten/phpMyFAQ/co ... 8faf3af481

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
Post Reply