• Resolved arcadia1850

    (@iadicicco1850)


    Hi, I’m looking for the sql code in which the products are selected through by_text extension.

    I’m trying to add the code to do something similar to this:

    'title_or_content_or_excerpt_or_tag' => 'Search by title OR content OR excerpt OR tag',

    I want that the search by_text select also the products that have similar tags
    So i made a sql query, whit the where like yours from here:

    
    case 'title_or_content_or_excerpt':
    $text_where .= "  (( LOWER(post_title) REGEXP '{$woof_text}') OR ( LOWER(post_excerpt) REGEXP '{$woof_text}') OR ( LOWER(post_content) REGEXP '{$woof_text}'))";
    break;
    

    The sql query is this:
    (it works just fine)

    
    SELECT p.*
    FROM efr_posts AS p
    JOIN efr_term_relationships AS tr ON p.id = tr.object_id
    JOIN efr_term_taxonomy AS tt ON tr.term_taxonomy_id = tt.term_taxonomy_id
    JOIN efr_terms AS t ON tt.term_id = t.term_id
    WHERE t.slug LIKE '%text%' OR (( LOWER(post_title) REGEXP '[[:<:]]text[[:>:]]') OR ( LOWER(post_excerpt) REGEXP '[[:<:]]text[[:>:]]') OR ( LOWER(post_content) REGEXP '[[:<:]]text[[:>:]]')) AND p.post_type LIKE 'product'
    

    Where can i add this 3 line?

    
    JOIN efr_term_relationships AS tr ON p.id = tr.object_id
    JOIN efr_term_taxonomy AS tt ON tr.term_taxonomy_id = tt.term_taxonomy_id
    JOIN efr_terms AS t ON tt.term_id = t.term_id
    

    The where part is here:

    
    case 'title_or_content_or_excerpt_or_tag':
    $text_where .= "  (( LOWER(post_title) REGEXP '{$woof_text}') OR ( LOWER(post_excerpt) REGEXP '{$woof_text}') OR ( LOWER(post_content) REGEXP '{$woof_text}'))";
    break;
    

    Any suggestion?
    Thanks!

    • This topic was modified 4 years, 7 months ago by arcadia1850.

    The page I need help with: [log in to see the link]

Viewing 9 replies - 1 through 9 (of 9 total)
Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Adding tag name taxonomy in the search by text’ is closed to new replies.