test
Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • hcharly Friend
    #160121

    Hello,

    I noticed the following error developing at localhost. I checked at your demo site and the result is the same.
    I’m using J.1.5.22 and JaBoard 1.5:

    Search Job form
    Find keywords: test will find 3 jobs with any “Job must match” option.
    Find keywords: secretary will find 2 jobs with any “Job must match” option.
    As far it’s normal.

    Trying to search combining boths keyword -> test secretary | test, secretary will return 0 found whatever the “Job Must Match” option is.

    May someone give it a look.
    In advance thanks.
    -Charles

    Nick R JA JobBoard
    #376465

    Hi There,

    I tried it as well, demo and on my site – Error confirmed
    I guess some of the dev’s will take a look at this.

    Cheers
    Nick

    Vinh CV Friend
    #376557

    <em>@hcharly 221153 wrote:</em><blockquote>Hello,

    I noticed the following error developing at localhost. I checked at your demo site and the result is the same.
    I’m using J.1.5.22 and JaBoard 1.5:

    Search Job form
    Find keywords: test will find 3 jobs with any “Job must match” option.
    Find keywords: secretary will find 2 jobs with any “Job must match” option.
    As far it’s normal.

    Trying to search combining boths keyword -> test secretary | test, secretary will return 0 found whatever the “Job Must Match” option is.

    May someone give it a look.
    In advance thanks.
    -Charles</blockquote>

    Dear hcharly,

    What’s the JaJobBoard version you are using?

    With JAJobboard 1.5.0, to fix the problem, please extract and replace attach file to the file: SITE/componentscom_jajobboardhelperjafunctions.class.php
    11210

    hcharly Friend
    #376641

    OK Guys,

    After some investigations in the code, I made the following changes that works for me.
    This may be a good provisory fix for those who need it.
    Here’s how I fixed it:

    You need to edit jafunctions.class.php (components / com_jajobboard / helper / jafunctions.class.php).

    1-Find this function JB_Build_where
    Near the end of this function find the code
    [PHP]$subwhere [] .= ” (a.$field->field_name LIKE ” . $db->Quote ( ‘%’ . $db->getEscaped ( $search, true ) . ‘%’, false ) . “)”;[/PHP] and replace it by this one [PHP]$title_keyword = standardize_keyword($search);
    foreach ($title_keyword as $search_keyword) {
    $subwhere [] .= ” (a.$field->field_name LIKE ” . $db->Quote ( ‘%’ . $db->getEscaped ( $search_keyword, true ) . ‘%’, false ) . “)”;
    }[/PHP]

    Doing so filtering with multiple keywords will work.
    But there some other minor fixes such as – user may not select keyword option / user may search with quotes as within google / user may use comma separeted keywords.

    To better handle such cases, I brought a slight modification to the function standardize_keyword (in the same file near line 2354).
    Here’s my code after edit. The code before changes are in Green for those who need to compare:


    $keyword = trim ( $keyword );
    /* Begin FIX : filter options
    if (substr ( $keyword, 0, 1 ) == '"' && substr ( $keyword, count ( $keyword ) - 2, 1 ) == '"')
    $keyword = str_ireplace ( '" ', '"+', $keyword );
    */
    $check_keyword_option = JRequest::getVar ( 'keyword_option' );
    if ($keyword) {
    if ( (!is_null($check_keyword_option) && $check_keyword_option == '3') && (substr ( $keyword, 0, 1 ) != '"')) {
    $keyword = '"' . $keyword . '"'; // phrase search as keyword_option is selected and is '3'
    }

    }

    if (substr ( $keyword, 0, 1 ) == '"' && substr ( $keyword, count ( $keyword ) - 2, 1 ) == '"') {
    $keyword = str_ireplace ( '" ', '"+', $keyword );
    } else {
    $keyword = str_replace(',','+', $keyword); // this is to accept comma as a keyword seperator as used in other part of JA Board.
    }
    /* End FIX: filter options */

    $keyword = explode ( "+", $keyword );

    // FIX: filter options. After a comma user may insert extra space(s). Let's clean those spaces from values.
    foreach ($keyword as &$keyvalue) {
    $keyvalue = trim($keyvalue);
    }

    $temp_keyword = array ();

    If you don’t need to compare, just copy the code above and replace the one below with it (7 first lines of the standardize_keyword’s function ):

    $keyword = trim ( $keyword );
    if (substr ( $keyword, 0, 1 ) == '"' && substr ( $keyword, count ( $keyword ) - 2, 1 ) == '"')
    $keyword = str_ireplace ( '" ', '"+', $keyword );

    $keyword = explode ( "+", $keyword );

    $temp_keyword = array ();

    That’s all.
    Hope this helps.
    -Charles

    sharpdome Friend
    #376871

    Does the file that Vinh posted earlier fix the problem?

    Vinh CV Friend
    #376885

    Thanks hcharly for your post.

    For more complext keywords( with character: +, ‘, ” ), you should using hcharly changes or Google search, it will be better.

    hcharly Friend
    #376908

    <em>@sharpdome 221715 wrote:</em><blockquote>Does the file that Vinh posted earlier fix the problem?</blockquote>

    When I posted “my provisory fix” there was no answer from Vinhcv.
    I’ll test and implement his fix as the official one.

    Regards.
    -Charles

    hcharly Friend
    #376930

    <em>@sharpdome 221715 wrote:</em><blockquote>Does the file that Vinh posted earlier fix the problem?</blockquote>

    Yes I confirm. The problem is fixed by this file.
    It has even other fixes.

    -Charles

    hcharly Friend
    #376932

    Thanks Vinhcv,
    This fix the problem.

    -Charles

    Nick R JA JobBoard
    #376972

    Great, thanks for feedback.

Viewing 10 posts - 1 through 10 (of 10 total)

This topic contains 10 replies, has 4 voices, and was last updated by  Nick R 13 years, 10 months ago.

We moved to new unified forum. Please post all new support queries in our New Forum