Similar Threads: More UNIX and Linux Forum Topics You Might Find Helpful Update

Today I change the DB and the PHP code and rebuilt the database for similar threads at the end of each post, increasing from a max of 5 to a max of 10 similar threads per post:

More UNIX and Linux Forum Topics You Might Find Helpful

It was quite easy to do:

  1. Increased the max size of the similar field in the thread DB from 55 to a 120 varchar.

  2. Changed a fetch_similar_threads($threadtitle, $threadid = 0) DB PHP query from LIMIT 5 to LIMIT 10 .

  3. Rebuild the entire thread table of all (currently 280K) threads.

Done!

1 Like

Brilliant, thank you.
I found an overbalance of the proposals lying in the past, omitting / ignoring recent contributions. Not implying the recent ones are better, but would it be feasible to make distribution of selected threads spread somewhat more evenly?

1 Like

When the DB is rebuilt those issues are taken care of.

Moving forward I will rebuild monthly.

1 Like

This issue is that these "Similar Threads" are built automatically when new threads are created.

The code runs thru the database, scores similar threads primarily based on the title of the threads, sorts the threads based on the scores, and then places a comma separated field of the thread ids in each thread in a DB field for that thread. Before that number was limited to 5 and now it is limited to 10. I may increase if to 15 or even 20 people think it is a good idea.

However, there was a number of logic flaws in the process. The main flaw is that old threads are not updated with "similar ones" unless we manually update the database. This was not done on a regular basis since it was designed to be done manually; but I have it on my calendar to run it once a month.

The second flaw is the algorithm used to create the matches is based mostly on thread titles. This is not bad, but it would be better if it used the thread content or at least the tags. However, this of course will effect performance.

If you are interested, I can post the entire PHP code for this algorithm and you can rewrite it to make it even better. Otherwise, it will be on a future "Neo TODO List" as I'm now focused on tasks related to the layout, tables and responsive design". I can only do so much and juggle so many balls at once, LOL

On my current main TODO list are:

  • Responsive threadbits (search results, forum thread views, etc.).
  • Responsive similar thread (under each thread).

Each of these tasks is fairly simple, since I have done this a few time already:

  • Study the source of a page and determine where to add CSS flex container classes.
  • Add CSS flex container classes to the rows and row items.
  • Write jQuery code to manipulate the DOM for these classes.
  • Test this in "Neo Only Mode" until I get all the parameters working correctly.
  • Check responsiveness from huge (2000px wide) to small (300 px wide) and retest.
  • Make public after "Neo Testing" is done.

It was interesting to do at first, but the more tables I transform to CSS flex, the more boring it becomes, so occasionally I diverge into fixing something else just to keep my sanity, LOL

For example, a few days ago I got bored and decided to add some new "tooltips" to the thread bits using Bootstrap and their tooltip extensions. I need to add this to all threads and forum descriptions and then create some UserCP bools or client side JS code to turn this on and off. I was going to code this inside the browser (Javascript) and not in the UserCP (PHP, server side), but then I will need to use a cookie to "remember" the user selections.

If I do this now (create the cookies), I will end up with 20 more cookies, which I do not want to do, so I want to wait until I have most of the new .JS done, create a single cookie with a JSON configuration string and encrypt this string in the cookie. This is all doable, but I prefer to do this after finishing 80% of the responsible jQuery code I need to write.

In the past, we had up to 3 "coding" admins, or at least 2, and now we are down to me, which is fine. I greatly appreciate all the coding in the past, but as the only "coding guy" these days, I have to follow some logical plan to get this done, while I have the time and interest.

Cheers.

Unfortunately, I have absolutely no command of PHP, so posting the code would not fall on fertile soil. That's also why I regrettably can't offer any help in the project.

If I see a thread with a title containing a misspelled word (e.g. the recent thread "Troubleshoting whiptail"), should I correct the misspelled word or should I leave it as it was submitted? Will changing a word in a title screw up finding "similar threads" or will correcting it make it more likely that "similar threads" will be found?

I always correct spelling errors in works when I see them.

