Forum Replies Created

Viewing 8 replies - 1 through 8 (of 8 total)
  • Ah okay. Kiitos. I will investigate if another plugin is interfering.

    Are you searching through the WP UI? All 3 variations return the same results when running a manual query to the DB but only “bjornoya project” returns results through the WP UI.

    I appreciate your time and attention.

    Encoding: UTF-8
    Collation: utf8mb4_unicode_520_ci

    for all tables

    These are the default settings we use on 99% of projects (btw).

    I’ve manually verified each of the 6 entries I would expect to return for the term “Bj?rn?ya project”. Each post has a custom field date_published and is of the post_type report.

    It hadn’t occurred to me to run this scenario before but I just tested the term “Bjornoya Project”, and this returns 6 results, mit? perkele? This result is the expected behaviour.

    This, to me, suggests that there’s some encoding problem going on.

    Running this query returns 12 rows, all correct –- each post ID is returned twice because there are actually two custom fields that contain “bj?rn?ya project”

    Here are all the queries from the relevanssi_search() Caller:

    73  SHOW FULL COLUMNS
    FROM <code>wp_relevanssi</code> 
    relevanssi_search()
    Plugin: relevanssi  19  0.0011
    
    74  SELECT COUNT(DISTINCT(relevanssi.doc))
    FROM wp_relevanssi AS relevanssi
    INNER JOIN wp_postmeta
    ON ( relevanssi.doc = wp_postmeta.post_id )
    WHERE relevanssi.term = 'bj?rn?ya'
    AND ( wp_postmeta.meta_key = 'date_published' )
    AND ( relevanssi.doc IN (
    SELECT DISTINCT(posts.ID)
    FROM wp_posts AS posts
    WHERE posts.post_type IN ('report') ) )
    AND ( (relevanssi.doc IN (SELECT ID
    FROM wp_posts
    WHERE (post_content LIKE '%bj?rn?ya project%'
    OR post_title LIKE '%bj?rn?ya project%' )
    AND post_status IN ('publish','draft','private','pending','future','inherit'))
    OR relevanssi.doc IN (SELECT ID
    FROM wp_posts as p, wp_term_relationships as r, wp_term_taxonomy as s, wp_terms as t
    WHERE r.term_taxonomy_id = s.term_taxonomy_id
    AND s.term_id = t.term_id
    AND p.ID = r.object_id
    AND s.taxonomy IN ('post_tag','reference_type')
    AND t.name LIKE '%bj?rn?ya project%'
    AND p.post_status IN ('publish','draft','private','pending','future','inherit'))
    OR relevanssi.doc IN (SELECT ID
    FROM wp_posts AS p, wp_postmeta AS m
    WHERE p.ID = m.post_id
    AND (m.meta_key NOT LIKE '\_%'
    OR m.meta_key = '_relevanssi_pdf_content')
    AND m.meta_value LIKE '%bj?rn?ya project%'
    AND p.post_status IN ('publish','draft','private','pending','future','inherit'))) ) 
    relevanssi_search()
    Plugin: relevanssi  1 0.0042
    
    75  SELECT COUNT(DISTINCT(relevanssi.doc))
    FROM wp_relevanssi AS relevanssi
    INNER JOIN wp_postmeta
    ON ( relevanssi.doc = wp_postmeta.post_id )
    WHERE relevanssi.term = 'project'
    AND ( wp_postmeta.meta_key = 'date_published' )
    AND ( relevanssi.doc IN (
    SELECT DISTINCT(posts.ID)
    FROM wp_posts AS posts
    WHERE posts.post_type IN ('report') ) )
    AND ( (relevanssi.doc IN (SELECT ID
    FROM wp_posts
    WHERE (post_content LIKE '%bj?rn?ya project%'
    OR post_title LIKE '%bj?rn?ya project%' )
    AND post_status IN ('publish','draft','private','pending','future','inherit'))
    OR relevanssi.doc IN (SELECT ID
    FROM wp_posts as p, wp_term_relationships as r, wp_term_taxonomy as s, wp_terms as t
    WHERE r.term_taxonomy_id = s.term_taxonomy_id
    AND s.term_id = t.term_id
    AND p.ID = r.object_id
    AND s.taxonomy IN ('post_tag','reference_type')
    AND t.name LIKE '%bj?rn?ya project%'
    AND p.post_status IN ('publish','draft','private','pending','future','inherit'))
    OR relevanssi.doc IN (SELECT ID
    FROM wp_posts AS p, wp_postmeta AS m
    WHERE p.ID = m.post_id
    AND (m.meta_key NOT LIKE '\_%'
    OR m.meta_key = '_relevanssi_pdf_content')
    AND m.meta_value LIKE '%bj?rn?ya project%'
    AND p.post_status IN ('publish','draft','private','pending','future','inherit'))) ) 
    relevanssi_search()
    Plugin: relevanssi  1 0.0869
    
    76  SELECT DISTINCT(relevanssi.doc), relevanssi.*, relevanssi.title * 5 + relevanssi.content * 1 + relevanssi.comment * 0.75 + relevanssi.tag * 1 + relevanssi.link * 0 + relevanssi.author + relevanssi.category * 1 + relevanssi.excerpt + relevanssi.taxonomy + relevanssi.customfield + relevanssi.mysqlcolumn AS tf
    FROM wp_relevanssi AS relevanssi
    INNER JOIN wp_postmeta
    ON ( relevanssi.doc = wp_postmeta.post_id )
    WHERE relevanssi.term = 'bj?rn?ya'
    AND ( wp_postmeta.meta_key = 'date_published' )
    AND ( relevanssi.doc IN (
    SELECT DISTINCT(posts.ID)
    FROM wp_posts AS posts
    WHERE posts.post_type IN ('report') ) )
    AND ( (relevanssi.doc IN (SELECT ID
    FROM wp_posts
    WHERE (post_content LIKE '%bj?rn?ya project%'
    OR post_title LIKE '%bj?rn?ya project%' )
    AND post_status IN ('publish','draft','private','pending','future','inherit'))
    OR relevanssi.doc IN (SELECT ID
    FROM wp_posts as p, wp_term_relationships as r, wp_term_taxonomy as s, wp_terms as t
    WHERE r.term_taxonomy_id = s.term_taxonomy_id
    AND s.term_id = t.term_id
    AND p.ID = r.object_id
    AND s.taxonomy IN ('post_tag','reference_type')
    AND t.name LIKE '%bj?rn?ya project%'
    AND p.post_status IN ('publish','draft','private','pending','future','inherit'))
    OR relevanssi.doc IN (SELECT ID
    FROM wp_posts AS p, wp_postmeta AS m
    WHERE p.ID = m.post_id
    AND (m.meta_key NOT LIKE '\_%'
    OR m.meta_key = '_relevanssi_pdf_content')
    AND m.meta_value LIKE '%bj?rn?ya project%'
    AND p.post_status IN ('publish','draft','private','pending','future','inherit'))) ) 
    relevanssi_search()
    Plugin: relevanssi  0 0.0050
    
    77  SELECT DISTINCT(relevanssi.doc), relevanssi.*, relevanssi.title * 5 + relevanssi.content * 1 + relevanssi.comment * 0.75 + relevanssi.tag * 1 + relevanssi.link * 0 + relevanssi.author + relevanssi.category * 1 + relevanssi.excerpt + relevanssi.taxonomy + relevanssi.customfield + relevanssi.mysqlcolumn AS tf
    FROM wp_relevanssi AS relevanssi
    INNER JOIN wp_postmeta
    ON ( relevanssi.doc = wp_postmeta.post_id )
    WHERE relevanssi.term = 'project'
    AND ( wp_postmeta.meta_key = 'date_published' )
    AND ( relevanssi.doc IN (
    SELECT DISTINCT(posts.ID)
    FROM wp_posts AS posts
    WHERE posts.post_type IN ('report') ) )
    AND ( (relevanssi.doc IN (SELECT ID
    FROM wp_posts
    WHERE (post_content LIKE '%bj?rn?ya project%'
    OR post_title LIKE '%bj?rn?ya project%' )
    AND post_status IN ('publish','draft','private','pending','future','inherit'))
    OR relevanssi.doc IN (SELECT ID
    FROM wp_posts as p, wp_term_relationships as r, wp_term_taxonomy as s, wp_terms as t
    WHERE r.term_taxonomy_id = s.term_taxonomy_id
    AND s.term_id = t.term_id
    AND p.ID = r.object_id
    AND s.taxonomy IN ('post_tag','reference_type')
    AND t.name LIKE '%bj?rn?ya project%'
    AND p.post_status IN ('publish','draft','private','pending','future','inherit'))
    OR relevanssi.doc IN (SELECT ID
    FROM wp_posts AS p, wp_postmeta AS m
    WHERE p.ID = m.post_id
    AND (m.meta_key NOT LIKE '\_%'
    OR m.meta_key = '_relevanssi_pdf_content')
    AND m.meta_value LIKE '%bj?rn?ya project%'
    AND p.post_status IN ('publish','draft','private','pending','future','inherit'))) ) 
    relevanssi_search()
    Plugin: relevanssi  0 0.0977

    Ah yes, that makes sense for the single-quoted search terms then.

    It’s the phrase search that isn’t making sense to me at the moment.

    I’ve checked the post_meta as well, this is one of the rows (though the data is stored the same way for all of them)

    INSERT INTOwp_postmeta(meta_id,post_id,meta_key,meta_value`)
    VALUES
    (151635, 7260, ‘project_imported’, ‘Bj?rn?ya Project’);`

    Terve Mikko,

    Carlos Eriksson here;

    I’m looking more into this issue and this is the setup:

    There are 6 posts that have an ACF custom field with Bj?rn?ya Project in the field. Additionally, the term Bj?rn?ya appears in 5 additional posts as part of the title.

    Set Relevanssi to index visible fields. Default to AND. Disable OR fallback. Match on whole words.

    When searching using the exact phrase, “Bj?rn?ya Project” it returns 0 results. I expect 6 results to return.

    When searching using the exact phrase, ‘Bj?rn?ya Project’ it returns 8 results. I expect 6 results to return.

    When searching using terms, Bj?rn?ya Project it returns 8 results. I expect 6 results to return (since I’ve disabled OR fallback)

    When searching using term, Bj?rn?ya it returns 11 results. This is expected.

    Example of how the data is stored in the DB:

    INSERT INTOwp_relevanssi(doc,term,term_reverse,content,title,comment,tag,link,author,category,excerpt,taxonomy,customfield,mysqlcolumn,taxonomy_detail,customfield_detail,mysqlcolumn_detail,type,item`)
    VALUES
    (7260, ‘bj?rn?ya’, ‘ay?nr?jb’, 1, 1, 0, 0, 0, 0, 0, 0, 0, 2, 0, ”, ”, ”, ‘post’, 0);`

    Have I set something up incorrectly, am I misunderstanding how the indexing works? I don’t understand why it returns 8 results.

    Terveisin,
    Carlos

Viewing 8 replies - 1 through 8 (of 8 total)