[Beta] Sphinx search for phpBB 1.0.beta2

A place for MOD Authors to post and receive feedback on MODs still in development. No MODs within this forum should be used within a live environment!
Scam Warning
User avatar
4_seven
I've Been Banned!
Posts: 5155
Joined: Wed Apr 30, 2008 1:41 am

Re: [Beta] Sphinx search for phpBB 1.0.beta2

Post by 4_seven » Sun May 13, 2012 7:53 pm

Thanks again, dude..
Current Mods | Mod Base | php(BB) programming | No help via PM

User avatar
Kamahl19
Registered User
Posts: 1598
Joined: Tue Nov 06, 2007 3:33 pm
Location: Slovakia
Name: Martin
Contact:

Re: [Beta] Sphinx search for phpBB 1.0.beta2

Post by Kamahl19 » Sun May 13, 2012 10:17 pm

Guys, could you put all RIGHT edits to one post please? :) Thanks

baller1234
Registered User
Posts: 129
Joined: Sat May 29, 2010 9:43 am

Re: [Beta] Sphinx search for phpBB 1.0.beta2

Post by baller1234 » Mon May 14, 2012 3:12 pm

Kamahl19 wrote:Guys, could you put all RIGHT edits to one post please? :) Thanks

Well in the beginning this did not work for me so i tried the edits from some posts i found.. Then it worked ok but only for results on 1 page. the rest of the pages did not work. THen i just copied the file from figvam over again to start fresh. ( fulltext_sphinx.php) and did this edit: http://www.phpbb.com/community/viewtopi ... #p13146451

Now it seems to work very good!

Greetz

baller1234
Registered User
Posts: 129
Joined: Sat May 29, 2010 9:43 am

Re: [Beta] Sphinx search for phpBB 1.0.beta2

Post by baller1234 » Sun May 20, 2012 9:41 am

baller1234 wrote:
Kamahl19 wrote:Guys, could you put all RIGHT edits to one post please? :) Thanks

Well in the beginning this did not work for me so i tried the edits from some posts i found.. Then it worked ok but only for results on 1 page. the rest of the pages did not work. THen i just copied the file from figvam over again to start fresh. ( fulltext_sphinx.php) and did this edit: http://www.phpbb.com/community/viewtopi ... #p13146451

Now it seems to work very good!

Greetz
I reinstalled sphinx on a new server with all the edits and now it works like it should.. Above worked also but then you dont have recent searches. (bottom search.php) Now all works fine!!

PS. Use sphinx manualy instead of auto. (acp) Just create a cronjob like this where /home/sphinx/conf/ is your conf path:

Code: Select all

*/1 * * * * /usr/local/bin/indexer --config /home/sphinx/conf/sphinx.conf --merge index_114a_main index_114a_delta --quiet --rotate
*/1 * * * * /usr/local/bin/indexer --config /home/sphinx/conf/sphinx.conf index_114a_delta --quiet --rotate
##start searchd with reboot
@reboot /usr/local/bin/searchd --config /home/sphinx/conf/sphinx.conf

Then start the searchd like this:

Code: Select all

/usr/local/bin/searchd --config /home/sphinx/conf/sphinx.conf
Also when you get this error:

Code: Select all

WARNING: key 'address' is deprecated in /home/sphinx/conf/sphinx.conf line 9
8; use 'listen' instead.
Fix it with this:
edit sphinx.conf
FIND:

Code: Select all

	address = 127.0.0.1 
	port = 3312 
REPLACE:

Code: Select all

       listen = 127.0.0.1:3312
OPEN:

Code: Select all

fulltext_sphinx.php
FIND:

Code: Select all

require($phpbb_root_path . "includes/sphinxapi-0.9.8." . $phpEx);
AFTER ADD:

Code: Select all

include_once($phpbb_root_path . 'includes/search/search.' . $phpEx);
FIND:

Code: Select all

