WordPress.org

Ready to get started?Download WordPress

Forums

Custom Field Taxonomies breaks search (8 posts)

  1. Morgaine
    Member
    Posted 5 years ago #

    As was mentioned before by someone on your blog back in March, this plugin breaks the normal search. I noticed my search wasn't working, but didn't know when exactly it stopped working. So I installed a brand new WordPress (2.8), in a different subdomain, using a brand new database. Everything worked. Then I added the plugins I am using on my regular blog, and search didn't work. Deactivated all, enabling them one by one, each time testing the search. When I enabled your plugin, search stopped working. To make sure it was due to your plugin, I deactivated all plugins but yours. Search still didn't work. I am using permalinks, with a structure of /archives/%year%/%monthnum%/%day%/%hour%.%minute%.%second%, a category base of archives/categories and a tag base of archives/tags. I'll test whether the problem remains, when using no pretty permalinks.

  2. moya-yeva
    Member
    Posted 4 years ago #

    Same problem. Don't now what to do. Plugin is so greate, but site without search becames just useless...
    Somebody, help!

  3. scribu
    Member
    Posted 4 years ago #

    I can't reproduce this problem.

    Please add this line to wp-config.php:

    define('CFT_DEBUG', true);

    Then, do a search and tell me the exact URL and what you see on the page.

  4. r-a-y
    Member
    Posted 4 years ago #

    I can reproduce the problem.

    No items are found when search is initiated.

    This gets appended to the [title] tag:
    : searchterm : 0; : 0; : 0

    What this means is:
    : s : catID : x : y

    Adding the define line doesn't change the URL or search results.

    URL is:
    hxxp://example.com/?s=searchterm&cat=0&x=0&y=0

    Deactivating CFT fixes the problem.

    ---

    One thing to note is I haven't defined any custom field taxonomies yet. Could that be the problem?

  5. scribu
    Member
    Posted 4 years ago #

    r-a-y, WP version & plugin version please.

    I've also tried search with no meta taxonomies defined and the search still works, using WordPress 2.9-beta-2.

    The standard search URL is http://example.com/?s=searchterm. Try that.

    The line in wp-config.php should output the query done in the footer. This only works if you have wp_footer() in footer.php in your theme.

  6. r-a-y
    Member
    Posted 4 years ago #

    WP version is 2.8.5 and CFT version is 1.4.
    I should note that I'm using WPMU 2.8.5.2.

    Standard search gives the same results.

    ---

    For the CFT_DEBUG statement, I see the debug statement in the footer now.

    Here is the debug log:

    SELECT SQL_CALC_FOUND_ROWS distinct wp_1_posts.*, COUNT(*) * 100 / 1 AS meta_rank
    FROM wp_1_posts  LEFT
    JOIN wp_1_term_relationships ON (wp_1_posts.ID = wp_1_term_relationships.object_id)  LEFT
    JOIN wp_1_term_taxonomy ON wp_1_term_taxonomy.term_taxonomy_id = wp_1_term_relationships.term_taxonomy_id
    JOIN wp_1_postmeta ON (wp_1_posts.ID = wp_1_postmeta.post_id)
    WHERE 1=1
    AND (((wp_1_posts.post_title LIKE '%searchterm%') OR (wp_1_posts.post_content LIKE '%searchterm%')))
    AND (wp_1_posts.post_password = '')
    AND wp_1_posts.post_type != 'revision'
    AND (wp_1_posts.post_status = 'publish')
    AND NOT EXISTS (SELECT *
    FROM wp_1_term_relationships
    JOIN wp_1_term_taxonomy ON wp_1_term_taxonomy.term_taxonomy_id = wp_1_term_relationships.term_taxonomy_id
    WHERE wp_1_term_relationships.object_id = wp_1_posts.ID
    AND wp_1_term_taxonomy.taxonomy = 'category'
    AND wp_1_term_taxonomy.term_id IN (72,1) )
    AND CASE meta_key
    	WHEN 's' THEN meta_value = 'searchterm'
    END
    GROUP BY wp_1_posts.ID HAVING COUNT(*) > 0
    ORDER BY meta_rank DESC, wp_1_posts.post_date DESC
    LIMIT 0, 10
  7. scribu
    Member
    Posted 4 years ago #

    Here's the culprit:

    AND CASE meta_key
    	WHEN 's' THEN meta_value = 'searchterm'
    END

    This was added by CFT for some reason. Hm...

    Please install the Development Version (1.5a) to make sure we're on the same page.

  8. r-a-y
    Member
    Posted 4 years ago #

    Thumbs up, scribu!

    v1.5a fixes the problem.

Topic Closed

This topic has been closed to new replies.

About this Topic