[2.0.15] Search Title Only

The cleanup is complete. This forum is now read only.

Rating:

Excellent!
11
79%
Very Good
0
No votes
Good
2
14%
Fair
1
7%
Poor
0
No votes
 
Total votes: 14

bigbear
Registered User
Posts: 129
Joined: Sat Aug 17, 2002 6:21 pm
Location: Kuala Lumpur
Contact:

Post by bigbear » Fri Aug 12, 2005 12:31 am

This is the exact message"

Code: Select all

Parse error: parse error in H:\Webserver\phpBB\search.php on line 555
Could it be because I am using CH mod?

Edit: Managed to get it working the 2nd time trying - copied and pasted the code all over again and it worked. Sorry for the trouble.
My Gallery
My Photography Forum
Looking for kind php souls to improve my site.

User avatar
drathbun
Former Team Member
Posts: 12204
Joined: Thu Jun 06, 2002 3:51 pm
Location: TOPICS_TABLE
Contact:

Post by drathbun » Fri Aug 12, 2005 5:12 am

bigbear wrote: Edit: Managed to get it working the 2nd time trying - copied and pasted the code all over again and it worked. Sorry for the trouble.

No problem. :-) That's why I asked you to check again... glad it's working out for you.
I blog about phpBB: phpBBDoctor blog
Still using phpbb2? So am I! Click below for details
Image

Capmaster
Registered User
Posts: 69
Joined: Tue Jul 05, 2005 1:26 pm

Post by Capmaster » Wed Nov 23, 2005 8:24 pm

Parse error line 355 in search.php

I've reinstalled 4 times and I get the same results. No dice.
Image
Some mornings, it's just not worth chewing through the leather straps

User avatar
drathbun
Former Team Member
Posts: 12204
Joined: Thu Jun 06, 2002 3:51 pm
Location: TOPICS_TABLE
Contact:

Post by drathbun » Mon Nov 28, 2005 11:42 pm

Capmaster wrote: Parse error line 355 in search.php

I've reinstalled 4 times and I get the same results. No dice.

That doesn't give me much to go on... you want to post some of the lines of code? Or at least let me know which "edit" appears to be failing?
I blog about phpBB: phpBBDoctor blog
Still using phpbb2? So am I! Click below for details
Image

leecovuk
Registered User
Posts: 166
Joined: Mon Apr 11, 2005 2:11 pm

Post by leecovuk » Thu Dec 08, 2005 8:32 am

hello,

Can I please check something here, having done a little testing ;

This mod adds the functionality to:

search only the titles of messages

not

search only the titles of topics

Is that right ?

It seems to me that we need usually to be searching the 'topic title' because the 'message title' in a continuing topic is usually left empty.

thanks for any thoughts,
lee

User avatar
drathbun
Former Team Member
Posts: 12204
Joined: Thu Jun 06, 2002 3:51 pm
Location: TOPICS_TABLE
Contact:

Post by drathbun » Thu Dec 08, 2005 2:56 pm

It searches the topic title, as based on the value for title_match in the phpbb_search_wordmatch table.
I blog about phpBB: phpBBDoctor blog
Still using phpbb2? So am I! Click below for details
Image

leecovuk
Registered User
Posts: 166
Joined: Mon Apr 11, 2005 2:11 pm

Post by leecovuk » Thu Dec 08, 2005 9:16 pm

hello Drathbun,

I should say I am not 'on a mission' to find fault with your or any author's mod, which they have kindly supplied for free :) ; just wanting to clarify ;

Unless my install is working not as expected / wrongly, here is my experience :

1) Using your mod adds the function
'Search message title only'
which indeed only looks for 'message titles' not 'topic titles'.
Of course, in the case of a first post in a topic, the topic and message titles will be the same due to how phpBB links them.

2) The phpBB default search option
'Search topic title and message text'
itself is inaccurate in its wording, and in fact equates to :
'Search topic and message titles and message text'

I have tried another mod, 'Search Topic Title Only' by Acyd Burn, and tried that on another install, wondering if that would look at only 'topic titles' not 'message titles'.
Although arguably more useful for my needs, it indeed looks at 'topic titles' but also 'message titles'.

Maybe it is impossible to separate 'message titles' and 'topic titles' for search purposes ?

thanks,
lee

User avatar
drathbun
Former Team Member
Posts: 12204
Joined: Thu Jun 06, 2002 3:51 pm
Location: TOPICS_TABLE
Contact:

Post by drathbun » Fri Dec 09, 2005 3:39 am

Sorry with the short response earlier, I was only here for a bit. I'll try to explain it further.

Each post as a (potential) title. If you treat post = message (as I think you are doing) then yes, any word that appears in a post title will be indexed as such, and will be reported by this search MOD. Bottom line is that it does, in fact, search only for those words where the title bit is turned "on" as the word appears in the post title.

Now if you wanted to search only the "Topic" title, it could be done, but it is not currently a feature of this MOD. You would have to limit to the title bit and determine if the post containing the title word is also the starting post for a topic.

By default, phpBB "replies" have a blank title. If you wanted to enforce that (by removing the title field on replies, leaving it only for new topics) then you would in fact be searching only topic titles and not post subjects.
I blog about phpBB: phpBBDoctor blog
Still using phpbb2? So am I! Click below for details
Image

leecovuk
Registered User
Posts: 166
Joined: Mon Apr 11, 2005 2:11 pm

Post by leecovuk » Fri Dec 09, 2005 5:12 am

thanks,
I think I understand.

Presumably Acyd Burn's mod works in a similar way to yours;
it does however search 'topic titles' although it also includes 'message (post) subjects', as I described earlier.

Maybe I'll try and ask him for his take on this, although it is not a major issue that topic titles and message subjects should be searched separately.

Darrn
Registered User
Posts: 1
Joined: Wed Dec 14, 2005 11:25 pm
Contact:

Post by Darrn » Wed Dec 14, 2005 11:40 pm

i get a warning installing this MOD
FIND FAILED: In file [language/lang_german/lang_main.php] could not find:

$lang['Search_msg_only'] = 'Search message text only';


using EasyMOD 0.3.0 and german language
the warning also occurs when the default language and the admin language is set to english

Dagon
Registered User
Posts: 422
Joined: Tue Jun 03, 2003 8:59 pm

Post by Dagon » Wed Dec 14, 2005 11:57 pm

I would imagine that it is because this line: $lang['Search_msg_only'] = 'Search message text only'; will be different in every single language. It is English, so it will not find it in the German version of the language file regardless of what you have the default language set on.

You might have better luck if you change the find to do a partial search. So change the install file to have it only find $lang['Search_msg_only']

User avatar
drathbun
Former Team Member
Posts: 12204
Joined: Thu Jun 06, 2002 3:51 pm
Location: TOPICS_TABLE
Contact:

Post by drathbun » Fri Dec 16, 2005 3:10 am

If I remember correctly, that "find" is followed by an "after, add" operation. All you need to do is open the appropriate language file (lang_main.php) and insert the required line of text anywhere above the closing ?> at the end of the file. It does not have to be in any particular order.

I apologize, but I do not use EasyMOD, so I cannot make any suggestions as to how to make it work.
I blog about phpBB: phpBBDoctor blog
Still using phpbb2? So am I! Click below for details
Image

Drakia
Registered User
Posts: 1
Joined: Tue Apr 29, 2003 12:55 pm
Location: BC, Canada
Contact:

Post by Drakia » Thu Jan 19, 2006 2:02 am

Hi, I installed your mod and I like it, but one problem I found is that even if you search for just topic titles, it still searches the posts text before returning your results. The error is here

Code: Select all

							switch ( $search_fields )
							{
								case SEARCH_MESSAGE_ONLY :
									$search_sql = '';
									break;
								case SEARCH_ENTIRE_MESSAGE :
									$search_sql = "OR post_subject LIKE '$match_word'";
									break;
								case SEARCH_TITLE_ONLY :
									$search_sql = "AND post_subject LIKE '$match_word'";
									break;
								default :
									$search_sql = '';
							}
							$sql = "SELECT post_id
								FROM " . POSTS_TEXT_TABLE . "
								WHERE post_text LIKE '$match_word'
								$search_sql";
