[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

Extensions Robot
Extensions Robot
Extensions Robot
Posts: 27740
Joined: Sat Aug 16, 2003 7:36 am

[2.0.15] Search Title Only

Post by Extensions Robot » Tue Jun 14, 2005 10:06 pm

MOD Name: Search Title Only
Author: drathbun
MOD Description: In the standard search feature you can search title+message, or just message, but not just the title. The MOD provides that function.


MOD Version: 1.0.0

Download File: search_titles_only.zip
mods overview page: View
File Size: 1779 Bytes

Security Score: 0
Last edited by Extensions Robot on Mon Apr 30, 2007 12:28 am, edited 1 time in total.
(this is a non-active account manager for the phpBB Extension Customisations Team)

User avatar
TerraFrost
Former Team Member
Posts: 5957
Joined: Sun Dec 26, 2004 3:40 am
Location: Austin, TX

Post by TerraFrost » Wed Jun 15, 2005 7:15 pm

MOD Validated/Released

Notes:
Allows threads to be searched for by title, alone.

User avatar
amjohnno
Registered User
Posts: 132
Joined: Mon Feb 14, 2005 3:19 pm
Location: Derby
Contact:

Post by amjohnno » Thu Jun 16, 2005 6:47 am

Works a treat. Thanks. :D
DVDs and Stuff.net
"I would like to say hello to my parents and my Shoalin Master, but they are all dead"

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

Post by leecovuk » Mon Jun 20, 2005 1:57 pm

Hello,

I've also installed this mod and it seems fine.

I may have to make a new thread for this point, but I may as well try it here :-

Does anyone else think that the phpBB search function below is strangely worded, and doesn't work as you would logically expect :

"Search for any terms or use query as entered"

This says to me that I should be able to enter a collection of words OR a phrase, then any search results will somehow show both sets of results.
However, using this function seems to ignore the 'use query as entered' part, and search results include any of the words but _not_ the phrase.

Do you know what I mean? The 'use query as entered' seems like a meaningless piece of advice.

Is there a mod to do a 'phrase search' or improve this situation?
If not, I may have to hack away at search.php or somewhere to make the above description less misleading to users.

Many thanks,
Lee

hojko
Registered User
Posts: 69
Joined: Wed Aug 11, 2004 2:20 am
Location: Slovakia

Post by hojko » Wed Jun 22, 2005 10:15 pm

Great, works fine... cool mod :)

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

Post by drathbun » Wed Jun 29, 2005 6:43 pm

leecovuk wrote: Does anyone else think that the phpBB search function below is strangely worded, and doesn't work as you would logically expect :

"Search for any terms or use query as entered"

This says to me that I should be able to enter a collection of words OR a phrase, then any search results will somehow show both sets of results.
However, using this function seems to ignore the 'use query as entered' part, and search results include any of the words but _not_ the phrase.

Do you know what I mean? The 'use query as entered' seems like a meaningless piece of advice.

It means that you can enter

Code: Select all

cake and ice and cream
and it will be the same as entering

Code: Select all

cake ice cream
and checking the "all" words. In other words, the "use query as entered" allows the user to use boolean logic to combine (include / exclude) words for their search. So you can do this

Code: Select all

cake and pie and not chocolate
and you'll find topics with the words cake and pie but exclude those that include the word chocolate. Make sense?
Is there a mod to do a 'phrase search' or improve this situation?
If not, I may have to hack away at search.php or somewhere to make the above description less misleading to users.

I've been reviewing what would be required to add a phrase search, but it's been on the back burner for a while. It's not really a trivial process. I am not aware of an existing MOD that do this, but that doesn't mean that there isn't one out there. :-)
I blog about phpBB: phpBBDoctor blog
Still using phpbb2? So am I! Click below for details
Image

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

Post by leecovuk » Wed Jun 29, 2005 7:36 pm

thanks, I think I understand. However I think it sounds a little too complex for most average users to be bothered with.
I think many if not most people would interpret the description as a phrase search, as indeed I did.
eg they would probably type in:
ice cream
and expect to find only results featuring that phrase.

I have recently re-worded the description to explain it is not a phrase search!