class fulltext_sphinx
REPLACE:

Code: Select all

class fulltext_sphinx extends search_backend
FIND:

Code: Select all

		// No keywords? No posts.
		if (!strlen($this->search_query) && !sizeof($author_ary))
		{
			return false;
		}
ADD AFTER:

Code: Select all

// (c) Pandora
             // generate a search_key from all the options to identify the results
             $search_key = md5(implode('#', array(
                 $this->search_query,
                 $type,
                 $fields,
                 $terms,
                 $sort_days,
                 $sort_key,
                 $topic_id,
                 implode(',', $ex_fid_ary),
                 implode(',', $m_approve_fid_ary),
                 implode(',', $author_ary)
             )));
    
             // try reading the results from cache
             $result_count = 0;
             if (false && $this->obtain_ids($search_key, $result_count, $id_ary, $start, $per_page, $sort_dir) == SEARCH_RESULT_IN_CACHE)
             {
                 return $result_count;
         }

// (c) Pandora

FIND:

Code: Select all

          $result = $this->sphinx->Query($search_query_prefix . str_replace('"', '"', $this->search_query), $this->indexes);

          // could be connection to localhost:3312 failed (errno=111, msg=Connection refused) during rotate, retry if so
          $retries = CONNECT_RETRIES;
          while (!$result && (strpos($this->sphinx->_error, "errno=111,") !== false) && $retries--)
          {
             usleep(CONNECT_WAIT_TIME);
             $result = $this->sphinx->Query($search_query_prefix . str_replace('"', '"', $this->search_query), $this->indexes);
          }
REPLACE:

Code: Select all

          $result = $this->sphinx->Query($search_query_prefix . $this->sphinx->EscapeString(str_replace('"', '"', $this->search_query)), $this->indexes);

          // could be connection to localhost:3312 failed (errno=111, msg=Connection refused) during rotate, retry if so
          $retries = CONNECT_RETRIES;
          while (!$result && (strpos($this->sphinx->_error, "errno=111,") !== false) && $retries--)
          {
             usleep(CONNECT_WAIT_TIME);
             $result = $this->sphinx->Query($search_query_prefix . $this->sphinx->EscapeString(str_replace('"', '"', $this->search_query)), $this->indexes);
          }


FIND:

Code: Select all

$result_count = $result['total_found'];
ADD AFTER:

Code: Select all

// store the ids, from start on then delete anything that isn't on the current page because we only need ids for one page
$this->save_ids($search_key, $this->search_query, $author_ary, $result_count, $id_ary, $start, $sort_dir);

SuperFedya
Registered User
Posts: 248
Joined: Sun Jul 14, 2002 9:14 pm
Contact:

Re: [Beta] Sphinx search for phpBB 1.0.beta2

Post by SuperFedya » Fri Jun 01, 2012 2:15 am

Is this module works fine with 3.0.10? Can I install the last version of Sphinx 2.0.4?

Thanks

baller1234
Registered User
Posts: 129
Joined: Sat May 29, 2010 9:43 am

Re: [Beta] Sphinx search for phpBB 1.0.beta2

Post by baller1234 » Fri Jun 01, 2012 7:06 am

SuperFedya wrote:Is this module works fine with 3.0.10? Can I install the last version of Sphinx 2.0.4?

Thanks
Yes you can.. just follow what i wrote

artikkk
Registered User
Posts: 379
Joined: Sun Jan 04, 2009 1:37 pm
Location: Roma

Re: [Beta] Sphinx search for phpBB 1.0.beta2

Post by artikkk » Fri Jun 01, 2012 6:03 pm

Where do i find install instructions?
Thank you, i have downloaded sphinx 2.0.4 for Linux server
sorry for my bad english :S

User avatar
AmigoJack
Registered User
Posts: 5657
Joined: Tue Jun 15, 2010 11:33 am
Location: グリーン ヒル ゾーン
Contact:

