Search for numbers

In this board you can talk about general questions about phpMyFAQ

Moderator: Thorsten

Post Reply
tschwinn12
Posts: 3
Joined: Mon Jan 23, 2012 4:50 pm

Search for numbers

Post by tschwinn12 »

Searching for numbers doesn't seem to work or maybe it that is normal?

I have an entry of 29304 and 7.0.29304 in same faq article. Also 29304 in faq topic.

If I do a search for 29304 nothing comes up. If I do a search for 7.0.29304 it works.

is there a way to make it search numbers better?
Thorsten
Posts: 15560
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Re: Search for numbers

Post by Thorsten »

Hi,

if you search for numbers phpMyFAQ searches for the solution IDs. Every FAQ has an own unique solution ID.

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
tschwinn12
Posts: 3
Joined: Mon Jan 23, 2012 4:50 pm

Re: Search for numbers

Post by tschwinn12 »

So no option at all to also search the articles for numbers? any plug-ins available or anything at all to change?

thank you for responding.
Thorsten
Posts: 15560
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Re: Search for numbers

Post by Thorsten »

Hi,

not yet, but could be done. Please add your feature request here: https://github.com/thorsten/phpMyFAQ/issues

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
legija
Posts: 2
Joined: Thu Apr 26, 2012 3:03 pm

Re: Search for numbers

Post by legija »

Hi,
Got same problem, please is there any solution to patch this while waiting for an update ?
If I understood it well, numeric searches are redirected to solution id field, can we just disable this, and let it search in content field ?

edit:
Solved with this patch:

Code: Select all

if (is_numeric($inputSearchTerm) && PMF_SOLUTION_ID_START_VALUE <= $inputSearchTerm && 
    1 < $faqSearchResult->getNumberOfResults()) {
    
    // Before a redirection we must force the PHP session update for preventing data loss
    session_write_close();
    if (PMF_Configuration::getInstance()->get('main.enableRewriteRules')) {
        header('Location: '.PMF_Link::getSystemUri('/index.php') . '/content' . $inputSearchTerm . '.html');
    } else {
        header('Location: '.PMF_Link::getSystemUri('/index.php') . '/index.php?content=' . $inputSearchTerm);
    }
    exit();
}
Everything works perfectly now :)
Sectomy
Posts: 16
Joined: Wed Oct 26, 2011 8:13 pm

Re: Search for numbers

Post by Sectomy »

doesnt work for me, any ideas ?
tried it as u written, but nothing changes :(
legija
Posts: 2
Joined: Thu Apr 26, 2012 3:03 pm

Re: Search for numbers

Post by legija »

Sectomy wrote:doesnt work for me, any ideas ?
tried it as u written, but nothing changes :(
It wont work if You use only numeric term in search box. For me it worked, since I use it for error codes description, hence for example, "error code 0x25" gives accurate result, plus numeric term also gets highlighted.
But, if You enter only number, nothing will be returned. This is why I've told it's a patch.

Basically, above posted patch redirects numeric term search into content field in faqdata table, and not the solution_id field.
jarlaxle2k5
Posts: 4
Joined: Mon Sep 24, 2012 9:29 am

Re: Search for numbers

Post by jarlaxle2k5 »

legija wrote:Hi,
Got same problem, please is there any solution to patch this while waiting for an update ?
If I understood it well, numeric searches are redirected to solution id field, can we just disable this, and let it search in content field ?

edit:
Solved with this patch:

Code: Select all

if (is_numeric($inputSearchTerm) && PMF_SOLUTION_ID_START_VALUE <= $inputSearchTerm && 
    1 < $faqSearchResult->getNumberOfResults()) {
    
    // Before a redirection we must force the PHP session update for preventing data loss
    session_write_close();
    if (PMF_Configuration::getInstance()->get('main.enableRewriteRules')) {
        header('Location: '.PMF_Link::getSystemUri('/index.php') . '/content' . $inputSearchTerm . '.html');
    } else {
        header('Location: '.PMF_Link::getSystemUri('/index.php') . '/index.php?content=' . $inputSearchTerm);
    }
    exit();
}
Everything works perfectly now :)
Hello guys, i am new on the forum.
I have just a quick question, where should i add this code? In which file ?
Thank you so much for the help.
ixuacu
Posts: 4
Joined: Wed Jan 22, 2014 12:15 pm

Re: Search for numbers

Post by ixuacu »

Hi there,

I´ve tried the patch solution from legija without luck (change done on the search.php file). Any update on that issue? We´re documenting several issues by error number and so on we´re unable to search for them using the error number at all.

I´ve opened as well a change request in github just in case.

Kind Regards,
Joaquín
Thorsten
Posts: 15560
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Re: Search for numbers

Post by Thorsten »

Hi,

we'll fix that via Github issue, thanks for that.

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