Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 02-07-2003, 10:50 PM
WebMasterAJ WebMasterAJ is offline
 
Join Date: Oct 2001
Posts: 104
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Saving search in vBulletin

Hello, I have a question.

First, a quick background. I have a forum for writers to go in, write articles, and then post them. A script on the main page then pulls the articles from a specific forum, displays the first few sentences, and etc.

Anyways, I would like to be able to "save searches." So, for example, I can have a link for viewers to be able to easily view all articles by a specific writer, or with a specific text.

So, for example... if a writer is writing a draft column, he would insert the following in his article: (this is basically making the text the same color as the post background color, to make it seem invisible.

[tablecolor]2003 April Draft News Commentary[/tablecolor]

Then, I would like to create a link on my main page that simply says "Click here to view Draft Articles" which will automatically search for articles containing "2003 April Draft News Commentary".

All in all, basically... I'm trying to find out if there is a way to save searches.

I hope everyone understands what I mean, if not... just ask

Let me know if you have any ideas for my question.

Thanks for your time,
Andrew Tatum
Reply With Quote
  #2  
Old 02-08-2003, 04:25 PM
Xenon's Avatar
Xenon Xenon is offline
 
Join Date: Oct 2001
Location: Bavaria
Posts: 12,878
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

just run the search once, and then save the url of your results.

that's why there is the searchid thing..
Reply With Quote
  #3  
Old 03-07-2003, 09:32 PM
sparky2 sparky2 is offline
 
Join Date: Jul 2002
Posts: 31
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

"just save the URL for the results page" is not a viable idea.
Here's why:

1)
Each time search.php runs, one of its subroutines
deletes any search (row in the search table) that has
a dateline older than 7+ days from time(now)

2)
One of the outermost conditionals (permissions check)
checks the $bbuser[userid]... and considers each
member's search to be his/her own private resultset.
You can close the browser window(s) and return in another session
(within 7 days) and request your previous results page
but if youemail the results page URL to me
vbb won't allow me to view it!

Check this for yourself:
Even here, with the "view 10 recent searches" hack applied,
you cannot view the results page of another member.
Hover your mouse over the link to one of the listed "recent searches" & note the searchid in the statusbar.
After clicking the link, note that the URL in your location bar refelect the searchid of a brand-new search.


The reason for this "limitation" is to prevent members on the "guest" or "registered" usergroup from seeing the resultset returned for an admin account. It would likely
contain matching threads within private forums & the user would just become frustrated; they would click & the permissions check in showthread.php would lookup
their access in the forumpermissions table... and execute show_nopermission()

(In fact, the first release of the "view recent searches" hack failed to take this into account & a patch was released, so that it checked the usergroupid of the person
who had conducted each search -- and it now omits resultsets from mod/admin search runs)

===============================

Okay, what WILL work & will be immensely valuable in terms of reducing server load due to frequent searching (drive reads of the huge searchindex table) is this:

1a) create a new table, let's name it 'searchhistory' with a structure similar to the search table. We'll record (save) all the search particulars EXCEPT the postid field
(which stores the matchind ids as a comma-delimited string which can be HUGE)

1b) include an extra field in the searchhistory table (call it 'targetforumtitle') and capture the text label of the target subforum in each search run, for use in later
reporting

1c) modify search.php so that $bbuserinfo[usergroupid] is passed into a hidden form field during ?action=searchintro

1d) modify search.php to ALSO "INSERT INTO searchhistory..." every time it performs a search ***for usergroupid=2 members

1e) allow the data to accumulate in searchhistory over time

1f) build a hack that queries & reports the most-frequent querystrings (preferably grouped or filtered by forumid)


2a) have the moderator(s) for each subforum periodically check the "top searches" report and...

2b) expand on "recent 10 searches" so that mod/admins can page through the entire recorded past searches (remember, only NON mod/admin search records are
listed in it) and provide a checkbox (or set of inputs) which enable them to select/assign any given resultset as a "Hot Topic" for a particular subforum

3c) create a "hottopic_bit" template which will be inserted into the "forumhome" and/or "showthread" template...

4d) present members with titles/links to these "hot topics" as an alternative to re-running the same-old-search that gets re-run 50 times a day! and as an alternative to
creating new, topical subforums... painstakingly moving relevant threads to them... and merging the threads back into another subforum once the interest wanes.

***regarding the usergroup=2 inclusion/restriction:
As a working premise, guests aren't allowed to use search.php (toward conserving server resources & encouraging membership) and all "registered" members have
access to the same (identical) set of public subforums.
--------
If access masks are enabled in your vBulletin installation (as they are in ours), the search resultsets may contain postids in subforums for which a member browsing
"HotTopics" later doesn't have permission.





If anyone is interested in collaborating on this, let me know.
I've done (and am using) the "searchhistory table data collection" part
--------------
the query necessary to identify "top keywords" will be nearly identical to
the one (covered in another hack thread) used to ID common words in the word table,
so that these can be added to badwords.php (toward reducing the size of the searchindex table)
--------------
the page-at-a-time (and filtered by subforum) reporting can borrow code
from the native "view adminlog" script
---------------
So, it's just a matter of putting the pieces together. When it's all done/built, and used, one of the beauties of it is that the resultsets can STILL disappear
automagically (and WILL if the datecheck isn't removed from search.php). When a selected HotTopic hasn't been clicked for a whole week, it'll be removed.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 04:21 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.03389 seconds
  • Memory Usage 2,183KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (3)post_thanks_box
  • (3)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (3)post_thanks_postbit_info
  • (3)postbit
  • (3)postbit_onlinestatus
  • (3)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete