Skip to content

Commit

Permalink
Merge branch 'Casecommons:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
causztic authored Aug 14, 2024
2 parents ccc2e82 + 1f88614 commit 4993d87
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 6 deletions.
9 changes: 8 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,18 @@ jobs:
- ACTIVE_RECORD_VERSION="~> 6.1.0"
- ACTIVE_RECORD_VERSION="~> 7.0.0"
- ACTIVE_RECORD_VERSION="~> 7.1.0"
- ACTIVE_RECORD_VERSION="~> 7.2.0"
allow-failure: [false]
exclude:
- ruby-version: '3.0'
active-record-version-env: ACTIVE_RECORD_VERSION="~> 7.2.0"
include:
- ruby-version: '3.3'
active-record-version-env: ACTIVE_RECORD_BRANCH="main"
allow-failure: true
- ruby-version: '3.3'
active-record-version-env: ACTIVE_RECORD_BRANCH="7-2-stable"
allow-failure: true
- ruby-version: '3.3'
active-record-version-env: ACTIVE_RECORD_BRANCH="7-1-stable"
allow-failure: true
Expand All @@ -57,7 +64,7 @@ jobs:
allow-failure: true
continue-on-error: ${{ matrix.allow-failure }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
Expand Down
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# pg_search changelog

## 2.3.7

* Drop support for Ruby 2.6 and 2.7
* Drop support for Active Record 6.0 and earlier
* Support Ruby 3.2 and 3.3
* Support Active Record 7.1
* Support Active Record 7.2 (fatkodima)
* Add U+02BB/U+02BC to disallowed tsquery characters (Vital Ryabchinskiy)
* add support for Arel::Nodes::SqlLiteral columns (Kyle Fazzari)
* Improve documentation (Prima Aulia Gusta, Ross Baird, Andy Atkinson)

## 2.3.6

* Drop support for Ruby 2.5
Expand Down
29 changes: 25 additions & 4 deletions lib/pg_search/scope_options.rb
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,32 @@ def subquery
end

def conditions
config.features
.reject { |_feature_name, feature_options| feature_options && feature_options[:sort_only] }
.map { |feature_name, _feature_options| feature_for(feature_name).conditions }
.inject { |accumulator, expression| Arel::Nodes::Or.new(accumulator, expression) }
expressions =
config.features
.reject { |_feature_name, feature_options| feature_options && feature_options[:sort_only] }
.map { |feature_name, _feature_options| feature_for(feature_name).conditions }

or_node(expressions)
end

# https://github.com/rails/rails/pull/51492
# :nocov:
# standard:disable Lint/DuplicateMethods
or_arity = Arel::Nodes::Or.instance_method(:initialize).arity
case or_arity
when 1
def or_node(expressions)
Arel::Nodes::Or.new(expressions)
end
when 2
def or_node(expressions)
expressions.inject { |accumulator, expression| Arel::Nodes::Or.new(accumulator, expression) }
end
else
raise "Unsupported arity #{or_arity} for Arel::Nodes::Or#initialize"
end
# :nocov:
# standard:enable Lint/DuplicateMethods

def order_within_rank
config.order_within_rank || "#{primary_key} ASC"
Expand Down
2 changes: 1 addition & 1 deletion lib/pg_search/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module PgSearch
VERSION = "2.3.6"
VERSION = "2.3.7"
end

0 comments on commit 4993d87

Please sign in to comment.