Tag search not working

In this board you can talk about general questions about phpMyFAQ

Moderator: Thorsten

Post Reply
daryl.hurst
Posts: 12
Joined: Fri Aug 13, 2010 11:29 am

Tag search not working

Post by daryl.hurst »

I've installed version 2.6.7 and everything is working very well apart from tagging. I can add tags to FAQs and they appear in the tag cloud but when I click on a word in the tag cloud no search results are displayed - it says 'No FAQs available'.

Is there any specific configuration or setting that I need to set? There's no errors being thrown anywhere else (as far as I can tell) so I'm confused to what the problem could be. Is there a minimum threshold (e.g. number of tags) that needs to be met before the tag search works?
oldperl
Posts: 37
Joined: Sat Oct 28, 2006 3:03 pm
Location: Franken
Contact:

Re: Tag search not working

Post by oldperl »

daryl.hurst wrote:Is there any specific configuration or setting that I need to set?
No there isn't anything to configurate. It's simply a bug.

Going to line 67 in search.php, there is still a tag-handler building a html-resultset, but the variable $printResult, which is filled with an html-output of the result for that tag-id, isn't used anymore in the rest of the file. Seems the usage of the new class PMF_Helper_Search is the reason for that.

I don't really know what Thorsten wanna do with this new class, maybe it's a wrapper or something like that. So i can't give you a hint to fix this bug.

Regards Ortwin
Man muss nicht alles wissen,
man muss nur wissen wo es steht

** FAQ CMS Contenido (powered by phpMyFAQ) ** - ** Forum CMS Contenido ** - ** DCEonline ** - ** DevBlog **
daryl.hurst
Posts: 12
Joined: Fri Aug 13, 2010 11:29 am

Re: Tag search not working

Post by daryl.hurst »

Thanks Ortwin for such a quick response! :D

I'll maybe dig around the code you suggested and see if I can come up with what might be a possible fix.
oldperl
Posts: 37
Joined: Sat Oct 28, 2006 3:03 pm
Location: Franken
Contact:

Re: Tag search not working

Post by oldperl »

Hi daryl,

i have a dirty fix for you. Search for line 167 in search.php

Code: Select all

'printResult'              => $faqSearchHelper->renderSearchResult($faqSearchResult, $page),
and change it to

Code: Select all

    'printResult'              => (!empty($printResult))?$printResult:$faqSearchHelper->renderSearchResult($faqSearchResult, $page),
This is just "dirty" because tagresults don't use the new helperclass and therefor there is no pagination for the results.

Regards Ortwin
Man muss nicht alles wissen,
man muss nur wissen wo es steht

** FAQ CMS Contenido (powered by phpMyFAQ) ** - ** Forum CMS Contenido ** - ** DCEonline ** - ** DevBlog **
daryl.hurst
Posts: 12
Joined: Fri Aug 13, 2010 11:29 am

Re: Tag search not working

Post by daryl.hurst »

Ortwin, just tried your suggestion and it appears to work perfectly!

I take what you're saying regarding the pagination but I can live without that for now. I've only just come across phpMyFAQ but it's an excellent piece of software, I'll continue to try and understand the renderSearchResult class and why this didn't originally work.

Again thank you very much for your assistance, I can't believe I got a solution in the same day!
oldperl
Posts: 37
Joined: Sat Oct 28, 2006 3:03 pm
Location: Franken
Contact:

Re: Tag search not working

Post by oldperl »

Hi daryl,

your welcome. :-)
I'm glad if I could help you

Regards Ortwin
Man muss nicht alles wissen,
man muss nur wissen wo es steht

** FAQ CMS Contenido (powered by phpMyFAQ) ** - ** Forum CMS Contenido ** - ** DCEonline ** - ** DevBlog **
Thorsten
Posts: 15561
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Re: Tag search not working

Post by Thorsten »

HI,

here's the fix for it: http://github.com/thorsten/phpMyFAQ/com ... 21ff65e3da

We rewrote the whole search during the 2.6.6 and 2.6.7 development because the code was almost 8 years old and caused a lot of troubles the last months. Normally I don't do that big changes during maintainance releases. :-)

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
oldperl
Posts: 37
Joined: Sat Oct 28, 2006 3:03 pm
Location: Franken
Contact:

Re: Tag search not working

Post by oldperl »

Hi,

ok, also a way to fix it, little bit more code, but... pagination won't work. For tags because there is no use of it, for search because pagination isn't build in request-class.

But anyway, it's a great work you've done with phpMyFAQ at all. :-)

Regards Ortwin
Man muss nicht alles wissen,
man muss nur wissen wo es steht

** FAQ CMS Contenido (powered by phpMyFAQ) ** - ** Forum CMS Contenido ** - ** DCEonline ** - ** DevBlog **
Thorsten
Posts: 15561
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Re: Tag search not working

Post by Thorsten »

Hi,
oldperl wrote:ok, also a way to fix it, little bit more code, but... pagination won't work. For tags because there is no use of it, for search because pagination isn't build in request-class.
the tag stuff uses other code with "old" pagination code, not the new class. It's in PMF_Faq::showAllRecordsByIds()

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
daryl.hurst
Posts: 12
Joined: Fri Aug 13, 2010 11:29 am

Re: Tag search not working

Post by daryl.hurst »

Thorsten,

I just tried the changes you made which still allows the tag search to work correctly but the normal search now fails to return results.

Regards,

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

Re: Tag search not working

Post by Thorsten »

Hi,

do you get any error?

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
daryl.hurst
Posts: 12
Joined: Fri Aug 13, 2010 11:29 am

Re: Tag search not working

Post by daryl.hurst »

Thorsten,

No errors displayed - just no results when searching, I suspect it's the else clause that has been added to line 76 of search.php:

} else {
$printResult = '';
}

Also, it looks like the change made on line 173 of search.jsp i.e. 'printResult' => $printResult means $faqSearchResults is now not being used, I'm assuming $faqSearchResults is the main search results object when a non TAG search is performed e.g. instant/advanced search etc?

Regards,

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

Re: Tag search not working

Post by Thorsten »

Hi,

did you tried this fix: viewtopic.php?p=31297#p31297 ?

This has to fix your issue.

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
daryl.hurst
Posts: 12
Joined: Fri Aug 13, 2010 11:29 am

Re: Tag search not working

Post by daryl.hurst »

Thorsten,

Yes, I tried the fix which certainly fixes clicking on a tag in the tag cloud but causes the other searches to stop working.

I'll go back and check that I've applied the changes correctly if you're convinced the fix should work but so far the only way I can get both the tag cloud and searches to work is via the original suggestion from Ortwin.

Regards,

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

Re: Tag search not working

Post by Thorsten »

Hi,

okay, I'll review my fix again. :-)

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