If you look, it searches post_text no matter what you are searching for, I resolved this by changing those lines to this

Code: Select all

							switch ( $search_fields )
							{
								case SEARCH_MESSAGE_ONLY :
									$search_sql = "post_text LIKE '$match_word'";
									break;
								case SEARCH_ENTIRE_MESSAGE :
									$search_sql = "post_text LIKE '$match_word' OR post_subject LIKE '$match_word'";
									break;
								case SEARCH_TITLE_ONLY :
									$search_sql = "post_subject LIKE '$match_word'";
									break;
								default :
									$search_sql = "post_text LIKE '$match_word'";
							}
							$sql = "SELECT post_id
								FROM " . POSTS_TEXT_TABLE . "
								WHERE $search_sql";
I hope this helps with the development of this mod :)

FoulFoot
Registered User
Posts: 261
Joined: Mon Jun 23, 2003 1:04 am
Location: Honolulu, HI
Contact:

Post by FoulFoot » Sat Jan 28, 2006 9:31 pm

I must be missing something here... Drakia, I couldn't find anything similar to your code either in search.php or in this mod.

Foul

Ibrin
Registered User
Posts: 22
Joined: Wed Feb 08, 2006 10:07 pm
Contact:

Post by Ibrin » Wed Feb 08, 2006 10:18 pm

I installed this mod, and while the new search function works, the title for the first search option is gone. I'm using the subPortal theme, but the search_body.tpl files were virtually identical. Can't figure out what went wrong, and help would be appreciated.

http://www.widescreengamingforum.com/forum/search.php

lang_main.php

Code: Select all

//
// Search
//
$lang['Search_query'] = 'Search Query';
$lang['Search_options'] = 'Search Options';

$lang['Search_keywords'] = 'Search for Keywords';
$lang['Search_keywords_explain'] = 'You can use <u>AND</u> to define words which must be in the results, <u>OR</u> to define words which may be in the result and <u>NOT</u> to define words which should not be in the result. Use * as a wildcard for partial matches';
$lang['Search_author'] = 'Search for Author';
$lang['Search_author_explain'] = 'Use * as a wildcard for partial matches';

$lang['Search_for_any'] = 'Search for any terms or use query as entered';
$lang['Search_for_all'] = 'Search for all terms';
$lang['Search_title_msg'] = 'Search topic title and message text';
$lang['Search_msg_only'] = 'Search message text only';
// BEGIN Search Titles Only Mod
$lang['Search_title_only'] = 'Search message title only';
// END Search Titles Only Mod
search_body.tpl

Code: Select all

<form action="{S_SEARCH_ACTION}" method="POST"><table width="100%" cellspacing="2" cellpadding="2" border="0" align="center">
	<tr> 
		<td align="left"><span class="nav"><a href="{U_INDEX}" class="nav">{L_INDEX}</a></span></td>
	</tr>
</table>

