thinking sphinx unknown type 'mysql'; skipping - ruby

I'm using ts version 2.0.5, rails 3.0.9 and mysql2 0.2.11
When trying to create my indexes, using rake ts:index, I get the following error:
ERROR: source 'technical_core_0': unknown type 'mysql'; skipping.
My development.sphinx.conf contains:
source technical_core_0
{
type = mysql
sql_host = localhost
sql_user = root
sql_pass =
sql_db = ps_development
sql_sock = /tmp/mysql.sock
sql_query_pre = SET NAMES utf8
sql_query_pre = SET TIME_ZONE = '+0:00'
sql_query = SELECT SQL_NO_CACHE `technicals`.`id` * CAST(1 AS SIGNED) + 0 AS `id` , `orders`.`name` AS `author`, `technicals`.`id` AS `sphinx_internal_id`, 0 AS `sphinx_deleted`, 488243725 AS `class_crc`, IFNULL(`orders`.`name`, '') AS `author_sort`, `technicals`.`order_id` AS `order_id`, UNIX_TIMESTAMP(`technicals`.`created_at`) AS `created_at`, UNIX_TIMESTAMP(`technicals`.`updated_at`) AS `updated_at` FROM `technicals` LEFT OUTER JOIN `orders` ON `orders`.`id` = `technicals`.`order_id` WHERE (`technicals`.`id` >= $start AND `technicals`.`id` <= $end) GROUP BY `technicals`.`id`, , `orders`.`name`, `technicals`.`id`, `orders`.`name`, `technicals`.`order_id`, `technicals`.`created_at`, `technicals`.`updated_at` ORDER BY NULL
sql_query_range = SELECT IFNULL(MIN(`id`), 1), IFNULL(MAX(`id`), 1) FROM `technicals`
sql_attr_uint = sphinx_internal_id
sql_attr_uint = sphinx_deleted
sql_attr_uint = class_crc
sql_attr_uint = order_id
sql_attr_timestamp = created_at
sql_attr_timestamp = updated_at
sql_attr_str2ordinal = author_sort
sql_query_info = SELECT * FROM `technicals` WHERE `id` = (($id - 0) / 1)
}
Which is a bit odd as my database.yml file contains mysql2 and a root password.
Can you help me get past this stage? I tried also creating a sphinx.yml file with:
development:
adapter: mysql2
But this also fails.
-- UPDATE --
I added this into the development initialisers file:
ThinkingSphinx.database_adapter = :mysql2
Which gives error about only MySQL being supported.

As per the link here, you could simply do the following on homebrew (mac):
brew install sphinx --with-mysql
That worked for me :)

When you are compiling Sphinx you should specify the --with-mysql flag.
$ ./configure --with-mysql
$ make
$ sudo make install
You might need to specify the location of your MySQL library's include files. For example on a fresh installation of OS X:
$ ./configure --with-mysql=/opt/local/include/mysql5

Also when installing on OSX via homebrew try this:
sudo ln -s /usr/local/mysql/lib /usr/local/mysql/lib/mysql
brew install --interactive sphinx
./configure
make
make install
exit

The generated source looks correct - is it possible your version of Sphinx was compiled without MySQL support?

Related

Updating yaml file using PyYaml

I am trying to update a yaml file in place with values that are rendered from a shell script. The fields I am trying to update is upassword and schema. My yaml is slightly different from regular yaml
Here is how my Yaml looks like:
# values.conf
[first]
# First user
server_host = xxx.com
server_port = 1432
schema = get
uname = CN=svc-xxx-090
upassword =
[auth]
# default to /etc/.passwd in packaged installations and ./passwds in
# tarball installations.
#passwd_file =
passwd_db = pass.db
enabled=True
I need this yaml to be updated to:
# values.conf
[first]
# First user
server_host = xxx.com
server_port = 1432
schema = put
uname = CN=svc-xxx-090
upassword = 5668guuh6y%&_jhv86#
[auth]
# default to /etc/.passwd in packaged installations and ./passwds in
# tarball installations.
#passwd_file =
passwd_db = pass.db
enabled=True
I have regular yamls that I am using and able to update them without any issues but this yaml drives me crazy. Any help regarding this will be greatly appreciated. Thanks!

'No such file or directory' error when using buildGoPackage in nix

I'm trying to build the hasura cli: https://github.com/hasura/graphql-engine/tree/master/cli with the following code (deps derived from dep2nix):
{ buildGoPackage, fetchFromGitHub }:
buildGoPackage rec {
version = "1.0.0-beta.2";
name = "hasura-${version}";
goPackagePath = "github.com/hasura/graphql-engine";
subPackages = [ "cli" ];
src = fetchFromGitHub {
owner = "hasura";
repo = "graphql-engine";
rev = "v${version}";
sha256 = "1b40s41idkp1nyb9ygxgsvrwv8rsll6dnwrifpn25bvnfk8idafr";
};
goDeps = ./deps.nix;
}
but I get the following errors after the post-installation fixup step:
find: '/nix/store/gkck68cm2z9k1qxgmh350pq3kwsbyn8q-hasura-cli-1.0.0-beta.2': No such file or directory.
What am I doing wrong here? For reference, I'm on macOS and using home-manager.
For anyone still wondering:
There are a couple of things to consider:
dep has been deprecated in favor of go modules
This is also reflected in Nix, as buildGoPackage is now legacy and moved to buildGoModule
There is already a hasura-cli package in nixpkgs. You can just use it with nix-shell -p hasura-cli

cx_Freeze '#rpath/libQtDeclarative.4.dylib': doesn't exist or not a regular file

