riddle 2.3.2 → 2.4.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a860b9ec8b23910ccc19ccb24c1e6b5e23e0d5a23522b51399a915859dbe5f5b
4
- data.tar.gz: 4c3f3b27ff3246cfbbf9dcfc75af8e25370ffdc15c6543eda64b2e3b45ea2c76
3
+ metadata.gz: 529a5b86abcbf7e07ea9abeaba9a1d63cbef7f73fa4db650bd3b13366b56a59a
4
+ data.tar.gz: fbbaec361b8ec24d6026d58261e81c520fcea6b521b24c7b55d2dd10a9d47891
5
5
  SHA512:
6
- metadata.gz: ab43f391a4086352d1e84a3c440d56cf51937f2726139da12bf7119ed783554c0e9da79762724e1d256eb969f6102ed9bb84f52385c3ecd3ace7ce20a11e5504
7
- data.tar.gz: 00dfaef9019672f5f26ec1efa985c4c257048b7e6a5cb9c59e246bdddca1a35ed30d11dca21ac031c74a9c84f1c98ecf8710a9ed484d823fca97e41aba1db082
6
+ metadata.gz: 5c0ab62b26ee3c73ce4361ebba6bfbad447d7e011dcb99e4937cd4cfd1d8d15e51726d3d4ba7977c82c6f3960221f9346226b0a9c5879e21c64a204fa67e6ec2
7
+ data.tar.gz: 3a0157b2a59a99ff1ccda333979e765e1cb491962f1061097a899de85b39d3160366004e96b0cd98e16660d1d2796363329c94ceea9b0c3ad0e8a60b03aae289
@@ -0,0 +1,117 @@
1
+ version: 2.1
2
+
3
+ orbs:
4
+ ruby: circleci/ruby@1.0
5
+
6
+ workflows:
7
+ test:
8
+ jobs:
9
+ - test:
10
+ name: "Sphinx 2.2"
11
+ sphinx_version: 2.2.11
12
+ sphinx_engine: sphinx
13
+ debian: jessie
14
+ ruby: '2.4.6'
15
+ - test:
16
+ name: "Sphinx 3.4"
17
+ sphinx_version: 3.4.1
18
+ sphinx_engine: sphinx
19
+ debian: buster
20
+ matrix:
21
+ parameters:
22
+ ruby: [ '2.4.10', '2.5.9', '2.6.9', '2.7.5', '3.0.3' ]
23
+ - test:
24
+ name: "Manticore 3.5"
25
+ sphinx_version: 3.5.4
26
+ sphinx_engine: manticore
27
+ debian: buster
28
+ matrix:
29
+ parameters:
30
+ ruby: [ '2.4.10', '2.5.9', '2.6.9', '2.7.5', '3.0.3' ]
31
+ - test:
32
+ name: "Manticore 4.0"
33
+ sphinx_version: 4.0.2
34
+ sphinx_engine: manticore
35
+ debian: buster
36
+ matrix:
37
+ parameters:
38
+ ruby: [ '2.4.10', '2.5.9', '2.6.9', '2.7.5', '3.0.3' ]
39
+
40
+ jobs:
41
+ test:
42
+ parameters:
43
+ ruby:
44
+ type: string
45
+ sphinx_version:
46
+ type: string
47
+ sphinx_engine:
48
+ type: string
49
+ debian:
50
+ type: string
51
+
52
+ docker:
53
+ - image: circleci/ruby:<< parameters.ruby >>-<< parameters.debian >>
54
+
55
+ - image: circleci/mysql:5.7
56
+ environment:
57
+ MYSQL_ROOT_PASSWORD: riddle
58
+ MYSQL_DATABASE: riddle
59
+
60
+ working_directory: ~/app
61
+
62
+ steps:
63
+ - checkout
64
+
65
+ - restore_cache:
66
+ keys:
67
+ - v1-dependencies-<< parameters.ruby >>
68
+
69
+ - run:
70
+ name: install bundler
71
+ command: |
72
+ if [ "<< parameters.ruby >>" == "2.7.5" ]; then
73
+ export BUNDLER_VERSION=2.1.4
74
+ elif [ "<< parameters.ruby >>" == "3.0.3" ]; then
75
+ export BUNDLER_VERSION=2.1.4
76
+ else
77
+ export BUNDLER_VERSION=1.17.3
78
+ fi
79
+ export BUNDLE_PATH=vendor/bundle
80
+ gem install bundler:$BUNDLER_VERSION
81
+
82
+ - run:
83
+ name: install dependencies
84
+ command: |
85
+ bundle install --jobs=4 --retry=3 --path vendor/bundle
86
+ bundle update
87
+
88
+ - save_cache:
89
+ paths:
90
+ - ./vendor/bundle
91
+ key: v1-dependencies-<< parameters.ruby >>
92
+
93
+ - run:
94
+ name: set up sphinx
95
+ command: "./bin/loadsphinx << parameters.sphinx_version >> << parameters.sphinx_engine >>"
96
+
97
+ - run:
98
+ name: wait for MySQL to be ready
99
+ command: |
100
+ for i in `seq 1 10`;
101
+ do
102
+ nc -z 127.0.0.1 3306 && echo Success && exit 0
103
+ echo -n .
104
+ sleep 1
105
+ done
106
+ echo Failed waiting for MySQL && exit 1
107
+
108
+ - run:
109
+ name: tests
110
+ environment:
111
+ CI: "true"
112
+ MYSQL_HOST: 127.0.0.1
113
+ MYSQL_USER: root
114
+ MYSQL_PASSWORD: riddle
115
+ SPHINX_VERSION: << parameters.sphinx_version >>
116
+ SPHINX_ENGINE: << parameters.sphinx_engine >>
117
+ command: bundle exec rspec
data/Gemfile CHANGED
@@ -4,5 +4,5 @@ source 'http://rubygems.org'
4
4
 
