Search in unicode

This topic contains 9 replies, has 4 voices, and was last updated by  Stiofan O’Connor 8 years, 2 months ago.

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
  • Author
    Posts
  • #138080

    berniezhao
    Expired Member
    Post count: 16

    Hi,

    I’m having some issue with searching in chinese language. As to my understanding the search should work for both title and content. However I got very weird result.
    I have a post titled “中兴职业介绍所”. I can search by “中” or “中兴” but not “兴” or “职业”.
    Does it have something to do with DB collation?

    Thanks!

    #138081

    berniezhao
    Expired Member
    Post count: 16
    This reply has been marked as private.
    #138157

    Guust
    Moderator
    Post count: 29970

    I escalated your question for you.

    #138488

    Paolo
    Site Admin
    Post count: 31206

    Hi,

    our search won’t search the middle of words.

    Thanks

    #138521

    berniezhao
    Expired Member
    Post count: 16

    Thanks Paolo.
    That would be a problem for some languages that don’t have white spaces(like Asian). Because every character is actually a “word” and they are not separated by white spaces, the searching basically is useless this way.
    Can you tell me which php file has this feature maybe I can patch it myself until you have a solution?
    Thanks!

    #139120

    berniezhao
    Expired Member
    Post count: 16

    Just to add a note:
    The auto-complete in advanced search plugin actually works great. It can search my terms ok. Are they using different logic than the main searching?
    Thanks!

    #139138

    berniezhao
    Expired Member
    Post count: 16

    I checked the source code in

    listing_filters.php

    Line 725

    
    
    
    $better_search[] = " OR ( $wpdb->posts.post_title LIKE "$s_term" OR $wpdb->posts.post_title LIKE "$s_term%" OR $wpdb->posts.post_title LIKE "% $s_term%" ) ";
    

    Line 754

    
    
    
    $better_search_terms .= ' OR ( ' . $wpdb->posts . '.post_title LIKE "' . $keyword . '" OR ' . $wpdb->posts . '.post_title LIKE "' . $keyword . '%" OR ' . $wpdb->posts . '.post_title LIKE "% ' . $keyword . '%" )';
    

    Both places added a “space” after “%”. If I remove the space and make it same as advanced search autocomplete, then everything works fine.
    If this is by design can we at least make it a configuration?
    Great thanks!

    #139291

    Stiofan O’Connor
    Site Admin
    Post count: 22956

    Yes this is by design, do you want me to dd filters to these two lines so you can change that with a code snippet?

    Stiofan

    #140268

    berniezhao
    Expired Member
    Post count: 16

    Yes that would be great Stiofan!
    Thanks!

    #140919

    Stiofan O’Connor
    Site Admin
    Post count: 22956

    I added the filter, it will be in the next release.
    https://github.com/GeoDirectory/geodirectory/blob/master/geodirectory-functions/listing_filters.php#L746

    Thanks,

    Stiofan

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

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket