Viewing 15 replies - 1 through 15 (of 16 total)
  • Plugin Author Ajay

    (@ajay)

    In the settings page, can you try selecting to match only for the title, i.e. deselect the option to match with content?

    You can also try this addon which limits the posts to the current categories: https://www.ads-software.com/plugins/crp-taxonomy/

    • This reply was modified 7 years, 3 months ago by Ajay.
    Thread Starter BitEdge

    (@whatwhatwhatwhat)

    > deselect the option to match with content?

    That does change the results but matching on the title alone gives bad results which are not what we want. Changing that setting back gets us back to the same handful of irrelevant repeating results.

    > limits the posts to the current categories

    That is not what we want.

    One thing I notice about the results that keep repeating is that they are long pieces of content…

    Plugin Author Ajay

    (@ajay)

    I noticed that too in terms of the length of content which is why I recommended deselecting the content. Do you have an estimate as to the average word length of your posts across the board?

    You can potentially reduce the matched content by setting this constant CRP_MAX_WORDS in your wp-config.php

    https://github.com/WebberZone/contextual-related-posts/blob/master/contextual-related-posts.php#L76

    This is by default at 500 but you might want to try a smaller text to match.

    With the addon you can also limit to tags not just categories. That’s also an option. Worst case option is to enter the post IDs in the exclude if it’s too much of an issue.

    • This reply was modified 7 years, 3 months ago by Ajay.
    Thread Starter BitEdge

    (@whatwhatwhatwhat)

    > Do you have an estimate as to the average word length of your posts across the board?

    500 words ??

    I am not sure if I did it right but I tried adding

    define(‘CRP_MAX_WORDS’, 200);

    to the bottom of the wp-config file. It did not help. Is that supposed to make the plugin only evaluate the first 200 words of a posts/pages content?

    > enter the post IDs in the exclude

    Won’t they just be replaced by another bunch of unrelated posts/pages that keep getting listed over and over again for an unknow reason?

    Plugin Author Ajay

    (@ajay)

    Yes. It evaluates only the first 200. Did you clear the plugin cache?

    The main reason as you noted above for unrelated is the volume of content which ends up being related. The title usually is the best bet in these cases as the search terms in that case are relatively less. But, you’ve tested that are not happy with the results.

    Another more complicated option with the available construct would be to rewrite the clause to weight the post title and post content in the clause

    Thread Starter BitEdge

    (@whatwhatwhatwhat)

    > Did you clear the plugin cache?

    Yes, all caches

    > The main reason as you noted above for unrelated is the volume of content which ends up being related

    I am not sure about that, I have noticed the same problem on my other site

    bitvegas.com Here over 10 random varied pages the repeating pages are

    9
    https://bitvegas.com/bitcoin-casino-guide/provably-fair-gambling/

    8 times
    https://bitvegas.com/bitcoin-casino-guide/bitcoin-casinos-for-high-rollers/

    7 times
    https://bitvegas.com/bitcoin-casino-reviews/bitcoin-rush-casino-review/

    7 times
    https://bitvegas.com/bitcoin-casino-tools-and-resources/casino-movies-about-gambling/

    Only one of those is much longer than average. also like I said

    define(‘CRP_MAX_WORDS’, 200);

    makes no difference.

    > Another more complicated option with the available construct would be to rewrite the clause to weight the post title and post content in the clause

    How would we do that?

    • This reply was modified 7 years, 3 months ago by BitEdge.
    Plugin Author Ajay

    (@ajay)

    I’ve not tested this yet but you’ll need a function in your theme’s functions.php

    Please backup before making these changes. You can play with 10 and 1 and see the impact.

    Also worthwhile is to install Query Monitor plugin when testing to see what queries are generated so you can try it with phpMyAdmin.

    
    function crp_add_fields( $fields, $id ) {
    
    $source_post = get_post( $id );
    
    $field_score = ", (MATCH(post_title) AGAINST ('%s') * 10 ) + ";
    $field_score .= "(MATCH(post_content) AGAINST ('%s') * 1 ) ";
    $field_score .= 'AS score ';
    
    $field_score = $wpdb->prepare( $field_score, $source_post->post_title, $source_post->post_content );
    
    return $fields . $field_score;
    
    }
    add_filter( 'crp_posts_fields', 'crp_add_fields', 10, 2 );
    
    function crp_filter_orderby( $orderby ) {
    
       return 'score';
    }
    add_filter( 'crp_posts_orderby', 'crp_filter_orderby' );
    
    
    Thread Starter BitEdge

    (@whatwhatwhatwhat)

    Is there any chance this was related to my database using InnoDB instead of MyISAM? I tried

    https://www.ads-software.com/plugins/yet-another-related-posts-plugin/

    And they said

    “consider titles” and “consider bodies” relatedness criteria require your wpedge_posts table to use the MyISAM enginefulltext indexing feature. Unfortunately your table seems to be using the InnoDB engine.”

    I can still use the plugin however it displays a very similar bug to the one I describe here.

    Plugin Author Ajay

    (@ajay)

    That might actually be the case. From my experience myISAM has better related matching that InnoDB. Probably because the latter is more up to date, although supposed to be more efficient.

    There are a few options to try with CRP. One option is to forego the relevancy matching by using the CRP Taxonomy addon and using tags and/or categories as matchers or additional matchers.

    Another option is to convert your wp_posts table to myISAM which you’ll need to do via phpMyAdmin. You can convert this back as well if you feel.

    CRP has a very aggressive cache currently (which I’ll be modifying in subsequent versions) so you won’t see performance issues at least on the related posts irrespective of the database type.

    FINDbmx

    (@findbmx)

    changing the storage Engine to MyISAM has worked for me!

    Thread Starter BitEdge

    (@whatwhatwhatwhat)

    Not for me ??

    Plugin Author Ajay

    (@ajay)

    I checked out your site and don’t believe that CRP is installed anymore?

    Thread Starter BitEdge

    (@whatwhatwhatwhat)

    Yes, I deactivated it given this bug.

    Hello @ajay,

    I have done some work on this. Our website uses extensively YOAST SEO and has valid meta descriptions on all pages. I have used the (yoast) meta description for the matching and have also added scoring similar to what you suggest.

    Here is a gist file with the code I use (needs minor improvements)
    https://gist.github.com/froutsis/3ab4adbbdf0b4be3f8940faf35cb3721

    Since they are joined tables I cannot have a “combined fields fulltext index”.

    Also due to the small length of the meta description text the results are extended by using one more OR statement (with post->post_tile) in the where clause.

    According to your experience do you see any pitfalls or problems in the above solution? (if you have suggestions you are most welcomed to share with me)

    The end SQL query is like the following (the table is now MyISAM):

    SELECT DISTINCT wp_posts.ID , ( ( MATCH(wp_posts.post_title) AGAINST ('This is the post title') *5 ) + ( MATCH(wp_postmeta.meta_value) AGAINST ('This is the yoast meta description text.') *10 ) ) as score
    FROM wp_posts
    LEFT JOIN wp_postmeta
    ON wp_postmeta.post_id = wp_posts.ID
    WHERE 1=1
    AND ( MATCH(wp_posts.post_title) AGAINST ('This is the post title')
    OR MATCH(wp_postmeta.meta_value) AGAINST ('This is the yoast meta description text.')
    OR MATCH(wp_posts.post_title) AGAINST ('This is the post title. This is the yoast meta description text.') )
    AND wp_posts.post_date < '2018-05-02 16:53:48'
    AND wp_posts.post_status = 'publish'
    AND wp_posts.ID != 1234
    AND wp_posts.post_type IN ('post', 'page')
    AND wp_postmeta.meta_key = '_yoast_wpseo_metadesc'
    ORDER BY score DESC
    LIMIT 0, 6
    Plugin Author Ajay

    (@ajay)

    Thanks. This implementation does make sense to me. It adds an extra level of matching which is good.

    One option worth trying is to use AND instead of OR in your two conditions but it might end up giving zero results.

Viewing 15 replies - 1 through 15 (of 16 total)
  • The topic ‘Same pages/posts listed over and over again despite not being related’ is closed to new replies.