Some people have said that the reason for not implementing a phrase search is it would cause a too high demand on MySql, or something ...
I don't understand why though. Surely a 'X+Y' search isn't more complex for MySql to handle than an 'XandY' or 'XorY' search?

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

Post by drathbun » Wed Jun 29, 2005 11:18 pm

The search process for phpBB is such that it would first find the word "ice" and then the word "cream", which are stored in a database table of all the unique words. Then it uses the word_id values to get a list of posts that contain those words, which is another fast (because of indexes) search. Finally, it merges the two sets of posts together, resulting in a list of posts with ice and cream or ice or cream depending on the way the user entered their search parameters.

In other words, the actual text of the post is never searched at all, making it much different than a phrase search would be. In testing, some folks with very large boards have reported that using the MySQL "fulltext" search actually is slower, despite expectations to the contrary. So the approach I am planning on taking, should I ever get around to it, is to apply the current search logic to return the list of posts that contain both words, and then "re-search" that set of posts using a brute force text search, but only after initially reducing the number of posts to search. I intend to make it customizable via the admin control panel so the board owner can set the maximum number of posts to search... sort of a "flood control" for searches.

I expect to have this done by 2010. :D
I blog about phpBB: phpBBDoctor blog
Still using phpbb2? So am I! Click below for details
Image

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

Post by leecovuk » Thu Jun 30, 2005 12:54 am

ok, sounds complex.
Good luck if you set about it !

Terrorfrodo
Registered User
Posts: 26
Joined: Mon Mar 14, 2005 11:34 pm

Post by Terrorfrodo » Thu Jul 21, 2005 6:00 pm

good mod, thanks a lot!

dcz
Registered User
Posts: 787
Joined: Sun Feb 13, 2005 5:37 am
Contact:

yes

Post by dcz » Fri Jul 22, 2005 8:14 pm

I have been searching for that for months!!! and it was here lol

So At first I wanted to make it possible to use searche queries to filter post grouped into catégories by title.

Here is the thing : when performing a search in phpbb, the result url is always like this :

-http://www.example.com/phpBB/search.php?mode=results whatever the request.

But it is possible tu use this also :

-http://www.example.com/phpBB/search.php ... r+keywords

Then if you for example start a forum about mods, you 'll might want to ordonate the way topics are named, like telling people to put a [mod] or [beta] or [request] in their topic title.

Then, a very quick way to folow them by categorie is to use links such as :

-http://www.example.com/phpBB/search.php ... ords=[beta]

That can be put everywhere.

But at first results are not ok, because for this to work, the search as to be made on all words, and performed on topic title only.

Thanks to this great mod and to few default values change in search.php I am able to do links of this type :

http://www.marsatak.org/marsforum/searc ... _keywords=[video+site]

that shows all topics of this specific catégorie, and them only. :)

There are ways to do this without changing the default search values using HTTP_GET_VARS that allow to include more stuf in the url, but in the end, as those value will only be used for an url search query (when searching with search page, the normal value set is kept by default on it and everything works fine), I don't see the need to go further into coding.

So here are my few changes :

Code: Select all

####add on to this mod : link to specific searches and group topics by catégorie based on their title#####
#
#OPEN
#
search.php

#
#Find
#

$show_results = ( isset($HTTP_POST_VARS['show_results']) ) ? $HTTP_POST_VARS['show_results'] : 'topics';
$show_results = ($show_results == 'posts') ? 'posts' : 'posts'; 

#
#REPLACE WITH ##This will show result as topic and not posts
#

$show_results = ( isset($HTTP_POST_VARS['show_results']) ) ? $HTTP_POST_VARS['show_results'] : 'topics';
$show_results = ($show_results == 'posts') ? 'posts' : 'topics'; 

#
#FIND
#

if ( isset($HTTP_POST_VARS['search_terms']) )
{
   $search_terms = ( $HTTP_POST_VARS['search_terms'] == 'all' ) ? 1 : 0;
}
else
{
   $search_terms = 0;
} 

#
#REPLACE WITH ##This will perform the search on all terms by default
#

if ( isset($HTTP_POST_VARS['search_terms']) )
{
   $search_terms = ( $HTTP_POST_VARS['search_terms'] == 'all' ) ? 1 : 0;
}
else
{
   $search_terms = 1;
} 

