Plus Minus feature in searchbox

Get help with installation and running phpBB 3.0.x here. Please do not post bug reports, feature requests, or MOD-related questions here.
Ideas Centre
Forum rules
END OF SUPPORT: 1 January 2017 (announcement)
MaFeSa
Registered User
Posts: 175
Joined: Wed Feb 11, 2009 7:48 am

Re: Plus Minus feature in searchbox

Post by MaFeSa »

MaFeSa wrote: Is possible do the same thing also with fulltext natives?
Probably the easiest way is to add the AmigoJack's code on search.php in this section:

Code: Select all

	// let the search module split up the keywords
	if ($keywords)
	{
		$correct_query = $search->split_keywords($keywords, $search_terms);
		if (!$correct_query || (empty($search->search_query) && !sizeof($author_id_ary) && !$search_id))
		{
			$ignored = (sizeof($search->common_words)) ? sprintf($user->lang['IGNORED_TERMS_EXPLAIN'], implode(' ', $search->common_words)) . '<br />' : '';
			trigger_error($ignored . sprintf($user->lang['NO_KEYWORDS'], $search->word_length['min'], $search->word_length['max']));
		}
	}
In this way MySQL and native searches will be fixed, but how add the code? :(
User avatar
Leinad4Mind
Translator
Posts: 859
Joined: Sun Jun 01, 2008 11:08 pm
Contact:

Re: Plus Minus feature in searchbox

Post by Leinad4Mind »

"split_keywords($keywords, $search_terms)" is a function present on fulltext_mysql.php and fulltext_native.php.

AmigoJack has done for the fulltext_mysql, you need an edit on that function on fulltext_native. ;)

And I've test out one little thing, and it seems it work like you want:

EDIT:

FIND:

Code: Select all

if ($open_bracket !== false)
Than FIND:

Code: Select all

case '-':
ADD AFTER:

Code: Select all

						$keywords[$i] = '|';
					break;
FIND:

Code: Select all

case '-':
(yes, the 2º "case '-':")

ADD AFTER:

Code: Select all

						if ($keywords[$i-1] !== ' ')
						{
							$keywords[$i] = ' ';
						}
					break;
Tell me if it worked.

Best Regards
Want to access all my portuguese MOD and Extension translations?
Become my Patreon!
phpBB Portugal Translator and Moderator
User avatar
Lumpy Burgertushie
Registered User
Posts: 68587
Joined: Mon May 02, 2005 3:11 am
Contact:

Re: Plus Minus feature in searchbox

Post by Lumpy Burgertushie »

did you notice how old the post is that you replied to here?


robert
I'm baaaaaccckkkk. still doing work on donation basis. PM your needs.

Premium phpBB 3.3 Styles by PlanetStyles.net

I am pleased to announce that I have completed the first item on my bucket list. I have the bucket.
User avatar
Leinad4Mind
Translator
Posts: 859
Joined: Sun Jun 01, 2008 11:08 pm
Contact:

Re: Plus Minus feature in searchbox

Post by Leinad4Mind »

Yes, I did. But I also notice the last post of it. And it was just some months ago.

And if it doesnt solve this last user in question. I hope it can help others with the same problem in the future.

Best Regards
Want to access all my portuguese MOD and Extension translations?
Become my Patreon!
phpBB Portugal Translator and Moderator
MaFeSa
Registered User
Posts: 175
Joined: Wed Feb 11, 2009 7:48 am

Re: Plus Minus feature in searchbox

Post by MaFeSa »

With phpBB 3.0.12 fulltext_mysql works fine, i will test your solution for fulltext_native soon.
Thanks!

[URL removed]
Last edited by Mick on Fri Nov 29, 2013 6:25 pm, edited 1 time in total.
Reason: Removed unnecessary URL
MaFeSa
Registered User
Posts: 175
Joined: Wed Feb 11, 2009 7:48 am

Re: Plus Minus feature in searchbox

Post by MaFeSa »

Leinad4Mind wrote:
Tell me if it worked.

Best Regards
Hi, with phpbb 3.0.12 I get a white page when I try to change a search setting on administration ACP :roll:
Please note that search now is perfect and this patch should be added on phpBB 3.0.13 and 3.1
Thanks
MaFeSa
Registered User
Posts: 175
Joined: Wed Feb 11, 2009 7:48 am

Re: Plus Minus feature in searchbox

Post by MaFeSa »

MaFeSa wrote:I get a white page when I try to change a search setting on administration ACP
Sorry it was a problem with editor :mrgreen:
MaFeSa wrote: search now is perfect and this patch should be added on phpBB 3.0.13 and 3.1
Link

Thanks again Leinad4Mind and AmigoJack
midomidi2013
I am too lazy to register

Re: Plus Minus feature in searchbox

Post by midomidi2013 »

This will negate the inclusion/exclusion functions of the search, but my band-aid solution was to modify root/search.php to include this line (sometime after $keywords is assigned):

[spam removed- Marshalrusty]

Code: Select all

$keywords = str_replace('-', ' ', $keywords);
This effectively converts the "temp-table" search string to "temp table".

With some more time, this could be improved to only work on "string-string" instead of "string -string" or "-string", but our needs lean much more towards recognizing hyphens in the string than being able to exclude a string from the search.

If anyone is better at regexps than me, please feel free to contribute a "better" solution
Last edited by midomidi2013 on Wed Mar 12, 2014 9:25 pm, edited 2 times in total.
User avatar
AmigoJack
Registered User
Posts: 5921
Joined: Tue Jun 15, 2010 11:33 am
Location: グリーン ヒル ゾーン
Contact:

Re: Plus Minus feature in searchbox

Post by AmigoJack »

midomidi2013 wrote:If anyone is better at regexps
You obviously haven't read my post.
  • "The problem is probably not my English but you do not want to understand correctly. ... We will not come anybody anyway, nevertheless, it's best to shit this." Affin, 2018-11-20
  • "But this shit is not here for you. You can follow with your. Maybe the question, instead, was for you, who know, so you shoved us how you are." axe70, 2020-10-10
  • "My reaction is not to everyone, especially to you." Raptiye, 2021-02-28
MaFeSa
Registered User
Posts: 175
Joined: Wed Feb 11, 2009 7:48 am

Re: Plus Minus feature in searchbox

Post by MaFeSa »

Solution posted here works very well with fulltext native and there are no problems with inclusion/exclusion functions of the search.
Locked

Return to “[3.0.x] Support Forum”