5
5
  gemspec
6
6
 
7
- gem 'mysql2', '0.5.0', :platform => :ruby
8
- gem 'jdbc-mysql', '5.1.35', :platform => :jruby
7
+ gem 'mysql2', '~> 0.5.2', :platform => :ruby
8
+ gem 'jdbc-mysql', '~> 5.1.47', :platform => :jruby
data/HISTORY CHANGED
@@ -1,3 +1,20 @@
1
+ 2.4.3 - December 20th 2021
2
+ - Use File.exist? instead of the deprecated File.exists?.
3
+ - Switched CI over to CircleCI, and testing against newer Sphinx/Manticore releases.
4
+
5
+ 2.4.2 - April 4th 2020
6
+ - Ensure parsing of files with a common section are rendered the same way.
7
+
8
+ 2.4.1 - January 4th 2020
9
+ - Fix typo of stopword_step setting.
10
+
11
+ 2.4.0 - July 28th 2019
12
+ - Escape slashes and single quotes for attribute and field values in INSERT/REPLACE statements, rather than removing them (#103).
13
+ - Remove support for Sphinx 2.0.
14
+ - Add Manticore 2.7 and 2.8.
15
+ - Test suite improvements.
16
+ - Gemspec improvements (Olle Jonsson #105)
17
+
1
18
  2.3.2 - September 23rd 2018
2
19
  - Fix attempt to modify a frozen string when generating configuration.
3
20
  - Test against Manticore 2.6.3.
data/README.markdown CHANGED
@@ -14,7 +14,7 @@ Riddle is available as a gem, so you can install it directly:
14
14
 
15
15
  Or include it in a Gemfile:
16
16
 
17
- gem 'riddle', '~> 2.3.2'
17
+ gem 'riddle', '~> 2.4'
18
18
 
19
19
  ## Usage
20
20
 
data/bin/loadsphinx CHANGED
@@ -2,65 +2,85 @@
2
2
 
3
3
  version=$1
4
4
  engine=$2
5
- name="$engine-$version"
6
- bucket="thinking-sphinx"
7
- directory="ext/sphinx"
8
- prefix="`pwd`/$directory"
9
- file="ext/$name.tar.gz"
10
5
 
11
- if [ "$engine" == "sphinx" ]; then
12
- url="http://sphinxsearch.com/files/$name-release.tar.gz"
13
- else
14
- url="https://github.com/manticoresoftware/manticore.git"
15
- fi
6
+ set -e
16
7
 
17
- download_and_compile_source () {
18
- if [ "$engine" == "sphinx" ]; then
19
- download_and_compile_sphinx
20
- else
21
- download_and_compile_manticore
8
+ load_sphinx () {
9
+ distro="xenial"
10
+
11
+ case $version in
12
+ 2.1.9)
13
+ url="http://sphinxsearch.com/files/sphinxsearch_2.1.9-release-0ubuntu11~trusty_amd64.deb"
14
+ format="deb"
15
+ distro="trusty";;
16
+ 2.2.11)
17
+ url="http://sphinxsearch.com/files/sphinxsearch_2.2.11-release-1~jessie_amd64.deb"
18
+ format="deb";;
19
+ 3.0.3)
20
+ url="http://sphinxsearch.com/files/sphinx-3.0.3-facc3fb-linux-amd64.tar.gz"
21
+ format="gz";;
22
+ 3.1.1)
23
+ url="http://sphinxsearch.com/files/sphinx-3.1.1-612d99f-linux-amd64.tar.gz"
24
+ format="gz";;
25
+ 3.2.1)
26
+ url="http://sphinxsearch.com/files/sphinx-3.2.1-f152e0b-linux-amd64.tar.gz"
27
+ format="gz";;
28
+ 3.3.1)
29
+ url="http://sphinxsearch.com/files/sphinx-3.3.1-b72d67b-linux-amd64.tar.gz"
30
+ format="gz";;
31
+ 3.4.1)
32
+ url="http://sphinxsearch.com/files/sphinx-3.4.1-efbcc65-linux-amd64.tar.gz"
33
+ format="gz";;
34
+ *)
35
+ echo "No Sphinx version $version available"
36
+ exit 1;;
37
+ esac
38
+
39
+ if [ "$distro" == "trusty" ]; then
40
+ curl --location http://launchpadlibrarian.net/247512886/libmysqlclient18_5.6.28-1ubuntu3_amd64.deb -o libmysql.deb
41
+ sudo apt-get install ./libmysql.deb
22
42
  fi