<table class="forumline" width="100%" cellpadding="4" cellspacing="1" border="0">
	<tr> 
		<th class="thHead" colspan="4" height="25">{L_SEARCH_QUERY}</th>
	</tr>
	<tr> 
		<td class="row1" colspan="2" width="50%"><span class="gen">{L_SEARCH_KEYWORDS}:</span><br /><span class="gensmall">{L_SEARCH_KEYWORDS_EXPLAIN}</span></td>
		<td class="row2" colspan="2" valign="top"><span class="genmed"><input type="text" style="width: 300px" class="post" name="search_keywords" size="30" /><br /><input type="radio" name="search_terms" value="any"/> {L_SEARCH_ANY_TERMS}<br /><input type="radio" name="search_terms" value="all" checked="checked" /> {L_SEARCH_ALL_TERMS}</span></td>
	</tr>
	<tr> 
		<td class="row1" colspan="2"><span class="gen">{L_SEARCH_AUTHOR}:</span><br /><span class="gensmall">{L_SEARCH_AUTHOR_EXPLAIN}</span></td>
		<td class="row2" colspan="2" valign="middle"><span class="genmed"><input type="text" style="width: 300px" class="post" name="search_author" size="30" /></span></td>
	</tr>
	<tr> 
		<th class="thHead" colspan="4" height="25">{L_SEARCH_OPTIONS}</th>
	</tr>
	<tr> 
		<td class="row1" align="right"><span class="gen">{L_FORUM}:&nbsp;</span></td>
		<td class="row2"><span class="genmed"><select class="post" name="search_forum">{S_FORUM_OPTIONS}</select></span></td>
		<td class="row1" align="right" nowrap="nowrap"><span class="gen">{L_SEARCH_PREVIOUS}:&nbsp;</span></td>
		<td class="row2" valign="middle"><span class="genmed"><select class="post" name="search_time">{S_TIME_OPTIONS}</select><br /><input type="radio" name="search_fields" value="all" checked="checked" /> {L_SEARCH_MESSAGE_TITLE}<br /><input type="radio" name="search_fields" value="msgonly" /> {L_SEARCH_MESSAGE_ONLY}<br /><input type="radio" name="search_fields" value="titleonly" /> {L_SEARCH_TITLE_ONLY}</span></td>
	</tr>
	<tr> 
		<td class="row1" align="right"><span class="gen">{L_CATEGORY}:&nbsp;</span></td>
		<td class="row2"><span class="genmed"><select class="post" name="search_cat">{S_CATEGORY_OPTIONS}
		</select></span></td>
		<td class="row1" align="right"><span class="gen">{L_SORT_BY}:&nbsp;</span></td>
		<td class="row2" valign="middle" nowrap="nowrap"><span class="genmed"><select class="post" name="sort_by">{S_SORT_OPTIONS}</select><br /><input type="radio" name="sort_dir" value="ASC" /> {L_SORT_ASCENDING}<br /><input type="radio" name="sort_dir" value="DESC" checked /> {L_SORT_DESCENDING}</span>&nbsp;</td>
	</tr>
	<tr> 
		<td class="row1" align="right" nowrap="nowrap"><span class="gen">{L_DISPLAY_RESULTS}:&nbsp;</span></td>
		<td class="row2" nowrap="nowrap"><input type="radio" name="show_results" value="posts" /><span class="genmed">{L_POSTS}<input type="radio" name="show_results" value="topics" checked="checked" />{L_TOPICS}</span></td>
		<td class="row1" align="right"><span class="gen">{L_RETURN_FIRST}</span></td>
		<td class="row2"><span class="genmed"><select class="post" name="return_chars">{S_CHARACTER_OPTIONS}</select> {L_CHARACTERS}</span></td>
	</tr>
	<tr> 
		<td class="catBottom" colspan="4" align="center" height="28">{S_HIDDEN_FIELDS}<input class="liteoption" type="submit" value="{L_SEARCH}" /></td>
	</tr>
</table>

<table width="100%" cellspacing="2" cellpadding="2" border="0" align="center">
	<tr> 
		<td align="right" valign="middle"><span class="gensmall">{S_TIMEZONE}</span></td>
	</tr>
</table></form>

<table width="100%" border="0">
	<tr>
		<td align="right" valign="top">{JUMPBOX}</td>
	</tr>
</table>
constants.php

Code: Select all

// BEGIN Search Titles Only Mod
define(SEARCH_ENTIRE_MESSAGE, 0);
define(SEARCH_MESSAGE_ONLY, 1);
define(SEARCH_TITLE_ONLY, 2);
// END Search Titles Only Mod
?>
search.php

Code: Select all

// BEGIN Search Titles Only Mod
	switch ( $HTTP_POST_VARS['search_fields'] )
	{
		case 'all' :
			$search_fields = SEARCH_ENTIRE_MESSAGE;
			break;
		case 'msgonly' :
			$search_fields = SEARCH_MESSAGE_ONLY;
			break;
		case 'titleonly' :
			$search_fields = SEARCH_TITLE_ONLY;
			break;
		default :
			$search_fields = SEARCH_ENTIRE_MESSAGE;
			break;
	}
	// END Search Titles Only Mod

Post Reply

Return to “[2.0.x] MOD Database Cleanup”