from cx_Freeze import setup, Executable
# Dependencies are automatically detected, but it might need
# fine tuning.
buildOptions = dict(packages = ["idna","lib","gui","plugins"], excludes = ["Tcl","tcl"]
import sys
base = 'Win32GUI' if sys.platform=='win32' else None
executables = [
Executable('electrum-xvg', base=base, targetName = 'Electrum XVG',icon="electrum.icns")]
setup(name='electrum-xvg',
version = '1.0',
description = '',
options = dict(build_exe = buildOptions),
executables = executables])
I have the above setup.py file which I am using to try build application on OSX Sierra. But when I use python setup.py bdist_mac it raises error
#rpath/libQtDeclarative.4.dylib
error: can't copy '#rpath/libQtDeclarative.4.dylib': doesn't exist or not a regular file
libQtDeclarative.4.dylib is present in ~/anaconda/envs/pyqtapp/lib on my system but when I used otool -D libQtDeclarative.4.dylib it raised error that no such file exists, so I used
install_name_tool -id "#rpath/libQtDeclarative.4.dylib" libQtDeclarative.4.dylib
in ~/anaconda/envs/pyqtapp/lib now when I run otool -D libQtDeclarative.4.dylib I get
libQtDeclarative.4.dylib:
#rpath/libQtDeclarative.4.dylib
but cx_Freeze still raises the error
error: can't copy '#rpath/libQtDeclarative.4.dylib': doesn't exist or not a regular file
Try explicitly setting includes (list of relative paths):
includefiles = ['README.txt', 'CHANGELOG.txt', 'helpers\uncompress\unRAR.exe', , 'helpers\uncompress\unzip.exe']

Support of HAVING for Sphinx running in Heroku

I have the following query:
search(params[:query],
with: { tag_id: params[:filter].values.flatten },
group_by: :technology_id,
having: "COUNT(*)=#{params[:filter].size}"
)
This is working locally, but when I deploy to heroku it throws:
ActionView::Template::Error (sphinxql: syntax error, unexpected IDENT, expecting $end
near 'HAVING COUNT(*)=1 LIMIT 0, 20; SHOW META' - SELECT *, groupby() AS
sphinx_internal_group, id AS sphinx_document_id, count(DISTINCT sphinx_document_id) AS
sphinx_internal_count FROM `technology_core` WHERE MATCH('cancer') AND `tag_id` IN (1) AND
`sphinx_deleted` = 0 GROUP BY `technology_id` HAVING COUNT(*)=1 LIMIT 0, 20; SHOW META):
The sphinx version is specified as follows:
# config/thinking_sphinx.yml
test:
mysql41: 9307
production:
version: '2.2.6'
Anyone knows what else could be?
At this point in time, the latest Sphinx version available on Flying Sphinx servers is 2.2.3 - can you change the version in your thinking_sphinx.yml, deploy and run rebuild/regenerate, and see if HAVING works?

/usr/bin/ld: cannot find -latlas

I'm trying to install code which I've successfully installed in the past on a new computer, and am running into problems.
This is on Fedora, using scons. The previous successful installation was on Ubuntu.
When I type scons, it gives the following error:
/usr/bin/ld: cannot find -latlas
I have successfully installed atlas-devel via yum.
If it helps, you'll find below the top level SConstruct File (--- indicates redacted code)
BUILD_LIB_DIR = '#build/lib'
BUILD_INCLUDE_DIR = '#build/include'
BUILD_BIN_DIR = '#build/bin'
import os
default_env = Environment(ENV = os.environ, # use the system $PATH variable
CCFLAGS = ['-pipe', '-Wall'],
CXXFLAGS = ['-std=c++0x'],
CPPPATH = [BUILD_INCLUDE_DIR, '#src/'],
LIBPATH = [BUILD_LIB_DIR],
CPPDEFINES = ['_USE_LCM_'])
default_env.Append(LIBS = [---, 'lapack', 'blas', 'atlas', 'armadillo', 'rt'])
default_env.Alias('install', [BUILD_LIB_DIR, BUILD_INCLUDE_DIR, BUILD_BIN_DIR])
# Create the command-line options along with help text
vars = Variables()
vars.Add(BoolVariable('debug', 'Compile in debug mode with -g and -pg', 0))
vars.Add(EnumVariable('---'))
vars.Add(BoolVariable('log-data', 'Define LOG_DATA in the preprocessor so internal state of modules will be written to log files', 0))
Help(vars.GenerateHelpText(default_env))
debug = ARGUMENTS.get('debug', 0)
log = ARGUMENTS.get('log-data', 0)
if int(debug):
default_env.Append(CCFLAGS = ['-g', '-pg'])
default_env.Append(LINKFLAGS = ['-pg'])
else:
default_env.Append(CCFLAGS = ['-O3'])
if int(log):
default_env.Append(CPPDEFINES = ['LOG_DATA'])
log_env = default_env.Clone();
log_env.Append(LIBS=['global', 'readlog', 'z'])
Export(['default_env', 'log_env', 'BUILD_LIB_DIR', 'BUILD_INCLUDE_DIR', 'BUILD_BIN_DIR', ---])
SConscript(['src/SConscript',
'docs/SConscript'])
It turns out the issue was that atlas puts the libatlas.so in /usr/lib(64)/atlas/...
Thanks to #Dave_Bacher for information on how to deal with this, namely
Add /usr/lib/atlas to the LIBPATH array in your default_env:
LIBPATH = [BUILD_LIB_DIR, /usr/lib/atlas]

Resources