Thinking Sphinx migration without enabled local indexes - thinking-sphinx

in migrating from rails 3.2 (where running as per design) to rails 4.2, an application with ThinkingSphinx on 4.2 will run rebuildand restart, however indexes are not being created with the following error stream
using config file '/Users/main/r/saim/config/development.sphinx.conf'...
WARNING: key 'sql_query_info' was permanently removed from Sphinx configuration. Refer to documentation for details.
WARNING: key 'charset_type' was permanently removed from Sphinx configuration. Refer to documentation for details.
WARNING: key 'sql_query_info' was permanently removed from Sphinx configuration. Refer to documentation for details.
WARNING: key 'charset_type' was permanently removed from Sphinx configuration. Refer to documentation for details.
WARNING: key 'sql_query_info' was permanently removed from Sphinx configuration. Refer to documentation for details.
WARNING: 7 more warnings skipped.
indexing index 'azienda_core'...
ERROR: source 'azienda_core_0': unknown type 'pgsql'; skipping.
ERROR: index 'azienda_core': failed to configure some of the sources, will not index.
thiking_sphinx.yml is configured as:
development:
bin_path: /usr/local/bin
pid_file: /Users/main/r/saim/shared/tmp/searchd.pid
configuration_file: /Users/main/r/saim/config/development.sphinx.conf
indices_location: /Users/main/r/saim/shared/sphinx
use_64_bit: true
# enable_star: true
min_infix_len: 2
# max_matches: 1000
mysql41: 9313
mem_limit: 128M
utf8: true
and sphinx.yml (I attempted both with and without spinx.yml in the config folder with identical results)
development:
bin_path: /usr/local/bin
searchd_file_path: /Users/main/r/saim/shared/sphinx
use_64_bit: true
enable_star: 1
min_infix_len: 1
max_matches: 10000
port: 9313
installed gems are
gem 'mysql2', '0.3.18', :platform => :ruby
gem 'thinking-sphinx', '3.1.2'
not sure why pgsql is the hangup...

Sphinx is saying it's not configured for PostgreSQL support. Have you re-installed Sphinx recently? And did you explicitly configure for PostgreSQL support when doing so? That's not the default, so you'll need to use the appropriate configuration flag when doing so. I believe it's --with-postgresql when using Homebrew, and it's certainly --with-pgsql when compiling manually.

Related

Getting ERROR: unknown key name ‘docinfo’ on sharetribe installation