Re: [Beta] Sphinx search for phpBB 1.0.beta2

Post by AmigoJack » Mon Dec 17, 2012 1:25 pm

Up until today it did silently ignore the time filter and nobody noticed, so you're unable to find posts/topics for just the last 30 days and likewise (bug ticket 63279).

Looking at /sphinx_plugin/includes/search/fulltext_sphinx.php it should work by finding:

Code: Select all

$this->sphinx->SetFilter('deleted', array(0)); 
...and after that adding:

Code: Select all

if( $sort_days ) $this-> sphinx-> SetFilterRange( 'post_time', time()- $sort_days* 86400, PHP_INT_MAX ); 
However, I have no chance to test it.
Last edited by AmigoJack on Wed Dec 19, 2012 9:15 pm, edited 1 time in total.
The worst thing about censorship is ███████████
Affin wrote:
Tue Nov 20, 2018 9:51 am
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.

_Maxxi_
Registered User
Posts: 31
Joined: Thu Jul 17, 2008 9:02 pm

Re: [Beta] Sphinx search for phpBB 1.0.beta2

Post by _Maxxi_ » Wed Dec 19, 2012 8:38 pm

AmigoJack wrote:

Code: Select all

$this->sphinx->SetFilterRange('post_time', time()- $sort_days* 86400, PHP_INT_MAX);
what if $sort_days == 0 (by default). There is no search result.

User avatar
AmigoJack
Registered User
Posts: 5657
Joined: Tue Jun 15, 2010 11:33 am
Location: グリーン ヒル ゾーン
Contact:

Re: [Beta] Sphinx search for phpBB 1.0.beta2

Post by AmigoJack » Wed Dec 19, 2012 9:17 pm

True. Fixed my post by adding a condition.
The worst thing about censorship is ███████████
Affin wrote:
Tue Nov 20, 2018 9:51 am
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.

_Maxxi_
Registered User
Posts: 31
Joined: Thu Jul 17, 2008 9:02 pm

Re: [Beta] Sphinx search for phpBB 1.0.beta2

Post by _Maxxi_ » Wed Dec 19, 2012 9:30 pm

AmigoJack wrote:True. Fixed my post by adding a condition.
should be ok. :)

Holger
Registered User
Posts: 1761
Joined: Tue Mar 12, 2002 3:54 pm
Location: Hannover

Re: [Beta] Sphinx search for phpBB 1.0.beta2

Post by Holger » Thu Dec 20, 2012 7:52 am

Could someone please explain how this mod handles the phpBB permissions?

User avatar
Marcus Wendel
Registered User
Posts: 534
Joined: Sun Mar 10, 2002 5:58 pm
Location: Sweden
Contact:

Re: [Beta] Sphinx search for phpBB 1.0.beta2

Post by Marcus Wendel » Mon Mar 04, 2013 8:16 pm

Holger wrote:Could someone please explain how this mod handles the phpBB permissions?
I am also interested in this question. Does it consider which forums and sub-forums a user have access to when showing the results?

/Marcus

User avatar
muggins
Registered User
Posts: 1183
Joined: Fri Feb 22, 2008 5:12 pm
Location: Texas
Name: Donovan
Contact:

Re: [Beta] Sphinx search for phpBB 1.0.beta2

Post by muggins » Tue Mar 05, 2013 2:25 am

I've been looking at this one for a while. Just bookmarking.. :)
Muggins

User avatar
Kamahl19
Registered User
Posts: 1598
Joined: Tue Nov 06, 2007 3:33 pm
Location: Slovakia
Name: Martin
Contact:

Re: [Beta] Sphinx search for phpBB 1.0.beta2

Post by Kamahl19 » Sun May 05, 2013 3:51 pm

Hi guys,

is this working with phpBB3.0.11 and Sphinx 2.0.7 ?

Thanks

Locked

Return to “[3.0.x] MODs in Development”