Webmaster Forum


Go Back   Webmaster Forum > Web Development > Web Design Lobby > Coding Forum
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Coding Forum Problems with your code? Let's hear about it.

Ezilon Directory   I Sell Pagerank   V7N Directory

Reply
 
LinkBack Thread Tools Display Modes
Old 06-26-2007, 04:33 PM   #1 (permalink)
Contributing Member
 
Join Date: 07-01-06
Posts: 131
iTrader: 0 / 0%
Latest Blog:
None

marc_gfx is liked by many
Question Search Code for a Forum

I programmed my own forum a while ago, quite similar to this one in a way (hierarchical, new threads on each level as well as posts). most people will probably ask why I did this... well, I simply wanted to. however there are still some things missing to make it perfect. I currently have no forum-search and am now wondering how to go about this sensibly. Thought I'd get some feedback on my ideas...

My website is for numerous different teams with their own forums that should therefore not interfere with each other.
I plan to index every unique word from every post, that is larger than 2(or 3?) letters.
the structure would be something like this:
{
teamID
word
list of all postIDs separated by a special character
}
e.g.:{
20,
"hello",
11*22*23*44*55*75*78
}
meaning that "hello" is found in 7 different posts. therefore searching for "hello" would give me the list of all relevant posts fairly quickly. searching for "hello" and "bye" would be done by searching for both words separately and then looking for overlapping posts or joining results depending on what search commands were used.

seems to be a sensible way to me, but I have absolutely no experience in search-engine methods. maybe someone can give me a kick in a better direction before I end up producing garbage.
__________________
Test your geography knowledge on MapBattle.com! You can also make your own map challenges ;)

Get your real-life teams organized! Onlito.com, Online Team Organisation (Free & Beta)
marc_gfx is offline  
Add Post to del.icio.us
Reply With Quote
Sponsored Links
SEO Hosting by HostGator  Advertise Here  Buy Blog Links
Old 06-27-2007, 01:37 PM   #2 (permalink)
Inactive
 
StupidScript's Avatar
 
Join Date: 09-22-06
Location: Los Angeles
Posts: 678
iTrader: 0 / 0%
Latest Blog:
None

StupidScript is just really niceStupidScript is just really niceStupidScript is just really niceStupidScript is just really niceStupidScript is just really niceStupidScript is just really niceStupidScript is just really niceStupidScript is just really niceStupidScript is just really niceStupidScript is just really niceStupidScript is just really nice
How about indexing the entry fields using your db's indexing function, and then doing a pretty simple query, i.e.
Code:
..from entries where teamid='$teamid' and entry like '$term'...
You'll probably want to rank the results, so there's more to it ... but that might get you started.
StupidScript is offline  
Add Post to del.icio.us
Reply With Quote
Old 06-27-2007, 04:59 PM   #3 (permalink)
Contributing Member
 
Join Date: 06-11-07
Posts: 172
iTrader: 0 / 0%
Latest Blog:
None

Capo64 is liked by somebodyCapo64 is liked by somebodyCapo64 is liked by somebody
i would do something like what stupid script said except like this
Code:
$posts = array(); $result = mysql_query("SELECT * FROM entries WHERE teamid='" . $teamid . "'"); while($row = mysql_fetch_array($result)) { $posts[$postID] = $row['entrycontent']; } //Now you have an array with all of the posts for that team foreach ($posts as $id => $post){ $newposts[$id] = substr_count($post, $searchterm); } //$newposts is now an array containing each post ID => the amount of times the search term was found in that ID //order $newposts by value and display it
Kinda just typed that up and i've never really tried to make a search engine so it's prolly sketchy, but that's what I would do.
Capo64 is offline  
Add Post to del.icio.us
Reply With Quote
Old 06-28-2007, 01:42 AM   #4 (permalink)
Contributing Member
 
Join Date: 07-01-06
Posts: 131
iTrader: 0 / 0%
Latest Blog:
None

marc_gfx is liked by many
@stupidscript: thats kind of the original idea I had. But then I was thinking what would happen if i index words like "the" or other very common words. I would have tons and tons of entries that would be searched. I was thinking it could save search-time to really limit the amount of available entries and pre-group the results. I could of course use 2 tables for this, one that stores the word name and one that identifies the posts where the word is used.
table1(entryID, teamID, word) table2(entryID, postID).
the other method I came up with would surely reduce the amount of entries stored, but would have this long tail of results in some cases. the idea would then be to cancel out words that lead to inconclusive search results automatically (e.g. "the") , if they are found in more than 10% of all posts. But it could be slow combining results... I guess I'd need to do some testing.

@capo64: that idea would definitely be rather slow. just imagine there are 2000 posts that would be searched full-text every query... the amount of times something is found doesn't seem to be relevant to me either. I'm considering simply searching by term and then sorting by time (the newer the higher...)

thanks guys for your input!
__________________
Test your geography knowledge on MapBattle.com! You can also make your own map challenges ;)

Get your real-life teams organized! Onlito.com, Online Team Organisation (Free & Beta)
marc_gfx is offline  
Add Post to del.icio.us
Reply With Quote
Go Back   Webmaster Forum > Web Development > Web Design Lobby > Coding Forum

Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Google Code Search - Code Search Engine from the Big G Avinash Coding Forum 2 10-05-2006 10:10 PM
Search within distance of zip code functionality theChronic Coding Forum 3 07-24-2006 07:56 PM
Code to prevent search engines from seeing theChronic SEO Forum 4 07-18-2006 04:35 AM
New Search Engine - Search for Programming Code ! ! Coding Forum 0 05-17-2005 12:33 PM
Forum Code Help.... Eggs & Hammy Part Deu Coding Forum 6 06-29-2004 02:48 AM


Sponsor Links
Get exposure! Get exposure! Find Scripts Web Hosting Directory Get exposure! SEO Blog


All times are GMT -7. The time now is 03:22 PM.
© Copyright 2008 V7 Inc