Page 1 of 1

Sphinx search does not work

Posted: 14 Jul 2013, 16:45
by lem0na
Hi all,

I was trying to enable Sphinx search, Have confugured it like docs say. Index is created and regulary updated via cron.
I have tried to debug it on my laptop and I got this in error log:

[Sun Jul 14 19:33:00 2013] [error] [client 172.16.223.2] PHP Fatal error: Cannot redeclare class SphinxClient in /var/www/rss.localhost/htdocs/tt-rss/lib/sphinxapi.php on line 385, referer: http://rss.localhost/index.php?XDEBUG_S ... ans-xdebug
[Sun Jul 14 19:33:00 2013] [error] [client 172.16.223.2] PHP Stack trace:, referer: http://rss.localhost/index.php?XDEBUG_S ... ans-xdebug
[Sun Jul 14 19:33:00 2013] [error] [client 172.16.223.2] PHP 1. {main}() /var/www/rss.localhost/htdocs/tt-rss/backend.php:0, referer: http://rss.localhost/index.php?XDEBUG_S ... ans-xdebug
[Sun Jul 14 19:33:00 2013] [error] [client 172.16.223.2] PHP 2. Feeds->view() /var/www/rss.localhost/htdocs/tt-rss/backend.php:130, referer: http://rss.localhost/index.php?XDEBUG_S ... ans-xdebug
[Sun Jul 14 19:33:00 2013] [error] [client 172.16.223.2] PHP 3. Feeds->format_headlines_list($feed = -3, $method = 'ForceUpdate', $view_mode = 'all_articles', $limit = 30, $cat_view = FALSE, $next_unread_feed = '', $offset = '', $vgr_last_feed = '', $override_order = FALSE, $include_children = TRUE) /var/www/rss.localhost/htdocs/tt-rss/classes/feeds.php:877, referer: http://rss.localhost/index.php?XDEBUG_S ... ans-xdebug
[Sun Jul 14 19:33:00 2013] [error] [client 172.16.223.2] PHP 4. queryFeedHeadlines($feed = -3, $limit = 30, $view_mode = 'all_articles', $cat_view = FALSE, $search = 'angular', $search_mode = 'this_feed', $override_order = FALSE, $offset = 0, $owner_uid = 0, $filter = FALSE, $since_id = 0, $include_children = TRUE, $ignore_vfeed_group = *uninitialized*) /var/www/rss.localhost/htdocs/tt-rss/classes/feeds.php:244, referer: http://rss.localhost/index.php?XDEBUG_S ... ans-xdebug
[Sun Jul 14 19:33:00 2013] [error] [client 172.16.223.2] PHP 5. sphinx_search($query = 'angular', $offset = 0, $limit = 500) /var/www/rss.localhost/htdocs/tt-rss/include/functions.php:2302, referer: http://rss.localhost/index.php?XDEBUG_S ... ans-xdebug
[Sun Jul 14 19:33:00 2013] [error] [client 172.16.223.2] PHP 6. require_once() /var/www/rss.localhost/htdocs/tt-rss/include/functions.php:3791, referer: http://rss.localhost/index.php?XDEBUG_S ... ans-xdebug

Any idea what is the source of the problem and how to fix it?
Thanks in advance.

b.r.
lem0na

Re: Sphinx search does not work

Posted: 14 Jul 2013, 17:05
by lem0na
an update:
I digg into php docs and see that the internat Sphinx api support is called SphinxClient and probably this raises name colision
Do TTRSS have own Sphinx implementation that is independant from the one in PHP and I have to disable the PHP native implementation?

b.r.
lem0na

Re: Sphinx search does not work

Posted: 14 Jul 2013, 17:14
by fox
This is most probably the case, tt-rss uses a separate client library bundled I think.

Re: Sphinx search does not work

Posted: 14 Jul 2013, 17:56
by gbcox
lem0na wrote:an update:
I digg into php docs and see that the internat Sphinx api support is called SphinxClient and probably this raises name colision
Do TTRSS have own Sphinx implementation that is independant from the one in PHP and I have to disable the PHP native implementation?

b.r.
lem0na


For my own curiosity sake, can you provide the following?
What is your O/S?
What sphinx packages do you have installed... on an rpm linux distro you can find out via: rpm -qa | grep sphinx
What does your searchd log say: On Fedora, this is located at /var/log/sphinx/searchd.log

Thanks!

Re: Sphinx search does not work

Posted: 14 Jul 2013, 18:12
by lem0na
HI gbcox,

OS: Gentoo Linux
Sphinx: version 2.0.8
searchd.log (last 20 rows):
[Sun Jul 14 19:00:07.788 2013] [20302] rotating index 'delta': success
[Sun Jul 14 19:00:07.795 2013] [20302] rotating finished
[Sun Jul 14 19:20:07.347 2013] [20302] caught SIGHUP (seamless=1, in queue=1)
[Sun Jul 14 19:20:07.359 2013] [20302] rotating index 'delta': success
[Sun Jul 14 19:20:07.363 2013] [20302] rotating finished
[Sun Jul 14 19:40:07.277 2013] [20302] caught SIGHUP (seamless=1, in queue=1)
[Sun Jul 14 19:40:07.289 2013] [20302] rotating index 'delta': success
[Sun Jul 14 19:40:07.293 2013] [20302] rotating finished
[Sun Jul 14 20:00:06.342 2013] [20302] caught SIGHUP (seamless=1, in queue=1)
[Sun Jul 14 20:00:06.354 2013] [20302] rotating index 'delta': success
[Sun Jul 14 20:00:06.359 2013] [20302] rotating finished
[Sun Jul 14 20:20:07.368 2013] [20302] caught SIGHUP (seamless=1, in queue=1)
[Sun Jul 14 20:20:07.381 2013] [20302] rotating index 'delta': success
[Sun Jul 14 20:20:07.385 2013] [20302] rotating finished
[Sun Jul 14 20:40:06.583 2013] [20302] caught SIGHUP (seamless=1, in queue=1)
[Sun Jul 14 20:40:06.596 2013] [20302] rotating index 'delta': success
[Sun Jul 14 20:40:06.600 2013] [20302] rotating finished
[Sun Jul 14 21:00:09.532 2013] [20302] caught SIGHUP (seamless=1, in queue=1)
[Sun Jul 14 21:00:09.555 2013] [20302] rotating index 'delta': success
[Sun Jul 14 21:00:09.568 2013] [20302] rotating finished

