Search for REALLY old threads / posts


 
Thread Tools Search this Thread
The Lounge What is on Your Mind? Search for REALLY old threads / posts
# 15  
Old 01-21-2019
Hey Rudi,

I think this works as you requested (for Member Name searches only). Basically, I removed the search results LIMIT of 500 for all moderators (this was the easiest fix) and corrected some errors in the PHP (below) image:

Please let me know if you get the results you expect. I checked an it worked fine for me!

Image

Code:
<?php
if ($vbulletin->GPC['searchbyyear'] >= 2000 and $vbulletin->GPC['searchbyyear'] <= date('Y')) {
    $start_year_unixtime = mktime(0, 0, 0, 1, 1, $vbulletin->GPC['searchbyyear']);
    $end_year_unixtime = mktime(23, 59, 59, 12, 31, $vbulletin->GPC['searchbyyear']);
    $post_query_logic[100] = "post.dateline >= " . $start_year_unixtime . " AND post.dateline <= " .
    $end_year_unixtime;
}

Admin Notes:

Code:
// Does not work as planned so just removed limit for mods in code frag in block below
1401 if(can_moderate() AND $vbulletin->GPC['searchbyyear'] >= 2000 AND $vbulletin->GPC['searchbyyear'] <= date("Y"))
1402 {                                  
1403     $nl_query_limit = 'LIMIT  3000';
1404     $vbulletin->options['maxresults'] = 3000;
1405 }
1406 else
1407 {                                  
1408     $nl_query_limit = 'LIMIT ' . $vbulletin->options['maxresults'];
1409 }
// Does not work as planned so just removed limit for mods in code frag in block below

Code:
2655 // trim results down to maximum $vbulletin->options[maxresults]
2656 if ($vbulletin->options['maxresults'] > 0 AND $numitems > $vbulletin->options['maxresults'] AND !can_moderate())
2657 {
2658   $clippedids = array();
2659   for ($i = 0; $i < $vbulletin->options['maxresults']; $i++)
2660   {
2661     $clippedids[] = $orderedids["$i"];
2662   }
2663   $orderedids =& $clippedids;
2664   $numitems = $vbulletin->options['maxresults'];
2665 }

HTML:

Code:
search_forums

Code:
<div  style="margin:20px 0px 10px 0px;font-weight:bold;cursor:pointer;" ><span>Search by Year:</span><span style="cursor:pointer;margin-left:20px;color:indigo;" class="neo-toolbit" title="User Name Searches by Year in Posts Only. Please Search By User Name and Select Show Results by Posts (Below, Left)"><i class="fas fa-question-circle"></i></span></div>
<div style="padding:$stylevar[formspacer]px">
    <div style="margin:0px 0px 10px 0px;display:none;">:</div>
    <div id="by_year">
        <input type="text" class="bginput form-control" name="searchbyyear" id="by_year_input" size="100"  placeholder="Year in 20YY Format for User Name Searches in Posts"/>
    </div>
</div>

# 16  
Old 01-21-2019
Looks promising, but unfortuneately:


Sorry - no matches. Please try some different terms below.


If I leave the year open, it yields today's posts (as expected).




EDIT: Hold it, hold it - when I also enter reasonable "Find Posts from" values (e.g. "Yesterday and older"), then it works.


Thanks for this!

Last edited by RudiC; 01-21-2019 at 09:56 AM..
# 17  
Old 01-21-2019
Also, Rudi,

According to the logs, you entered an additional field which I did not say to do:

Code:
Mon, 21 Jan 19 07:51:02 -0600  UserID: RudiC logic : ["post.dateline >= 1357020000 AND post.dateline <= 1388555999","post.userid IN(302122047)","post.dateline > 1547992262"] 
Mon, 21 Jan 19 07:51:22 -0600  UserID: RudiC logic : ["post.dateline >= 1357020000 AND post.dateline <= 1388555999","post.userid IN(302122047)","post.dateline < 1547992282"]

When I enter the search, this field is not set (from your query)

Code:
"post.dateline < 1547992282"

# 18  
Old 01-21-2019
FWIW,

My search produces a different query in the log file:

Code:
Mon, 21 Jan 19 07:50:13 -0600  UserID: Neo logic : ["post.dateline >= 1514786400 AND post.dateline <= 1546322399","post.userid IN(302122047)"]

You are doing something in your query different than me, because you have an extra query that I do not have.
# 19  
Old 01-21-2019
Yes, found it - look at the edit of my earlier post...
# 20  
Old 01-21-2019
Rudi,

Per my instruction, do not enter anything from:

Find Posts from

I specifically stated the ONLY three fields to enter in my post and in the image I provided.

If you don't follow my instructions, it will not work.

That is why I gave instructions. Don't try to break it. I did not ask for a stress test on all possibilities.
# 21  
Old 01-21-2019
Code:
condor2769:~/debug# tail -f neo_search_by_year.log

These queries will not work because you added another field (not in my instructions)

Code:
Mon, 21 Jan 19 07:33:21 -0600  UserID: RudiC logic : ["post.dateline >= 1325397600 AND post.dateline <= 1357019999","post.userid IN(302122047)","post.dateline > 1547991201"] 
Mon, 21 Jan 19 07:33:37 -0600  UserID: RudiC logic : ["post.dateline >= 1357020000 AND post.dateline <= 1388555999","post.userid IN(302122047)","post.dateline > 1547991217"] 
Mon, 21 Jan 19 07:35:10 -0600  UserID: RudiC logic : ["post.dateline >= 1357020000 AND post.dateline <= 1388555999","post.userid IN(302122047)","post.dateline > 1547991310"]

This query works, per my instruction:

Code:
Mon, 21 Jan 19 07:36:13 -0600  UserID: RudiC logic : ["post.userid IN(302122047)","post.dateline > 1547991373"] 
Mon, 21 Jan 19 07:49:50 -0600  UserID: RudiC logic : ["post.userid IN(302122047)","post.dateline > 1547992190"]

It works when I do it as well:

Code:
Mon, 21 Jan 19 07:50:13 -0600  UserID: Neo logic : ["post.dateline >= 1514786400 AND post.dateline <= 1546322399","post.userid IN(302122047)"]

This query by you adds a field which you should not add, since my instructions were to set three fields (not four):

Code:
Mon, 21 Jan 19 07:51:02 -0600  UserID: RudiC logic : ["post.dateline >= 1357020000 AND post.dateline <= 1388555999","post.userid IN(302122047)","post.dateline > 1547992262"] 
Mon, 21 Jan 19 07:51:22 -0600  UserID: RudiC logic : ["post.dateline >= 1357020000 AND post.dateline <= 1388555999","post.userid IN(302122047)","post.dateline < 1547992282"]

I really do not want to have to spend time testing every possible case where people do not follow my instructions (which are in the mouse over I provided over the "question-mark" icon). Just set the three fields and it works fine. I have tested it many times.

If you want to search by year, unlimited in results, I have provided you that capability as a Moderator!
Login or Register to Ask a Question

Previous Thread | Next Thread

1 More Discussions You Might Find Interesting

1. Post Here to Contact Site Administrators and Moderators

How do i delete threads/posts?

I cannot find the option anywhere when i click on "Edit". (2 Replies)
Discussion started by: johnthebaptist
2 Replies
Login or Register to Ask a Question