thinking-sphinx 3.1.4 → 6.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/.circleci/config.yml +99 -0
- data/.github/actions/test/action.yml +46 -0
- data/.github/workflows/ci.yml +75 -0
- data/.gitignore +7 -2
- data/.travis.yml +31 -16
- data/Appraisals +68 -12
- data/CHANGELOG.markdown +782 -0
- data/Gemfile +13 -4
- data/Procfile.support +2 -0
- data/README.textile +41 -27
- data/Rakefile +2 -0
- data/bin/console +15 -0
- data/bin/loadsphinx +99 -0
- data/bin/testmatrix +48 -0
- data/lib/thinking/sphinx.rb +2 -0
- data/lib/thinking-sphinx.rb +2 -0
- data/lib/thinking_sphinx/active_record/association.rb +2 -0
- data/lib/thinking_sphinx/active_record/association_proxy/attribute_finder.rb +3 -1
- data/lib/thinking_sphinx/active_record/association_proxy/attribute_matcher.rb +2 -0
- data/lib/thinking_sphinx/active_record/association_proxy.rb +3 -2
- data/lib/thinking_sphinx/active_record/attribute/sphinx_presenter.rb +3 -1
- data/lib/thinking_sphinx/active_record/attribute/type.rb +20 -4
- data/lib/thinking_sphinx/active_record/attribute/values.rb +2 -0
- data/lib/thinking_sphinx/active_record/attribute.rb +2 -0
- data/lib/thinking_sphinx/active_record/base.rb +43 -11
- data/lib/thinking_sphinx/active_record/callbacks/association_delta_callbacks.rb +21 -0
- data/lib/thinking_sphinx/active_record/callbacks/delete_callbacks.rb +15 -9
- data/lib/thinking_sphinx/active_record/callbacks/delta_callbacks.rb +20 -5
- data/lib/thinking_sphinx/active_record/callbacks/update_callbacks.rb +18 -4
- data/lib/thinking_sphinx/active_record/column.rb +2 -0
- data/lib/thinking_sphinx/active_record/column_sql_presenter.rb +7 -1
- data/lib/thinking_sphinx/active_record/database_adapters/abstract_adapter.rb +2 -0
- data/lib/thinking_sphinx/active_record/database_adapters/mysql_adapter.rb +9 -1
- data/lib/thinking_sphinx/active_record/database_adapters/postgresql_adapter.rb +2 -0
- data/lib/thinking_sphinx/active_record/database_adapters.rb +3 -1
- data/lib/thinking_sphinx/active_record/depolymorph/association_reflection.rb +32 -0
- data/lib/thinking_sphinx/active_record/depolymorph/base_reflection.rb +32 -0
- data/lib/thinking_sphinx/active_record/depolymorph/conditions_reflection.rb +40 -0
- data/lib/thinking_sphinx/active_record/depolymorph/overridden_reflection.rb +50 -0
- data/lib/thinking_sphinx/active_record/depolymorph/scoped_reflection.rb +26 -0
- data/lib/thinking_sphinx/active_record/field.rb +2 -0
- data/lib/thinking_sphinx/active_record/filter_reflection.rb +13 -71
- data/lib/thinking_sphinx/active_record/index.rb +7 -5
- data/lib/thinking_sphinx/active_record/interpreter.rb +6 -4
- data/lib/thinking_sphinx/active_record/join_association.rb +5 -1
- data/lib/thinking_sphinx/active_record/log_subscriber.rb +22 -3
- data/lib/thinking_sphinx/active_record/polymorpher.rb +2 -0
- data/lib/thinking_sphinx/active_record/property.rb +2 -0
- data/lib/thinking_sphinx/active_record/property_query.rb +4 -1
- data/lib/thinking_sphinx/active_record/property_sql_presenter.rb +2 -0
- data/lib/thinking_sphinx/active_record/simple_many_query.rb +2 -0
- data/lib/thinking_sphinx/active_record/source_joins.rb +68 -0
- data/lib/thinking_sphinx/active_record/sql_builder/clause_builder.rb +2 -0
- data/lib/thinking_sphinx/active_record/sql_builder/query.rb +13 -0
- data/lib/thinking_sphinx/active_record/sql_builder/statement.rb +2 -0
- data/lib/thinking_sphinx/active_record/sql_builder.rb +5 -18
- data/lib/thinking_sphinx/active_record/sql_source/template.rb +5 -3
- data/lib/thinking_sphinx/active_record/sql_source.rb +35 -9
- data/lib/thinking_sphinx/active_record.rb +14 -1
- data/lib/thinking_sphinx/attribute_types.rb +72 -0
- data/lib/thinking_sphinx/batched_search.rb +2 -0
- data/lib/thinking_sphinx/callbacks/appender.rb +63 -0
- data/lib/thinking_sphinx/callbacks.rb +29 -0
- data/lib/thinking_sphinx/capistrano/v2.rb +2 -0
- data/lib/thinking_sphinx/capistrano/v3.rb +2 -0
- data/lib/thinking_sphinx/capistrano.rb +2 -0
- data/lib/thinking_sphinx/commander.rb +27 -0
- data/lib/thinking_sphinx/commands/base.rb +53 -0
- data/lib/thinking_sphinx/commands/clear_real_time.rb +22 -0
- data/lib/thinking_sphinx/commands/clear_sql.rb +18 -0
- data/lib/thinking_sphinx/commands/configure.rb +15 -0
- data/lib/thinking_sphinx/commands/index_real_time.rb +15 -0
- data/lib/thinking_sphinx/commands/index_sql.rb +25 -0
- data/lib/thinking_sphinx/commands/merge.rb +27 -0
- data/lib/thinking_sphinx/commands/merge_and_update.rb +57 -0
- data/lib/thinking_sphinx/commands/prepare.rb +15 -0
- data/lib/thinking_sphinx/commands/rotate.rb +13 -0
- data/lib/thinking_sphinx/commands/running.rb +15 -0
- data/lib/thinking_sphinx/commands/start_attached.rb +22 -0
- data/lib/thinking_sphinx/commands/start_detached.rb +21 -0
- data/lib/thinking_sphinx/commands/stop.rb +24 -0
- data/lib/thinking_sphinx/commands.rb +20 -0
- data/lib/thinking_sphinx/configuration/consistent_ids.rb +2 -0
- data/lib/thinking_sphinx/configuration/defaults.rb +2 -0
- data/lib/thinking_sphinx/configuration/distributed_indices.rb +3 -1
- data/lib/thinking_sphinx/configuration/duplicate_names.rb +36 -0
- data/lib/thinking_sphinx/configuration/minimum_fields.rb +17 -12
- data/lib/thinking_sphinx/configuration.rb +90 -74
- data/lib/thinking_sphinx/connection/client.rb +74 -0
- data/lib/thinking_sphinx/connection/jruby.rb +58 -0
- data/lib/thinking_sphinx/connection/mri.rb +26 -0
- data/lib/thinking_sphinx/connection.rb +13 -114
- data/lib/thinking_sphinx/core/field.rb +2 -0
- data/lib/thinking_sphinx/core/index.rb +22 -2
- data/lib/thinking_sphinx/core/interpreter.rb +2 -0
- data/lib/thinking_sphinx/core/property.rb +2 -0
- data/lib/thinking_sphinx/core/settings.rb +2 -0
- data/lib/thinking_sphinx/core.rb +2 -0
- data/lib/thinking_sphinx/deletion.rb +33 -13
- data/lib/thinking_sphinx/deltas/default_delta.rb +3 -1
- data/lib/thinking_sphinx/deltas/delete_job.rb +16 -4
- data/lib/thinking_sphinx/deltas/index_job.rb +14 -2
- data/lib/thinking_sphinx/deltas.rb +2 -0
- data/lib/thinking_sphinx/distributed/index.rb +25 -3
- data/lib/thinking_sphinx/distributed.rb +2 -0
- data/lib/thinking_sphinx/errors.rb +47 -3
- data/lib/thinking_sphinx/excerpter.rb +2 -0
- data/lib/thinking_sphinx/facet.rb +4 -3
- data/lib/thinking_sphinx/facet_search.rb +4 -2
- data/lib/thinking_sphinx/float_formatter.rb +2 -0
- data/lib/thinking_sphinx/frameworks/plain.rb +2 -0
- data/lib/thinking_sphinx/frameworks/rails.rb +2 -0
- data/lib/thinking_sphinx/frameworks.rb +2 -0
- data/lib/thinking_sphinx/guard/file.rb +3 -1
- data/lib/thinking_sphinx/guard/files.rb +2 -0
- data/lib/thinking_sphinx/guard/none.rb +7 -0
- data/lib/thinking_sphinx/guard.rb +3 -0
- data/lib/thinking_sphinx/hooks/guard_presence.rb +34 -0
- data/lib/thinking_sphinx/index.rb +2 -0
- data/lib/thinking_sphinx/index_set.rb +27 -4
- data/lib/thinking_sphinx/indexing_strategies/all_at_once.rb +9 -0
- data/lib/thinking_sphinx/indexing_strategies/one_at_a_time.rb +16 -0
- data/lib/thinking_sphinx/interfaces/base.rb +13 -0
- data/lib/thinking_sphinx/interfaces/daemon.rb +27 -0
- data/lib/thinking_sphinx/interfaces/real_time.rb +46 -0
- data/lib/thinking_sphinx/interfaces/sql.rb +53 -0
- data/lib/thinking_sphinx/interfaces.rb +10 -0
- data/lib/thinking_sphinx/logger.rb +2 -0
- data/lib/thinking_sphinx/masks/group_enumerators_mask.rb +6 -4
- data/lib/thinking_sphinx/masks/pagination_mask.rb +2 -0
- data/lib/thinking_sphinx/masks/scopes_mask.rb +8 -0
- data/lib/thinking_sphinx/masks/weight_enumerator_mask.rb +3 -1
- data/lib/thinking_sphinx/masks.rb +2 -0
- data/lib/thinking_sphinx/middlewares/active_record_translator.rb +32 -9
- data/lib/thinking_sphinx/middlewares/geographer.rb +2 -0
- data/lib/thinking_sphinx/middlewares/glazier.rb +14 -1
- data/lib/thinking_sphinx/middlewares/ids_only.rb +2 -0
- data/lib/thinking_sphinx/middlewares/inquirer.rb +3 -1
- data/lib/thinking_sphinx/middlewares/middleware.rb +2 -0
- data/lib/thinking_sphinx/middlewares/sphinxql.rb +18 -16
- data/lib/thinking_sphinx/middlewares/stale_id_checker.rb +3 -1
- data/lib/thinking_sphinx/middlewares/stale_id_filter.rb +4 -2
- data/lib/thinking_sphinx/middlewares/valid_options.rb +25 -0
- data/lib/thinking_sphinx/middlewares.rb +7 -3
- data/lib/thinking_sphinx/panes/attributes_pane.rb +2 -0
- data/lib/thinking_sphinx/panes/distance_pane.rb +2 -0
- data/lib/thinking_sphinx/panes/excerpts_pane.rb +2 -0
- data/lib/thinking_sphinx/panes/weight_pane.rb +3 -1
- data/lib/thinking_sphinx/panes.rb +2 -0
- data/lib/thinking_sphinx/processor.rb +71 -0
- data/lib/thinking_sphinx/query.rb +2 -0
- data/lib/thinking_sphinx/railtie.rb +29 -2
- data/lib/thinking_sphinx/rake_interface.rb +14 -69
- data/lib/thinking_sphinx/real_time/attribute.rb +9 -1
- data/lib/thinking_sphinx/real_time/callbacks/real_time_callbacks.rb +17 -7
- data/lib/thinking_sphinx/real_time/field.rb +2 -0
- data/lib/thinking_sphinx/real_time/index/template.rb +19 -1
- data/lib/thinking_sphinx/real_time/index.rb +11 -5
- data/lib/thinking_sphinx/real_time/interpreter.rb +10 -6
- data/lib/thinking_sphinx/real_time/populator.rb +12 -14
- data/lib/thinking_sphinx/real_time/processor.rb +36 -0
- data/lib/thinking_sphinx/real_time/property.rb +3 -5
- data/lib/thinking_sphinx/real_time/transcribe_instance.rb +38 -0
- data/lib/thinking_sphinx/real_time/transcriber.rb +63 -15
- data/lib/thinking_sphinx/real_time/translator.rb +39 -0
- data/lib/thinking_sphinx/real_time.rb +22 -1
- data/lib/thinking_sphinx/scopes.rb +6 -0
- data/lib/thinking_sphinx/search/batch_inquirer.rb +2 -0
- data/lib/thinking_sphinx/search/context.rb +11 -0
- data/lib/thinking_sphinx/search/glaze.rb +2 -0
- data/lib/thinking_sphinx/search/merger.rb +2 -0
- data/lib/thinking_sphinx/search/query.rb +9 -1
- data/lib/thinking_sphinx/search/stale_ids_exception.rb +7 -3
- data/lib/thinking_sphinx/search.rb +30 -2
- data/lib/thinking_sphinx/settings.rb +128 -0
- data/lib/thinking_sphinx/sinatra.rb +3 -1
- data/lib/thinking_sphinx/subscribers/populator_subscriber.rb +19 -5
- data/lib/thinking_sphinx/tasks.rb +55 -28
- data/lib/thinking_sphinx/test.rb +3 -1
- data/lib/thinking_sphinx/utf8.rb +2 -0
- data/lib/thinking_sphinx/wildcard.rb +3 -1
- data/lib/thinking_sphinx/with_output.rb +13 -0
- data/lib/thinking_sphinx.rb +35 -4
- data/spec/acceptance/association_scoping_spec.rb +7 -5
- data/spec/acceptance/attribute_access_spec.rb +29 -12
- data/spec/acceptance/attribute_updates_spec.rb +5 -3
- data/spec/acceptance/batch_searching_spec.rb +6 -4
- data/spec/acceptance/big_integers_spec.rb +9 -7
- data/spec/acceptance/excerpts_spec.rb +11 -10
- data/spec/acceptance/facets_spec.rb +29 -16
- data/spec/acceptance/geosearching_spec.rb +22 -10
- data/spec/acceptance/grouping_by_attributes_spec.rb +30 -28
- data/spec/acceptance/index_options_spec.rb +18 -16
- data/spec/acceptance/indexing_spec.rb +5 -3
- data/spec/acceptance/merging_spec.rb +90 -0
- data/spec/acceptance/paginating_search_results_spec.rb +21 -3
- data/spec/acceptance/real_time_updates_spec.rb +103 -5
- data/spec/acceptance/remove_deleted_records_spec.rb +64 -8
- data/spec/acceptance/search_counts_spec.rb +4 -2
- data/spec/acceptance/search_for_just_ids_spec.rb +4 -2
- data/spec/acceptance/searching_across_models_spec.rb +15 -6
- data/spec/acceptance/searching_across_schemas_spec.rb +12 -10
- data/spec/acceptance/searching_on_fields_spec.rb +11 -9
- data/spec/acceptance/searching_with_filters_spec.rb +35 -20
- data/spec/acceptance/searching_with_sti_spec.rb +11 -9
- data/spec/acceptance/searching_within_a_model_spec.rb +44 -17
- data/spec/acceptance/sorting_search_results_spec.rb +21 -19
- data/spec/acceptance/spec_helper.rb +2 -13
- data/spec/acceptance/specifying_sql_spec.rb +118 -62
- data/spec/acceptance/sphinx_scopes_spec.rb +30 -21
- data/spec/acceptance/sql_deltas_spec.rb +35 -9
- data/spec/acceptance/support/database_cleaner.rb +3 -1
- data/spec/acceptance/support/sphinx_controller.rb +25 -9
- data/spec/acceptance/support/sphinx_helpers.rb +17 -2
- data/spec/acceptance/suspended_deltas_spec.rb +14 -12
- data/spec/fixtures/database.yml +1 -1
- data/spec/internal/app/indices/admin_person_index.rb +6 -0
- data/spec/internal/app/indices/album_index.rb +9 -0
- data/spec/internal/app/indices/animal_index.rb +2 -0
- data/spec/internal/app/indices/article_index.rb +10 -3
- data/spec/internal/app/indices/bird_index.rb +2 -0
- data/spec/internal/app/indices/book_index.rb +4 -1
- data/spec/internal/app/indices/car_index.rb +2 -0
- data/spec/internal/app/indices/city_index.rb +2 -0
- data/spec/internal/app/indices/colour_index.rb +7 -0
- data/spec/internal/app/indices/product_index.rb +3 -2
- data/spec/internal/app/indices/tee_index.rb +3 -1
- data/spec/internal/app/indices/user_index.rb +2 -0
- data/spec/internal/app/models/admin/person.rb +6 -0
- data/spec/internal/app/models/album.rb +25 -0
- data/spec/internal/app/models/animal.rb +3 -0
- data/spec/internal/app/models/article.rb +4 -0
- data/spec/internal/app/models/bird.rb +3 -0
- data/spec/internal/app/models/book.rb +9 -5
- data/spec/internal/app/models/car.rb +3 -1
- data/spec/internal/app/models/categorisation.rb +10 -1
- data/spec/internal/app/models/category.rb +2 -0
- data/spec/internal/app/models/city.rb +4 -0
- data/spec/internal/app/models/colour.rb +4 -0
- data/spec/internal/app/models/event.rb +2 -0
- data/spec/internal/app/models/flightless_bird.rb +2 -0
- data/spec/internal/app/models/genre.rb +2 -0
- data/spec/internal/app/models/hardcover.rb +2 -0
- data/spec/internal/app/models/mammal.rb +2 -0
- data/spec/internal/app/models/manufacturer.rb +2 -0
- data/spec/internal/app/models/product.rb +3 -1
- data/spec/internal/app/models/tag.rb +2 -0
- data/spec/internal/app/models/tagging.rb +2 -0
- data/spec/internal/app/models/tee.rb +7 -0
- data/spec/internal/app/models/tweet.rb +2 -0
- data/spec/internal/app/models/user.rb +4 -0
- data/spec/internal/config/database.yml +12 -1
- data/spec/internal/db/schema.rb +13 -1
- data/spec/spec_helper.rb +12 -1
- data/spec/support/json_column.rb +35 -0
- data/spec/support/multi_schema.rb +5 -1
- data/spec/support/mysql.rb +25 -0
- data/spec/support/sphinx_yaml_helpers.rb +8 -1
- data/spec/thinking_sphinx/active_record/association_spec.rb +3 -1
- data/spec/thinking_sphinx/active_record/attribute/type_spec.rb +43 -38
- data/spec/thinking_sphinx/active_record/base_spec.rb +31 -29
- data/spec/thinking_sphinx/active_record/callbacks/delete_callbacks_spec.rb +81 -10
- data/spec/thinking_sphinx/active_record/callbacks/delta_callbacks_spec.rb +56 -29
- data/spec/thinking_sphinx/active_record/callbacks/update_callbacks_spec.rb +27 -10
- data/spec/thinking_sphinx/active_record/column_spec.rb +15 -13
- data/spec/thinking_sphinx/active_record/column_sql_presenter_spec.rb +39 -0
- data/spec/thinking_sphinx/active_record/database_adapters/abstract_adapter_spec.rb +7 -5
- data/spec/thinking_sphinx/active_record/database_adapters/mysql_adapter_spec.rb +26 -12
- data/spec/thinking_sphinx/active_record/database_adapters/postgresql_adapter_spec.rb +15 -13
- data/spec/thinking_sphinx/active_record/database_adapters_spec.rb +50 -48
- data/spec/thinking_sphinx/active_record/field_spec.rb +9 -7
- data/spec/thinking_sphinx/active_record/filter_reflection_spec.rb +113 -80
- data/spec/thinking_sphinx/active_record/index_spec.rb +41 -37
- data/spec/thinking_sphinx/active_record/interpreter_spec.rb +62 -59
- data/spec/thinking_sphinx/active_record/polymorpher_spec.rb +16 -14
- data/spec/thinking_sphinx/active_record/property_sql_presenter_spec.rb +69 -67
- data/spec/thinking_sphinx/active_record/sql_builder_spec.rb +146 -154
- data/spec/thinking_sphinx/active_record/sql_source_spec.rb +185 -109
- data/spec/thinking_sphinx/attribute_types_spec.rb +52 -0
- data/spec/thinking_sphinx/commands/clear_real_time_spec.rb +46 -0
- data/spec/thinking_sphinx/commands/clear_sql_spec.rb +52 -0
- data/spec/thinking_sphinx/commands/configure_spec.rb +31 -0
- data/spec/thinking_sphinx/commands/index_real_time_spec.rb +33 -0
- data/spec/thinking_sphinx/commands/index_sql_spec.rb +86 -0
- data/spec/thinking_sphinx/commands/merge_and_update_spec.rb +106 -0
- data/spec/thinking_sphinx/commands/merge_spec.rb +48 -0
- data/spec/thinking_sphinx/commands/prepare_spec.rb +31 -0
- data/spec/thinking_sphinx/commands/running_spec.rb +30 -0
- data/spec/thinking_sphinx/commands/start_detached_spec.rb +67 -0
- data/spec/thinking_sphinx/commands/stop_spec.rb +63 -0
- data/spec/thinking_sphinx/configuration/minimum_fields_spec.rb +60 -0
- data/spec/thinking_sphinx/configuration_spec.rb +247 -94
- data/spec/thinking_sphinx/connection/mri_spec.rb +49 -0
- data/spec/thinking_sphinx/connection_spec.rb +15 -13
- data/spec/thinking_sphinx/deletion_spec.rb +17 -17
- data/spec/thinking_sphinx/deltas/default_delta_spec.rb +28 -21
- data/spec/thinking_sphinx/deltas_spec.rb +14 -12
- data/spec/thinking_sphinx/errors_spec.rb +59 -27
- data/spec/thinking_sphinx/excerpter_spec.rb +12 -9
- data/spec/thinking_sphinx/facet_search_spec.rb +24 -22
- data/spec/thinking_sphinx/hooks/guard_presence_spec.rb +30 -0
- data/spec/thinking_sphinx/index_set_spec.rb +59 -18
- data/spec/thinking_sphinx/index_spec.rb +28 -26
- data/spec/thinking_sphinx/interfaces/daemon_spec.rb +60 -0
- data/spec/thinking_sphinx/interfaces/real_time_spec.rb +109 -0
- data/spec/thinking_sphinx/interfaces/sql_spec.rb +122 -0
- data/spec/thinking_sphinx/masks/pagination_mask_spec.rb +22 -20
- data/spec/thinking_sphinx/masks/scopes_mask_spec.rb +20 -18
- data/spec/thinking_sphinx/middlewares/active_record_translator_spec.rb +45 -21
- data/spec/thinking_sphinx/middlewares/geographer_spec.rb +11 -9
- data/spec/thinking_sphinx/middlewares/glazier_spec.rb +12 -9
- data/spec/thinking_sphinx/middlewares/inquirer_spec.rb +9 -7
- data/spec/thinking_sphinx/middlewares/sphinxql_spec.rb +60 -58
- data/spec/thinking_sphinx/middlewares/stale_id_checker_spec.rb +7 -4
- data/spec/thinking_sphinx/middlewares/stale_id_filter_spec.rb +39 -17
- data/spec/thinking_sphinx/middlewares/valid_options_spec.rb +51 -0
- data/spec/thinking_sphinx/panes/attributes_pane_spec.rb +3 -1
- data/spec/thinking_sphinx/panes/distance_pane_spec.rb +6 -4
- data/spec/thinking_sphinx/panes/excerpts_pane_spec.rb +8 -6
- data/spec/thinking_sphinx/panes/weight_pane_spec.rb +4 -2
- data/spec/thinking_sphinx/rake_interface_spec.rb +17 -235
- data/spec/thinking_sphinx/real_time/attribute_spec.rb +15 -13
- data/spec/thinking_sphinx/real_time/callbacks/real_time_callbacks_spec.rb +114 -28
- data/spec/thinking_sphinx/real_time/field_spec.rb +16 -14
- data/spec/thinking_sphinx/real_time/index_spec.rb +83 -32
- data/spec/thinking_sphinx/real_time/interpreter_spec.rb +44 -42
- data/spec/thinking_sphinx/real_time/transcribe_instance_spec.rb +35 -0
- data/spec/thinking_sphinx/real_time/transcriber_spec.rb +109 -0
- data/spec/thinking_sphinx/real_time/translator_spec.rb +17 -0
- data/spec/thinking_sphinx/scopes_spec.rb +11 -5
- data/spec/thinking_sphinx/search/glaze_spec.rb +17 -15
- data/spec/thinking_sphinx/search/query_spec.rb +19 -10
- data/spec/thinking_sphinx/search_spec.rb +30 -28
- data/spec/thinking_sphinx/wildcard_spec.rb +18 -11
- data/spec/thinking_sphinx_spec.rb +10 -7
- data/thinking-sphinx.gemspec +17 -10
- metadata +157 -49
- data/HISTORY +0 -248
- data/gemfiles/.gitignore +0 -1
- data/gemfiles/rails_3_2.gemfile +0 -11
- data/gemfiles/rails_4_0.gemfile +0 -11
- data/gemfiles/rails_4_1.gemfile +0 -11
- data/gemfiles/rails_4_2.gemfile +0 -11
- data/lib/thinking_sphinx/controller.rb +0 -10
- data/lib/thinking_sphinx/middlewares/utf8.rb +0 -27
- data/lib/thinking_sphinx/sphinxql.rb +0 -23
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
require 'spec_helper'
|
|
2
4
|
|
|
3
5
|
describe ThinkingSphinx::Search do
|
|
@@ -34,26 +36,26 @@ describe ThinkingSphinx::Search do
|
|
|
34
36
|
end
|
|
35
37
|
|
|
36
38
|
before :each do
|
|
37
|
-
ThinkingSphinx::Search::Context.
|
|
39
|
+
allow(ThinkingSphinx::Search::Context).to receive_messages :new => context
|
|
38
40
|
|
|
39
41
|
stub_const 'ThinkingSphinx::Middlewares::DEFAULT', stack
|
|
40
42
|
end
|
|
41
43
|
|
|
42
44
|
describe '#current_page' do
|
|
43
45
|
it "should return 1 by default" do
|
|
44
|
-
search.current_page.
|
|
46
|
+
expect(search.current_page).to eq(1)
|
|
45
47
|
end
|
|
46
48
|
|
|
47
49
|
it "should handle string page values" do
|
|
48
|
-
ThinkingSphinx::Search.new(:page => '2').current_page.
|
|
50
|
+
expect(ThinkingSphinx::Search.new(:page => '2').current_page).to eq(2)
|
|
49
51
|
end
|
|
50
52
|
|
|
51
53
|
it "should handle empty string page values" do
|
|
52
|
-
ThinkingSphinx::Search.new(:page => '').current_page.
|
|
54
|
+
expect(ThinkingSphinx::Search.new(:page => '').current_page).to eq(1)
|
|
53
55
|
end
|
|
54
56
|
|
|
55
57
|
it "should return the requested page" do
|
|
56
|
-
ThinkingSphinx::Search.new(:page => 10).current_page.
|
|
58
|
+
expect(ThinkingSphinx::Search.new(:page => 10).current_page).to eq(10)
|
|
57
59
|
end
|
|
58
60
|
end
|
|
59
61
|
|
|
@@ -61,25 +63,25 @@ describe ThinkingSphinx::Search do
|
|
|
61
63
|
it "returns false if there is anything in the data set" do
|
|
62
64
|
context[:results] << double
|
|
63
65
|
|
|
64
|
-
search.
|
|
66
|
+
expect(search).not_to be_empty
|
|
65
67
|
end
|
|
66
68
|
|
|
67
69
|
it "returns true if the data set is empty" do
|
|
68
70
|
context[:results].clear
|
|
69
71
|
|
|
70
|
-
search.
|
|
72
|
+
expect(search).to be_empty
|
|
71
73
|
end
|
|
72
74
|
end
|
|
73
75
|
|
|
74
76
|
describe '#initialize' do
|
|
75
77
|
it "lazily loads by default" do
|
|
76
|
-
stack.
|
|
78
|
+
expect(stack).not_to receive(:call)
|
|
77
79
|
|
|
78
80
|
ThinkingSphinx::Search.new
|
|
79
81
|
end
|
|
80
82
|
|
|
81
83
|
it "should automatically populate when :populate is set to true" do
|
|
82
|
-
stack.
|
|
84
|
+
expect(stack).to receive(:call).and_return(true)
|
|
83
85
|
|
|
84
86
|
ThinkingSphinx::Search.new(:populate => true)
|
|
85
87
|
end
|
|
@@ -87,74 +89,74 @@ describe ThinkingSphinx::Search do
|
|
|
87
89
|
|
|
88
90
|
describe '#offset' do
|
|
89
91
|
it "should default to 0" do
|
|
90
|
-
search.offset.
|
|
92
|
+
expect(search.offset).to eq(0)
|
|
91
93
|
end
|
|
92
94
|
|
|
93
95
|
it "should increase by the per_page value for each page in" do
|
|
94
|
-
ThinkingSphinx::Search.new(:per_page => 25, :page => 2).offset.
|
|
95
|
-
|
|
96
|
+
expect(ThinkingSphinx::Search.new(:per_page => 25, :page => 2).offset).
|
|
97
|
+
to eq(25)
|
|
96
98
|
end
|
|
97
99
|
|
|
98
100
|
it "should prioritise explicit :offset over calculated if given" do
|
|
99
|
-
ThinkingSphinx::Search.new(:offset => 5).offset.
|
|
101
|
+
expect(ThinkingSphinx::Search.new(:offset => 5).offset).to eq(5)
|
|
100
102
|
end
|
|
101
103
|
end
|
|
102
104
|
|
|
103
105
|
describe '#page' do
|
|
104
106
|
it "sets the current page" do
|
|
105
107
|
search.page(3)
|
|
106
|
-
search.current_page.
|
|
108
|
+
expect(search.current_page).to eq(3)
|
|
107
109
|
end
|
|
108
110
|
|
|
109
111
|
it "returns the search object" do
|
|
110
|
-
search.page(2).
|
|
112
|
+
expect(search.page(2)).to eq(search)
|
|
111
113
|
end
|
|
112
114
|
end
|
|
113
115
|
|
|
114
116
|
describe '#per' do
|
|
115
117
|
it "sets the current per_page value" do
|
|
116
118
|
search.per(29)
|
|
117
|
-
search.per_page.
|
|
119
|
+
expect(search.per_page).to eq(29)
|
|
118
120
|
end
|
|
119
121
|
|
|
120
122
|
it "returns the search object" do
|
|
121
|
-
search.per(29).
|
|
123
|
+
expect(search.per(29)).to eq(search)
|
|
122
124
|
end
|
|
123
125
|
end
|
|
124
126
|
|
|
125
127
|
describe '#per_page' do
|
|
126
128
|
it "defaults to 20" do
|
|
127
|
-
search.per_page.
|
|
129
|
+
expect(search.per_page).to eq(20)
|
|
128
130
|
end
|
|
129
131
|
|
|
130
132
|
it "is set as part of the search options" do
|
|
131
|
-
ThinkingSphinx::Search.new(:per_page => 10).per_page.
|
|
133
|
+
expect(ThinkingSphinx::Search.new(:per_page => 10).per_page).to eq(10)
|
|
132
134
|
end
|
|
133
135
|
|
|
134
136
|
it "should prioritise :limit over :per_page if given" do
|
|
135
|
-
ThinkingSphinx::Search.new(:per_page => 30, :limit => 40).per_page.
|
|
136
|
-
|
|
137
|
+
expect(ThinkingSphinx::Search.new(:per_page => 30, :limit => 40).per_page).
|
|
138
|
+
to eq(40)
|
|
137
139
|
end
|
|
138
140
|
|
|
139
141
|
it "should allow for string arguments" do
|
|
140
|
-
ThinkingSphinx::Search.new(:per_page => '10').per_page.
|
|
142
|
+
expect(ThinkingSphinx::Search.new(:per_page => '10').per_page).to eq(10)
|
|
141
143
|
end
|
|
142
144
|
|
|
143
145
|
it "allows setting of the per_page value" do
|
|
144
146
|
search.per_page(24)
|
|
145
|
-
search.per_page.
|
|
147
|
+
expect(search.per_page).to eq(24)
|
|
146
148
|
end
|
|
147
149
|
end
|
|
148
150
|
|
|
149
151
|
describe '#populate' do
|
|
150
152
|
it "runs the middleware" do
|
|
151
|
-
stack.
|
|
153
|
+
expect(stack).to receive(:call).with([context]).and_return(true)
|
|
152
154
|
|
|
153
155
|
search.populate
|
|
154
156
|
end
|
|
155
157
|
|
|
156
158
|
it "does not retrieve results twice" do
|
|
157
|
-
stack.
|
|
159
|
+
expect(stack).to receive(:call).with([context]).once.and_return(true)
|
|
158
160
|
|
|
159
161
|
search.populate
|
|
160
162
|
search.populate
|
|
@@ -163,11 +165,11 @@ describe ThinkingSphinx::Search do
|
|
|
163
165
|
|
|
164
166
|
describe '#respond_to?' do
|
|
165
167
|
it "should respond to Array methods" do
|
|
166
|
-
search.respond_to?(:each).
|
|
168
|
+
expect(search.respond_to?(:each)).to be_truthy
|
|
167
169
|
end
|
|
168
170
|
|
|
169
171
|
it "should respond to Search methods" do
|
|
170
|
-
search.respond_to?(:per_page).
|
|
172
|
+
expect(search.respond_to?(:per_page)).to be_truthy
|
|
171
173
|
end
|
|
172
174
|
|
|
173
175
|
it "should return true for methods delegated to pagination mask by method_missing" do
|
|
@@ -196,7 +198,7 @@ describe ThinkingSphinx::Search do
|
|
|
196
198
|
|
|
197
199
|
context[:results] << glazed
|
|
198
200
|
|
|
199
|
-
search.to_a.first.__id__.
|
|
201
|
+
expect(search.to_a.first.__id__).to eq(unglazed.__id__)
|
|
200
202
|
end
|
|
201
203
|
end
|
|
202
204
|
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
# encoding: utf-8
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
2
4
|
module ThinkingSphinx; end
|
|
3
5
|
|
|
4
6
|
require './lib/thinking_sphinx/wildcard'
|
|
@@ -6,41 +8,46 @@ require './lib/thinking_sphinx/wildcard'
|
|
|
6
8
|
describe ThinkingSphinx::Wildcard do
|
|
7
9
|
describe '.call' do
|
|
8
10
|
it "does not star quorum operators" do
|
|
9
|
-
ThinkingSphinx::Wildcard.call("foo/3").
|
|
11
|
+
expect(ThinkingSphinx::Wildcard.call("foo/3")).to eq("*foo*/3")
|
|
10
12
|
end
|
|
11
13
|
|
|
12
14
|
it "does not star proximity operators or quoted strings" do
|
|
13
|
-
ThinkingSphinx::Wildcard.call(%q{"hello world"~3}).
|
|
14
|
-
|
|
15
|
+
expect(ThinkingSphinx::Wildcard.call(%q{"hello world"~3})).
|
|
16
|
+
to eq(%q{"hello world"~3})
|
|
15
17
|
end
|
|
16
18
|
|
|
17
19
|
it "treats slashes as a separator when starring" do
|
|
18
|
-
ThinkingSphinx::Wildcard.call("a\\/c").
|
|
20
|
+
expect(ThinkingSphinx::Wildcard.call("a\\/c")).to eq("*a*\\/*c*")
|
|
19
21
|
end
|
|
20
22
|
|
|
21
23
|
it "separates escaping from the end of words" do
|
|
22
|
-
ThinkingSphinx::Wildcard.call("\\(913\\)").
|
|
24
|
+
expect(ThinkingSphinx::Wildcard.call("\\(913\\)")).to eq("\\(*913*\\)")
|
|
23
25
|
end
|
|
24
26
|
|
|
25
27
|
it "ignores escaped slashes" do
|
|
26
|
-
ThinkingSphinx::Wildcard.call("\\/\\/pan").
|
|
28
|
+
expect(ThinkingSphinx::Wildcard.call("\\/\\/pan")).to eq("\\/\\/*pan*")
|
|
27
29
|
end
|
|
28
30
|
|
|
29
31
|
it "does not star manually provided field tags" do
|
|
30
|
-
ThinkingSphinx::Wildcard.call("@title pan").
|
|
32
|
+
expect(ThinkingSphinx::Wildcard.call("@title pan")).to eq("@title *pan*")
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
it 'does not star multiple field tags' do
|
|
36
|
+
expect(ThinkingSphinx::Wildcard.call("@title pan @tags food")).
|
|
37
|
+
to eq("@title *pan* @tags *food*")
|
|
31
38
|
end
|
|
32
39
|
|
|
33
40
|
it "does not star manually provided arrays of field tags" do
|
|
34
|
-
ThinkingSphinx::Wildcard.call("@(title, body) pan").
|
|
35
|
-
|
|
41
|
+
expect(ThinkingSphinx::Wildcard.call("@(title, body) pan")).
|
|
42
|
+
to eq("@(title, body) *pan*")
|
|
36
43
|
end
|
|
37
44
|
|
|
38
45
|
it "handles nil queries" do
|
|
39
|
-
ThinkingSphinx::Wildcard.call(nil).
|
|
46
|
+
expect(ThinkingSphinx::Wildcard.call(nil)).to eq('')
|
|
40
47
|
end
|
|
41
48
|
|
|
42
49
|
it "handles unicode values" do
|
|
43
|
-
ThinkingSphinx::Wildcard.call('älytön').
|
|
50
|
+
expect(ThinkingSphinx::Wildcard.call('älytön')).to eq('*älytön*')
|
|
44
51
|
end
|
|
45
52
|
end
|
|
46
53
|
end
|
|
@@ -1,19 +1,22 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
require 'spec_helper'
|
|
2
4
|
|
|
3
5
|
describe ThinkingSphinx do
|
|
4
6
|
describe '.count' do
|
|
5
|
-
let(:search) { double('search', :total_entries => 23
|
|
7
|
+
let(:search) { double('search', :total_entries => 23, :populated? => false,
|
|
8
|
+
:options => {}) }
|
|
6
9
|
|
|
7
10
|
before :each do
|
|
8
|
-
ThinkingSphinx::Search.
|
|
11
|
+
allow(ThinkingSphinx::Search).to receive_messages :new => search
|
|
9
12
|
end
|
|
10
13
|
|
|
11
14
|
it "returns the total entries of the search object" do
|
|
12
|
-
ThinkingSphinx.count.
|
|
15
|
+
expect(ThinkingSphinx.count).to eq(search.total_entries)
|
|
13
16
|
end
|
|
14
17
|
|
|
15
18
|
it "passes through the given query and options" do
|
|
16
|
-
ThinkingSphinx::Search.
|
|
19
|
+
expect(ThinkingSphinx::Search).to receive(:new).with('foo', { :bar => :baz }).
|
|
17
20
|
and_return(search)
|
|
18
21
|
|
|
19
22
|
ThinkingSphinx.count('foo', :bar => :baz)
|
|
@@ -24,15 +27,15 @@ describe ThinkingSphinx do
|
|
|
24
27
|
let(:search) { double('search') }
|
|
25
28
|
|
|
26
29
|
before :each do
|
|
27
|
-
ThinkingSphinx::Search.
|
|
30
|
+
allow(ThinkingSphinx::Search).to receive_messages :new => search
|
|
28
31
|
end
|
|
29
32
|
|
|
30
33
|
it "returns a new search object" do
|
|
31
|
-
ThinkingSphinx.search.
|
|
34
|
+
expect(ThinkingSphinx.search).to eq(search)
|
|
32
35
|
end
|
|
33
36
|
|
|
34
37
|
it "passes through the given query and options" do
|
|
35
|
-
ThinkingSphinx::Search.
|
|
38
|
+
expect(ThinkingSphinx::Search).to receive(:new).with('foo', { :bar => :baz }).
|
|
36
39
|
and_return(search)
|
|
37
40
|
|
|
38
41
|
ThinkingSphinx.search('foo', :bar => :baz)
|
data/thinking-sphinx.gemspec
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
# -*- encoding: utf-8 -*-
|
|
2
4
|
$:.push File.expand_path('../lib', __FILE__)
|
|
3
5
|
|
|
4
6
|
Gem::Specification.new do |s|
|
|
5
7
|
s.name = 'thinking-sphinx'
|
|
6
|
-
s.version = '
|
|
8
|
+
s.version = '6.0.0'
|
|
7
9
|
s.platform = Gem::Platform::RUBY
|
|
8
10
|
s.authors = ["Pat Allan"]
|
|
9
11
|
s.email = ["pat@freelancing-gods.com"]
|
|
@@ -12,7 +14,10 @@ Gem::Specification.new do |s|
|
|
|
12
14
|
s.description = %Q{An intelligent layer for ActiveRecord (via Rails and Sinatra) for the Sphinx full-text search tool.}
|
|
13
15
|
s.license = 'MIT'
|
|
14
16
|
|
|
15
|
-
s.
|
|
17
|
+
s.metadata['homepage_uri'] = s.homepage
|
|
18
|
+
s.metadata['source_code_uri'] = 'https://github.com/pat/thinking-sphinx'
|
|
19
|
+
s.metadata['changelog_uri'] = 'https://github.com/pat/thinking-sphinx/blob/develop/CHANGELOG.markdown'
|
|
20
|
+
s.metadata['rubygems_mfa_required'] = 'true'
|
|
16
21
|
|
|
17
22
|
s.files = `git ls-files`.split("\n")
|
|
18
23
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
|
@@ -21,15 +26,17 @@ Gem::Specification.new do |s|
|
|
|
21
26
|
}
|
|
22
27
|
s.require_paths = ['lib']
|
|
23
28
|
|
|
24
|
-
s.
|
|
25
|
-
|
|
26
|
-
s.add_runtime_dependency '
|
|
29
|
+
s.required_ruby_version = '>= 3.0'
|
|
30
|
+
|
|
31
|
+
s.add_runtime_dependency 'activerecord', '>= 6.1.0'
|
|
32
|
+
s.add_runtime_dependency 'joiner', '>= 0.6.0'
|
|
27
33
|
s.add_runtime_dependency 'middleware', '>= 0.1.0'
|
|
28
|
-
s.add_runtime_dependency 'innertube', '>= 1.0
|
|
29
|
-
s.add_runtime_dependency 'riddle', '
|
|
34
|
+
s.add_runtime_dependency 'innertube', '>= 1.1.0'
|
|
35
|
+
s.add_runtime_dependency 'riddle', '~> 2.4'
|
|
30
36
|
|
|
31
37
|
s.add_development_dependency 'appraisal', '~> 1.0.2'
|
|
32
|
-
s.add_development_dependency 'combustion', '~>
|
|
33
|
-
s.add_development_dependency 'database_cleaner', '~>
|
|
34
|
-
s.add_development_dependency 'rspec', '~>
|
|
38
|
+
s.add_development_dependency 'combustion', '~> 1.1'
|
|
39
|
+
s.add_development_dependency 'database_cleaner', '~> 2.0.2'
|
|
40
|
+
s.add_development_dependency 'rspec', '~> 3.12.0'
|
|
41
|
+
s.add_development_dependency 'rspec-retry', '~> 0.5.6'
|
|
35
42
|
end
|