#
#FIND
#

$sort_by = ( isset($HTTP_POST_VARS['sort_by']) ) ? intval($HTTP_POST_VARS['sort_by']) : 0; 

#
# ##There you can chose the way the search result will be sorted
# ##0 = by time, 1 by topic, 2 by title, 3 = user name et 4 = forum. 
#

#
# ##This mod must be installed in order to add the ability to perform a 
# ##search on topic titles only.
# ##Then to set the default value on search on title only :
#

#
#IN THE MOD'S CODE FIND
#

   // BEGIN Search Titles Only 1.0.0 (www.phpBBDoctor.com)
   $search_fields = SEARCH_ENTIRE_MESSAGE;
   // END Search Titles Only 1.0.0 (www.phpBBDoctor.com) 

#
#REPLACE WITH
#

   // BEGIN Search Titles Only 1.0.0 (www.phpBBDoctor.com)
   $search_fields = SEARCH_TITLE_ONLY;
   // END Search Titles Only 1.0.0 (www.phpBBDoctor.com) 

###EOM

Thanks again for this mod.

++

dcz

phpBB SEO || phpBB3 SEO Premod || SEO phpBB3
GYM Sitemaps & RSS for phpBB3: GYM Sitemaps & RSS

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

Post by drathbun » Mon Jul 25, 2005 1:19 am

Thanks for sharing. :-) One bit of advice... don't trust input that comes from a GET variable without validation. Once you open things up so that people can type whatever they want on the URL, you need to really be careful what you do with it. If you aren't sure what "sql injection" means, do a google and you'll get some hints as to what might be in your future if you're not careful.
I blog about phpBB: phpBBDoctor blog
Still using phpbb2? So am I! Click below for details
Image

dcz
Registered User
Posts: 787
Joined: Sun Feb 13, 2005 5:37 am
Contact:

sure

Post by dcz » Mon Jul 25, 2005 7:53 am

Sure,
but here I am not adding any GET var, I am just using the ones that are already used (eg keywords, you can use url like -http://www.example.com/phpBB/search.php ... r+keywords
on non moded boards, but the results will be shown as post, the search will be performed on all text, messages + titles, but not on all keywords, and sorting will be made by date, that's all), so I assume this gives the same security level as the regular phpbb, I just changed default vars that's all.

For sure for a board like this, A good thing would be to cach this type of link as a search query could be a heavy load on the sever.

++

phpBB SEO || phpBB3 SEO Premod || SEO phpBB3
GYM Sitemaps & RSS for phpBB3: GYM Sitemaps & RSS

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

Post by bigbear » Thu Aug 11, 2005 4:47 pm

I have some problems with this part here:

Code: Select all

#
#-----[ FIND ]-------------------------------------
#
							$sql = "SELECT m.post_id 
								FROM " . SEARCH_WORD_TABLE . " w, " . SEARCH_MATCH_TABLE . " m 
								WHERE w.word_text LIKE '$match_word' 
									AND m.word_id = w.word_id 
									AND w.word_common <> 1 
									$search_msg_only";



#
#-----[ REPLACE WITH ]-------------------------------------
#
							// BEGIN Search Titles Only 1.0.0 (www.phpBBDoctor.com)
							$sql = 'SELECT 	m.post_id
								FROM 	' . SEARCH_WORD_TABLE . ' w
								, 	' . SEARCH_MATCH_TABLE . " m
								WHERE w.word_text LIKE '$match_word'
								AND m.word_id = w.word_id
								AND w.word_common <> 1
									$search_word_sql";
							// END Search Titles Only 1.0.0 (www.phpBBDoctor.com)
There's a parse error message with the start of the replacement line.
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 » Thu Aug 11, 2005 7:39 pm

bigbear wrote: I have some problems with this part here:

...
There's a parse error message with the start of the replacement line.

Please check your edits to make sure everything is correct; there are some tricky switches between single and double quotes in that entry. Also please post the error. Just saying there's a "parse error" doesn't help much. ;-)
I blog about phpBB: phpBBDoctor blog
Still using phpbb2? So am I! Click below for details
Image

Post Reply

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

Who is online

Users browsing this forum: No registered users and 12 guests