23
- }
24
43
 
25
- download_and_compile_sphinx () {
26
- curl -O $url
27
- tar -zxf $name-release.tar.gz
28
- cd $name-release
29
- ./configure --with-mysql --with-pgsql --enable-id64 --prefix=$prefix
30
- make
31
- make install
32
- cd ..
33
- rm -rf $name-release.tar.gz $name-release
44
+ if [ "$format" == "deb" ]; then
45
+ curl --location $url -o sphinx.deb
46
+ sudo apt-get install libodbc1
47
+ sudo dpkg -i ./sphinx.deb
48
+ sudo apt-get install -f
49
+ else
50
+ curl $url -o sphinx.tar.gz
51
+ tar -zxvf sphinx.tar.gz
52
+ sudo mv sphinx-$version/bin/* /usr/local/bin/.
53
+ fi
34
54
  }
35
55
 
36
- download_and_compile_manticore () {
37
- git clone $url $engine
38
- cd $engine
39
- git checkout $version
40
- mkdir build
41
- cd build
42
- cmake -D WITH_MYSQL=TRUE -D WITH_PGSQL=TRUE -D DISABLE_TESTING=TRUE -D CMAKE_INSTALL_PREFIX=$prefix ..
43
- make -j4
44
- make install
45
- cd ../..
46
- rm -rf $engine
47
- }
56
+ load_manticore () {
57
+ url="https://github.com/manticoresoftware/manticore/releases/download/$version/manticore_$version.deb"
48
58
 
49
- load_cache () {
50
- mkdir ext
51
- curl -o $file http://$bucket.s3.amazonaws.com/bincaches/$name.tar.gz
52
- tar -zxf $file
53
- }
59
+ case $version in
60
+ 2.6.4)
61
+ url="https://github.com/manticoresoftware/manticoresearch/releases/download/2.6.4/manticore_2.6.4-180503-37308c3-release-stemmer.xenial_amd64-bin.deb";;
62
+ 2.7.5)
63
+ url="https://github.com/manticoresoftware/manticoresearch/releases/download/2.7.5/manticore_2.7.5-181204-4a31c54-release-stemmer.xenial_amd64-bin.deb";;
64
+ 2.8.2)
65
+ url="https://github.com/manticoresoftware/manticoresearch/releases/download/2.8.2/manticore_2.8.2-190402-4e81114d-release-stemmer.stretch_amd64-bin.deb";;
66
+ 3.4.2)
67
+ url="https://github.com/manticoresoftware/manticoresearch/releases/download/3.4.2/manticore_3.4.2-200410-6903305-release.xenial_amd64-bin.deb";;
68
+ 3.5.4)
69
+ url="https://repo.manticoresearch.com/repository/manticoresearch_buster/pool/m/manticore/manticore_3.5.4-201211-13f8d08d_amd64.deb";;
70
+ 4.0.2)
71
+ url="https://repo.manticoresearch.com/repository/manticoresearch_buster/pool/m/manticore/manticore_4.0.2-210921-af497f245_amd64.deb";;
72
+ *)
73
+ echo "No Manticore version $version available"
74
+ exit 1;;
75
+ esac
54
76
 
55
- push_cache () {
56
- tar -czf $file $directory
57
- aws s3 cp $file s3://$bucket/bincaches/$name.tar.gz --acl public-read
77
+ curl --location $url -o manticore.deb
78
+ sudo dpkg -i ./manticore.deb
79
+ sudo apt-get install -f
58
80
  }
59
81
 
60
- if curl -i --head --fail http://$bucket.s3.amazonaws.com/bincaches/$name.tar.gz
61
- then
62
- load_cache
82
+ if [ "$engine" == "sphinx" ]; then
83
+ load_sphinx
63
84
  else
64
- download_and_compile_source
65
- push_cache
85
+ load_manticore
66
86
  fi
@@ -15,7 +15,7 @@ module Riddle
15
15
  :html_index_attrs, :html_remove_elements, :preopen, :ondisk_dict,
16
16
  :inplace_enable, :inplace_hit_gap, :inplace_docinfo_gap,
17
17
  :inplace_reloc_factor, :inplace_write_factor, :index_exact_words,
18
- :overshort_step, :stopwords_step, :hitless_words, :ha_strategy,
18
+ :overshort_step, :stopword_step, :hitless_words, :ha_strategy,
19
19
  :bigram_freq_words, :bigram_index, :index_field_lengths,
20
20
  :regexp_filter, :stopwords_unstemmed, :global_idf, :rlp_context,
21
21
  :ondisk_attrs
@@ -33,7 +33,7 @@ module Riddle
33
33
  :html_remove_element_tags, :preopen, :ondisk_dict, :inplace_enable,
34
34
  :inplace_hit_gap, :inplace_docinfo_gap, :inplace_reloc_factor,
35
35
  :inplace_write_factor, :index_exact_words, :overshort_step,
36
- :stopwords_step, :hitless_words, :ha_strategy, :bigram_freq_words,
36
+ :stopword_step, :hitless_words, :ha_strategy, :bigram_freq_words,
37
37
  :bigram_index, :index_field_lengths, :regexp_filter,
38
38
  :stopwords_unstemmed, :global_idf, :rlp_context, :ondisk_attrs
39
39
 
@@ -69,6 +69,10 @@ class Riddle::Configuration::Parser
69
69
  end
70
70
 
71
71
  def set_common
72
+ if inner['common'] && inner['common'].values.compact.any?
73
+ configuration.common.common_sphinx_configuration = true
74
+ end
75
+
72
76
  set_settings configuration.common, inner['common'] || {}
73
77
  end
74
78
 
@@ -18,7 +18,7 @@ module Riddle
18
18
  end
19
19
 
20
20
  def sphinx_version
21
- `#{indexer} 2>&1`[/Sphinx (\d+\.\d+(\.\d+|(?:-dev|(\-id64)?\-beta)))/, 1]
21
+ `#{indexer} 2>&1`[/(Sphinx|Manticore) (\d+\.\d+(\.\d+|(?:-dev|(\-id64)?\-beta)))/, 2]
22
22
  rescue
23
23
  nil
24
24
  end
@@ -74,7 +74,7 @@ module Riddle
74
74
  end
75
75
 
76
76
  def pid
77
- if File.exists?(configuration.searchd.pid_file)
77
+ if File.exist?(configuration.searchd.pid_file)
78
78
  File.read(configuration.searchd.pid_file)[/\d+/]
79
79
  else
80
80
  nil
@@ -29,7 +29,6 @@ class Riddle::Query::Insert
29
29
  columns.collect { |column|
30
30
  column.to_s == 'id' ? 'id' : "`#{column}`"
31
31
  }.join(', ')
32
-
33
32
  end
34
33
 
35
34
  def values_to_s
@@ -43,7 +42,7 @@ class Riddle::Query::Insert
43
42
  def translated_value(value)
44
43
  case value
45
44
  when String
46
- "'#{value.gsub(/['\\]/, '').gsub(/\s+/, ' ')}'"
45
+ "'#{Riddle::Query.sql_escape(value).gsub(/\s+/, ' ')}'"
47
46
  when TrueClass, FalseClass
48
47
  value ? 1 : 0
49
48
  when Time
data/lib/riddle.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'date'
3
4
  require 'thread'
4
5
  require 'socket'
5
6
  require 'stringio'
data/riddle.gemspec CHANGED
@@ -5,7 +5,7 @@ $:.push File.expand_path('../lib', __FILE__)
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = 'riddle'
8
- s.version = '2.3.2'
8
+ s.version = '2.4.3'
9
9
  s.platform = Gem::Platform::RUBY
10
10
  s.authors = ['Pat Allan']
11
11
  s.email = ['pat@freelancing-gods.com']
@@ -14,8 +14,6 @@ Gem::Specification.new do |s|
14
14
  s.description = %q{A Ruby API and configuration helper for the Sphinx search service.}
15
15
  s.license = 'MIT'
16
16
 
17
- s.rubyforge_project = 'riddle'
18
-
19
17
  s.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
20
18
  s.require_paths = ['lib']
21
19
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: riddle
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.2
4
+ version: 2.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pat Allan
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-09-23 00:00:00.000000000 Z
11
+ date: 2021-12-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -59,8 +59,8 @@ executables: []
59
59
  extensions: []
60
60
  extra_rdoc_files: []
61
61
  files:
62
+ - ".circleci/config.yml"
62
63
  - ".gitignore"
63
- - ".travis.yml"
64
64
  - Gemfile
65
65
  - HISTORY
66
66
  - LICENCE
@@ -112,7 +112,7 @@ homepage: http://pat.github.io/riddle/
112
112
  licenses:
113
113
  - MIT
114
114
  metadata: {}
115
- post_install_message:
115
+ post_install_message:
116
116
  rdoc_options: []
117
117
  require_paths:
118
118
  - lib
@@ -127,9 +127,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
127
127
  - !ruby/object:Gem::Version
128
128
  version: '0'
129
129
  requirements: []
130
- rubyforge_project: riddle
131
- rubygems_version: 2.7.6
132
- signing_key:
130
+ rubygems_version: 3.0.3
131
+ signing_key:
133
132
  specification_version: 4
134
133
  summary: An API for Sphinx, written in and for Ruby.
135
134
  test_files: []
data/.travis.yml DELETED
@@ -1,32 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - 2.2.9
4
- - 2.3.6
5
- - 2.4.3
6
- - 2.5.0
7
- - jruby-9.1.14.0
8
- env:
9
- global:
10
- - SPHINX_BIN=ext/sphinx/bin/
11
- - secure: aP3wCZnnqim/yBWbO8+N2DAJIDVuqewUayK3nBphR/Jt1POIMbqCIuHwk/SG/JfMc6pJIlH0QOX8wI3fF3y5GO6aIrN8xKAX0DoDm+Gkvk/YEk3cK/2fJUwvocR89M99EoV8ctLPaR03B3dm3h2Dh2oe8NQRBfcrL3WtiHHq3d0=
12
- matrix:
13
- - SPHINX_VERSION=2.0.10 SPHINX_ENGINE=sphinx
14
- - SPHINX_VERSION=2.1.9 SPHINX_ENGINE=sphinx
15
- - SPHINX_VERSION=2.2.11 SPHINX_ENGINE=sphinx
16
- - SPHINX_VERSION=3.0.2 SPHINX_ENGINE=sphinx
17
- - SPHINX_VERSION=2.6.3 SPHINX_ENGINE=manticore
18
- before_script:
19
- - killall searchd; echo ''
20
- - "./bin/loadsphinx $SPHINX_VERSION $SPHINX_ENGINE"
21
- addons:
22
- apt:
23
- packages:
24
- - cmake
25
- - bison
26
- - flex
27
- before_install:
28
- - pip install --upgrade --user awscli
29
- - gem update --system
30
- after_script:
31
- - killall searchd; echo ''
32
- sudo: false