Yes, if there is a spelling error and the similar threads have already been created, the similar thread entry for that post will need to be rebuilt to get a more accurate match.

If there is a spelling error in the title, and the similar thread entry is created / calculated, then of course it will have poor matches. Changing the spelling is good, but the entry for similar threads in the DB entry for that thread will be "off" until the DB is rebuilt.

So best to always correct spelling, and then later when the DB is updated (similar threads rebuilt) the new matches will be much better.

1 Like

Hmm.

All programming is nearly the same, LOL

I program in PHP and Javascript daily these days. Last year it was C# everyday and PHP sometimes. Two decades ago it was PERL. Decades before that it was C, KSH, Basic and Fortran.

That's not including all the CSS, HTML, jQuery, and other frameworks and sets included in the mix, etc.

It's all the same. LOL

If, then, else, arrays, objects, syntax errors ....

Honestly, it's all the same.

Currently, I love Javascript the best.

Search results are done.

Similar threads are now responsive with CSS Flex powered by jQuery:

We can tweak and fine tune proportions, sizes, colors over time.

Here is the initial jQuery which drives the transformation:

$(document).ready(function() {
    $(".neo-search-results").css({
        overflow: "visable"
    });
    $(".neo-similarthreads-thead, .neo-similarthreads-threadbit").css({
        display: "flex",
        "flex-flow": "row wrap",
        "justify-content": "space-between",
        "flex-direction": "row",
        "align-content": "stretch"
    });
    $(".neo-similarthreads-thead, .neo-similarthreads-threadbit").find("td").removeAttr("width, align, nowrap");
    $(".neo-similiarthreads-thead-thread").css({
        "width": "240",
        "flex-grow": "10"
    });
    $(".neo-similiarthreads-thead-starter").css({
        "width": "100",
        "flex-grow": "3"
    });
    $(".neo-similiarthreads-thead-forum").css({
        "width": "150",
        "flex-grow": "5"
    });
    $(".neo-similiarthreads-thead-replies").css({
        "width": "50"
    });
    $(".neo-similiarthreads-thead-last").css({
        "width": "120",
        "flex-grow": "4"
    });
    $(window).on("resize", neoAdjustSimilarThreads);
    neoAdjustSimilarThreads();
    function neoAdjustSimilarThreads() {
        var widthNow = $(window).width();
        if (widthNow < 700) {
            $(".neo-similarthreads-thead, .neo-similiarthreads-thead-replies").hide();
            $("#neo-similarthreads-phrase").text("Similar Threads")
        } else {
            $(".neo-similarthreads-thead, .neo-similiarthreads-thead-replies").show();
            $("#neo-similarthreads-phrase").text("More UNIX and Linux Forum Topics You Might Find Helpful")
        }
    }
    $("#collapseimg_similarthreads").click(function() {
        return toggle_collapse("similarthreads")
    })
});

TODO: Thread views in forums.

Rebuild similar thread database 22 Sept 2018.

Rebuild similar thread database 8 Oct 2018.

Rebuilt similar thread database 16 Oct 2018.

Rebuilt similar thread database a new times including today, 15 Nov 2018.

Note: Have been updating regularly but not posting here when we update. Not really necessary to updates when we rebuild similar threads in this thread.

Also, updated the code and changed the number of similar threads from 10 to 15. Was going to change to 20, but 15 seems like quite a lot already.

Manually rebuilt similar thread database 15 June 2019.

(This is done automatically every week, but sometimes it is good to manually rebuilt it).

Manually rebuilt similar thread database 3 Sept 2019.

(This is done automatically every week, but sometimes it is good to manually rebuilt it).

FYI:

Manually rebuilt similar thread database 12 October 2019.

Why do we occasionally rebuild the entire similar threads DB entries?

We do this because although each new discussion has a similar thread entry created by referencing the prior discussions; the older discussions do not necessary reference the newer ones.

So, to insure the older discussions reference the newer ones in the similar threads DB entry for each discussion thread, we rebuild these entries for each discussion thread, occasionally.

And today I am manually rebuilding the similar threads DB entries once again.