View Full Version : how does this forum searchid work?
whan searching this forum, it appears to create a "search" and save it in the database. if that's correct, how is the data formatted when saved?
link example for searchid=465541:
http://forums.applenova.com/search.php?searchid=465541&pp=30&page=2
anyone?
surely just as simple as saving the search string with any other attributes for the search in a database table...?
Yup. Basically, it saves a row with the id, username, search criteria, and a list of results.
ok, that's what i guessed. but, how is the search criteria formatted? can it save searches for multiple keys, such as "username = nassau" AND "userid != 12345"? if so, how is that formatted when it's saved in the database?
I hesitate to share the nitty-gritty specifics since vBulletin is a closed source, commercial product.
oh... :(
ok, forget this forum!
how would one format a "multi key" search when saving it to a database, in general? :)
i can figure out a way to do it but if there's a nice streamlined way of doing it, please share! and we're not talking about this forum specifically, just in general.
bassplayinMacFiend
2006-07-07, 09:28
I hesitate to share the nitty-gritty specifics since vBulletin is a closed source, commercial product.
Does vB not provide the source anymore? The OP's question may be better answered at the official vB forums (http://www.vbulletin.com/forum/) though.
Does vB not provide the source anymore?
Yes, vB provides the source (it is just PHP, after all), but it is only available to customers and only under a restrictive license.
it's cool.. i figured it out soon after i posted here. basically i just save the multiple keys, operators and values as arrays in MySQL.
now, for a follow up question, how do you guys save arrays in MySQL? i have my own way of doing it but it's a little clunky. please go to this thread (http://forums.applenova.com/showthread.php?p=366379#post366379) for this discussion.
thanks
ok, so i implemented the "save search-data to database" function, no sweat!
but, it does generate a whole lot of data in the database. what's a good time to keep a search? one year? one month? i'm realizing that people may very well bookmark a search and thus might "resuse" the search over and over again.
any thoughts?
also, brad, you said that this forum saves the results too, is that right? does it actually save results? what about if the results change, do you see live stuff or "cached" stuff?
I have no idea how vB works, but I can't rationalize keeping a particular search for more than hours at most.
spotcatbug
2006-07-08, 18:49
Possibly a dense question: why would you save the search at all?
I feel like I'm missing something obvious.
I would save a search so if another user made same search only a few seconds later (e.g. VTP or VNP), it's ready to go, saving on database's performance.
But yes, I wouldn't save it for years and years...
i save searches since you'd have to re-post search data each time you want to access, for example, page 2 of a search result. you wouldn't be able to use text links for that. it's a small problem with a slightly big solution.
the reason i would save a search for more than a short while is, like i said, if the user bookmarks the search results. the search results isn't a search in itself, it is - a result.
But, I wouldn't bookmark something that is essentially "calculated". That's bad database practice.
Instead, if a user wanted to bookmark a search, I'd only let bookmark hold the terms that users used for search, not the result itself.
I can't really justify the idea of saving/bookmarking a result as it is invariably time-sensitive and will go out of date.
But then again, I may be missing something really obvious.
no, i'm not saving the actual results, sorry for my bad explanation. i'm saving the resulting search query that the user made up. and this is what a user may want to bookmark. the resulting data returned from the database will always be "live".
Oh, now that's different, all right. Ignore my spouting then. :D
But yes, I wouldn't save it for years and years...
Indeed. In vB, rows on the table I described have a very short life span.
Indeed. In vB, rows on the table I described have a very short life span.
would you mind sharing how long you keep them? i can solve it myself but i just want some ceative input.
Right now, for example, there are 15 rows on the search table with the oldest having a timestamp of about an hour ago.
ok, thanks! i set mine to 45 minutes., i'll see how that works.
so brad, what does happen if someone tries to access a search that was generated "too long ago"?
vBulletin® v3.6.4, Copyright ©2000-2024, Jelsoft Enterprises Ltd.