Re: Sphinx search does not work

Posted: 14 Jul 2013, 18:24
by gbcox
Were you able to check for packages which contain "sphinx"?

Re: Sphinx search does not work

Posted: 14 Jul 2013, 18:26
by gbcox
and did you activate sphinx in your config.php file for ttrss?

Re: Sphinx search does not work

Posted: 14 Jul 2013, 18:29
by fox

Re: Sphinx search does not work

Posted: 14 Jul 2013, 18:39
by lem0na
gbcox:
Shphix is activated in config.php and I checked in Gentoo's package manager

fox: I think this will prevent the error but I am not sure if tt-rss's implementation is compatible with the one provided by PHP. Probably it is better to include in docs that tt-rss privides its own Shphix implemtation or switch to the PHP implemtation in future versions (requires PHP >= 5.2.2)

Re: Sphinx search does not work

Posted: 14 Jul 2013, 19:24
by gbcox
I can't speak for Gentoo because I don't have it.... but in Fedora, there is an optional package called:

php-pecl-sphinx and it's dependency of libsphinxclient

These are not required for ttrss, and as you have discovered cause issues.

The easiest solution (if you can on Gentoo) would be to remove them from your system.

I installed them as a test and did have issues, even with the patch that Fox specified above. The errors I received are as follows:

E_WARNING (2) classes/db/pgsql.php:54 pg_num_rows() expects parameter 1 to be resource, boolean given
E_WARNING (2) classes/db/pgsql.php:54 pg_num_rows() expects parameter 1 to be resource, boolean given

E_USER_ERROR (256) classes/db/pgsql.php:43 Query SELECT DISTINCT date_entered, guid, ttrss_entries.id,ttrss_entries.title, updated, label_cache, tag_cache, always_display_enclosures, site_url, note, num_comments, comments, int_id, uuid, hide_images, unread,feed_id,marked,published,link,last_read,orig_feed_id, last_marked, last_published, ttrss_feeds.title AS feed_title,favicon_avg_color, content, content AS content_preview, author,score FROM ttrss_entries,ttrss_user_entries,ttrss_feeds WHERE ttrss_user_entries.feed_id = ttrss_feeds.id AND ttrss_user_entries.ref_id = ttrss_entries.id AND ttrss_user_entries.owner_uid = '2' AND ref_id IN (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) AND true ORDER BY updated DESC LIMIT 30 OFFSET 0 failed:

E_WARNING (2) classes/db/pgsql.php:38 pg_query(): Query failed: ERROR: syntax error at or near "," LINE 27: ref_id IN (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,... ^

Re: Sphinx search does not work

Posted: 14 Jul 2013, 19:29
by fox
Well if the api is incompatible I'll add a sanity check which would prevent sphinx from working if conflicting library is detected.

e: https://github.com/gothfox/Tiny-Tiny-RS ... 4849637297

It would be better if someone who has this installed would make it work with the other library, of course.

Re: Sphinx search does not work

Posted: 14 Jul 2013, 19:48
by lem0na
Hi gbcox,

Thanks for the explanation. I have resolved the problem after the second post - just disabled the sphinx extension in apache.
For me now it works but did not returns the results that I expect.
I do not if this is the actual result that get or you omited the entry ids - if the firts there is a problme and I have no idea why this happens. Why there are no ids (looks like sphinx returns some values)
Rignt now I am still debuuging to get the results that I expect.

b.r.
lem0na

Re: Sphinx search does not work

Posted: 14 Jul 2013, 19:57
by lem0na
I just made comparisson in function names. It looks very identical but in ttrss class all function names start with capital letter, while in PHP native implementation start with lower letter.
I think PHP is case sensitive about variables and function names. Right?
(last time I wrote PHP code was in 2005-2006 and I have forgot many things)

So for now I think sanity check is required and some words in docs.

b.r.
lem0na

fox wrote:Well if the api is incompatible I'll add a sanity check which would prevent sphinx from working if conflicting library is detected.

e: https://github.com/gothfox/Tiny-Tiny-RS ... 4849637297

It would be better if someone who has this installed would make it work with the other library, of course.

Re: Sphinx search does not work

Posted: 14 Jul 2013, 20:06
by lem0na
just tested the patch - it works

fox wrote:Well if the api is incompatible I'll add a sanity check which would prevent sphinx from working if conflicting library is detected.

e: https://github.com/gothfox/Tiny-Tiny-RS ... 4849637297

It would be better if someone who has this installed would make it work with the other library, of course.

Re: Sphinx search does not work

Posted: 14 Jul 2013, 20:29
by fox
>I think PHP is case sensitive about variables and function names. Right?

Don't think so. Methods are certainly not case sensitive.