Full Text Search query limit

This forum is now closed as part of retiring phpBB2.
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

This forum is now closed due to phpBB2.0 being retired.
Post Reply
wwhite
Registered User
Posts: 56
Joined: Sat Feb 08, 2003 2:20 pm
Location: CT, USA
Contact:

Full Text Search query limit

Post by wwhite »

I'm pretty sure that phpbb uses the full text feature to do its searches (correct me if i'm wrong). I am trying to do one too but I notice that the minimum lenght of a word is 4 charecters. I know you can change that with an options file but I don't think I can set that up without shell access. Thanks for any direction.

LifeIsPain
Former Team Member
Posts: 2148
Joined: Tue Oct 01, 2002 7:04 am
Location: Way Way Behind

Post by LifeIsPain »

Correction. phpBB creates an index of all words used in each post, so when you do a search, you aren't searching the posts themselves, but searching a list to find out if the word (or words) is in the post. Have a look at the tables phpbb_search_wordlist and phpbb_search_wordmatch
LifeIsPain - one who needs to be smackedLife is pain, highness! Anyone who says differently is selling something.

wwhite
Registered User
Posts: 56
Joined: Sat Feb 08, 2003 2:20 pm
Location: CT, USA
Contact:

Post by wwhite »

oh yeah! i was wonder what that was. Would you recomend I try that for my problem? More importantly... how would I do that? Is it a schedualed index? Thanks for the reply.

LifeIsPain
Former Team Member
Posts: 2148
Joined: Tue Oct 01, 2002 7:04 am
Location: Way Way Behind

Post by LifeIsPain »

Different problems have different solutions. As I don't know what you are doing, I don't know if this is the best solution. For solutions where you have many rows to search through (such as searching through posts) having an index can be very good. Using this index, phpBB is also able to strip out the bbcode so that it isn't searched, and allows for other words to get in. such as if you have "monster" in your search table, using the index, you could make it match that with "monster" even though it has all the extra codes.

As for how it is made, the index is updated on ever submital, edit, and delition.
LifeIsPain - one who needs to be smackedLife is pain, highness! Anyone who says differently is selling something.

wwhite
Registered User
Posts: 56
Joined: Sat Feb 08, 2003 2:20 pm
Location: CT, USA
Contact:

Post by wwhite »

How does phpbb calculate the relevancy of a result? I have done a little code but I am stuck on that part. If have gotten as far is to having an array full of the record id's.

Code: Select all

	if(isset($HTTP_GET_VARS['title'])) {
		$keywords = explode(" ", $HTTP_GET_VARS['title']);
		$keyword_number = count($keywords);
		
		for($i = 0; $i < $keyword_number; $i++) {
			$sql = "SELECT word_id FROM np_games_wordlist WHERE word LIKE '%%$keywords[$i]%%'";
			if ( !($result = $db->sql_query($sql)) ) { 
				message_die(GENERAL_ERROR, 'Error searching game database.', '', __LINE__, __FILE__, $sql); 
			}
			$word_id_list = $db->sql_fetchrow($result);
			$word_count = $db->sql_numrows($result);
		
			for($j = 0; $j < $word_count; $j++) {
				$sql = "SELECT words.gameid, games.name FROM np_games_wordmatch words, np_games games WHERE words.gameid = games.id AND word_id = $word_id_list[$j]";
				if ( !($result = $db->sql_query($sql)) ) { 
					message_die(GENERAL_ERROR, 'Error searching game database.', '', __LINE__, __FILE__, $sql); 
				}
			$game_id_list = $db->sql_fetchrow($result);
			echo $game_id_list[0] . ' - ';
			}
		}
	}

LifeIsPain
Former Team Member
Posts: 2148
Joined: Tue Oct 01, 2002 7:04 am
Location: Way Way Behind

Post by LifeIsPain »

I will say, there isn't a relevancy check, it just returns the results that have the specified words. With that though, I will leave it though, as it appears not to be a MOD but just a question on how phpBB works, and I have my duties to attend to (hope you understand)
LifeIsPain - one who needs to be smackedLife is pain, highness! Anyone who says differently is selling something.

wwhite
Registered User
Posts: 56
Joined: Sat Feb 08, 2003 2:20 pm
Location: CT, USA
Contact:

Post by wwhite »

No problem, sorry for any problems.

Post Reply

Return to “[2.0.x] MOD Writers Discussion”