I've been struggling to run bundle exec rake ts:index in my sharetribe project. It's returning an error:
rony#ronyMacMini sharetribe % bundle exec rake ts:index
Generating configuration to /Users/rony/Documents/freelensia Ofc/sharetribe/config/development.sphinx.conf
DEBUG (1.0ms) SET NAMES utf8, ##SESSION.sql_mode = CONCAT(CONCAT(##sql_mode, ',STRICT_ALL_TABLES'), ',NO_AUTO_VALUE_ON_ZERO'), ##SESSION.sql_auto_is_null = 0, ##SESSION.wait_timeout = 2147483
DEBUG ↳ app/indices/custom_field_value_index.rb:8
DEBUG Delayed::Backend::ActiveRecord::Job Destroy (4.2ms) DELETE FROM `delayed_jobs` WHERE (handler LIKE ('--- !ruby/object:ThinkingSphinx::Deltas::%') AND locked_at IS NULL AND locked_by IS NULL AND failed_at IS NULL)
DEBUG ↳ /Users/rony/.rvm/gems/ruby-2.6.5/bin/rake:23
Sphinx 3.3.1 (commit b72d67bc)
Copyright (c) 2001-2020, Andrew Aksyonoff
Copyright (c) 2008-2016, Sphinx Technologies Inc (http://sphinxsearch.com)
using config file '/Users/rony/Documents/abc/sharetribe/config/development.sphinx.conf'...
ERROR: unknown key name 'docinfo' in /Users/rony/Documents/abc/sharetribe/config/development.sphinx.conf line 40 col 10.
FATAL: failed to parse config file '/Users/rony/Documents/abc/sharetribe/config/development.sphinx.conf'
The Sphinx indexing command failed:
Command: indexer --config "/Users/rony/Documents/abc/sharetribe/config/development.sphinx.conf" --all
Status: 1
Output: See above
There may be more information about the failure in /Users/rony/Documents/abc/sharetribe/log/development.searchd.log.
Note that: To install thinking-sphinx on my mac, I’ve downloaded a
pre-built set of binaries and copy-pasted content of bin inside
usr/local/bin.
Searched everywhere but couldn't found the solution. I'm sure I'm missing some stupid thing.
Please help me to fix it.
Update
Downgraded sphinx to 2.2.11. Now another issue raised:
dyld: Library not loaded: /opt/local/lib/mysql55/mysql/libmysqlclient.18.dylib
Referenced from: /usr/local/bin/indexer
Reason: image not found
zsh: abort indexer
I think /opt/local is not correct system directory format for mac. :(
This is due to recent versions of Sphinx removing the docinfo setting.
Which version of Thinking Sphinx is Sharetribe using? If it's 4.x, you can disable the docinfo settings by adding skip_docinfo: true to each appropriate environment in config/thinking_sphinx.yml. For example:
development:
skip_docinfo: true
In Thinking Sphinx v5.0, docinfo is no longer used, but upgrading requires a bit of work with adding callbacks to all indexed models.
If you're using Thinking Sphinx v3.x, then you'll need to downgrade your version of Sphinx to v2.2.11.

Does Sphinx work with Postgres & rails 4?

Sphinx claims to work with postgres, but I've had no luck. I've installed the latest thinking-sphinx gem, and installed sphinx itself with both mysql and postgres. I still get an error when I try to build an index, like this:
ERROR: source 'user_core_0': unknown type 'pgsql'; skipping.
Full trace:
> rake ts:index
Generating configuration to /.../config/development.sphinx.conf
Sphinx 2.2.6-id64-release (r4843)
Copyright (c) 2001-2014, Andrew Aksyonoff
Copyright (c) 2008-2014, Sphinx Technologies Inc (http://sphinxsearch.com)
using config file '/.../config/development.sphinx.conf'...
WARNING: key 'sql_query_info' was permanently removed from Sphinx configuration. Refer to documentation for details.
WARNING: key 'charset_type' was permanently removed from Sphinx configuration. Refer to documentation for details.
indexing index 'user_core'...
ERROR: source 'user_core_0': unknown type 'pgsql'; skipping.
ERROR: index 'user_core': failed to configure some of the sources, will not index.
skipping non-plain index 'user'...
total 0 reads, 0.000 sec, 0.0 kb/call avg, 0.0 msec/call avg
total 0 writes, 0.000 sec, 0.0 kb/call avg, 0.0 msec/call avg
Edit:
I think sphinx should have pgsql support. How I installed sphinx:
> brew remove sphinx
Uninstalling /usr/local/Cellar/sphinx/2.2.6...
> brew install sphinx --mysql --pgsql
==> Downloading http://sphinxsearch.com/files/sphinx-2.2.6-release.tar.gz
Already downloaded: /Library/Caches/Homebrew/sphinx-2.2.6.tar.gz
==> Cloning https://github.com/snowballstem/snowball.git
Updating /Library/Caches/Homebrew/sphinx--stemmer--git
==> Checking out revision 9b58e92c965cd7e3208247ace3cc00d173397f3c
==> make dist_libstemmer_c
==> tar xzf dist/libstemmer_c.tgz -C /private/tmp/sphinx-oTMP63/sphinx-2.2.6-release
==> ./configure --prefix=/usr/local/Cellar/sphinx/2.2.6 --localstatedir=/usr/local/var --with-libstemmer --with-mysql --with-pgsql
==> make install
==> Caveats

Sphinx installation Fails to configure with MySQL

When I run the ThinkingSphinx index task bundle exec rake ts:index I get an error. Namely,
unknown type 'mysql'; skipping.
ERROR LOG: Generating configuration to
../../config/development.sphinx.conf Sphinx 2.2.4-id64-release (r4806)
Copyright (c) 2001-2014, Andrew Aksyonoff Copyright (c) 2008-2014,
Sphinx Technologies Inc (http://sphinxsearch.com)
using config file '../../config/development.sphinx.conf'... WARNING:
key 'sql_query_info' was permanently removed from Sphinx
configuration. Refer to documentation for details. WARNING: key
'charset_type' was permanently removed from Sphinx configuration.
Refer to documentation for details. indexing index 'video_core'...
ERROR: source 'video_core_0': unknown type 'mysql'; skipping. ERROR:
index 'video_core': failed to configure some of the sources, will not
index. skipping non-plain index 'video'... total 0 reads, 0.000 sec,
0.0 kb/call avg, 0.0 msec/call avg total 0 writes, 0.000 sec, 0.0 kb/call avg, 0.0 msec/call avg
Failed Solutions:
Re-install Sphinx using Homebrew on Mavericks.
brew install sphinx --with-mysql=/usr/local/Cellar/mysql/5.6.20_1/include/mysql
brew install sphinx --with-mysql
I'm not sure why it's not picking up your existing MySQL installation... but you could try compiling by hand instead, see if that works?
http://pat.github.io/thinking-sphinx/installing_sphinx.html

MySQL 5.6.10 installation error

I am getting this error while installing MySQL 5.6.10. I have other versions of MySQL (5.1 and 4.1) installed and there seems to be a conflict in the my.cnf.
Removing /etc/my.cnf is not an option.
[amitra#dev4.lab user.amitra]$ sudo /usr/local/mysql5610/scripts/mysql_install_db --basedir=/usr/local/mysql5610/ --datadir=/var/home/amitra/mysql5610/user.amitra
Installing MySQL system tables...2013-08-07 00:03:44 0 [ERROR] /usr/local/mysql5610//bin/mysqld: ambiguous option '--log=/var/lib/mysql/mysql.log' (log-bin, log_slave_updates)
2013-08-07 00:03:44 0 [ERROR] Aborting
2013-08-07 00:03:44 0 [Note] Binlog end
================
"log=/var/lib/mysql/mysql.log" is defined in the /etc/my.cnf and cant be removed. (Cant be changed as globally used)
I also tried to install using --defaults-file=/usr/local/mysql5610/my.cnf but that didn't work.
http://dev.mysql.com/doc/refman/5.6/en/server-options.html#option_mysqld_log
The --log option was removed in MySQL 5.6.1 (along with the log system variable). Instead, use the --general_log option to enable the general query log and the --general_log_file=file_name option to set the general query log file name.
In fact, the log option has been deprecated since MySQL 5.1.29 (circa October 2008).
You don't have to remove your my.cnf, but you cannot use the log option anymore. You must change it according to the instructions above, and it will work on all your other instances of MySQL 5.1 and greater.

Connect to mysql from node.js app, error: "dyld: lazy symbol binding failed: Symbol not found: _mysql_init"

I use OSX 10.6.8 and MySQL from XAMPP.
When I run this node.js app (app.js):
var mysql = require('mysql-libmysqlclient');
var conn = mysql.createConnectionSync();
conn.connectSync('127.0.0.1', 'root', '', 'database_name');
I see this output:
Airs0urce:nodejs airs0urce$ node app.js
dyld: lazy symbol binding failed: Symbol not found: _mysql_init
Referenced from: /Applications/XAMPP/xamppfiles/htdocs/myproject/nodejs/node_modules/mysql-libmysqlclient/build/Release/mysql_bindings.node
Expected in: dynamic lookup
dyld: Symbol not found: _mysql_init
Referenced from: /Applications/XAMPP/xamppfiles/htdocs/myproject/nodejs/node_modules/mysql-libmysqlclient/build/Release/mysql_bindings.node
Expected in: dynamic lookup
Trace/BPT trap
Already tried couple solutions after googling.
Added mysql libs from XAMPP directory to include path this way:
export DYLD_LIBRARY_PATH=/Applications/XAMPP/xamppfiles/lib/mysql:$DYLD_LIBRARY_PATH
tried to install mysql5-devel using MacPorts, but no luck, building failed:
Airs0urce:~ airs0urce$ sudo port install mysql5-devel
---> Computing dependencies for mysql5-devel
---> Building mysql5-devel
Error: Target org.macports.build returned: shell command failed (see log for details)
Log for mysql5-devel is at: /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_ports_databases_mysql5-devel/mysql5-devel/main.log
Error: Status 1 encountered during processing.
To report a bug, see <http://guide.macports.org/#project.tickets>
There is log file if you want to see: http://dl.dropbox.com/u/1875424/main.log
This is because of a config issue on Mac OS X Lion (10.7): lib/libmysqlclient.18.dylib (mysql 5.5 and above).
Step 1:
Make sure you set the path in ~/.profile
export ARCHFLAGS=-arch x86_64
export DYLD_LIBRARY_PATH=/usr/local/mysql/lib:$DYLD_LIBRARY_PATH
Step 2:
I am using rvm so, I used the following command:
rvmsudo ARCHFLAGS="-arch x86_64" gem install mysql2 -- --with-mysql-config=/usr/local/mysql/bin/mysql_config --with-opt-lib=/usr/local/mysql/lib
which has solved the issues with rails application on Mac lion and mysql x86_64.
I futzed around with this for a ton of time including setting the DVLD library path and copying the library into /usr/lib.
sudo cp /usr/local/mysql/lib/libmysqlclient.18.dylib /usr/lib
Heck, anything to get it working. Finally I tried clearing the default for 64 vs 32 bit and it worked!
defaults delete com.apple.versioner.perl
Not sure if my perl is 64 or 32 bit, but my db is 64 bit and just using the default default seems to work better ;-)