From 425edb9a57b8f20ddcfb3dc21eda24b737d0928e Mon Sep 17 00:00:00 2001 From: unimafy Date: Wed, 16 Aug 2023 18:43:28 +0600 Subject: [PATCH 1/2] relevant search issue --- lib/mongoid_search/mongoid_search.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/mongoid_search/mongoid_search.rb b/lib/mongoid_search/mongoid_search.rb index ff701bc..a3bb8bd 100644 --- a/lib/mongoid_search/mongoid_search.rb +++ b/lib/mongoid_search/mongoid_search.rb @@ -92,7 +92,7 @@ def search_without_relevance(query, options) end def search_relevant(query, options) - results_with_relevance(query, options).sort { |o| o['value'] }.map do |r| + results_with_relevance(query, options) { |o| o['value'] }.map do |r| new(r['_id'].merge(relevance: r['value'])) do |o| # Need to match the actual object o.instance_variable_set('@new_record', false) From 964b87f028824cd34c8e81502a63c42568458f67 Mon Sep 17 00:00:00 2001 From: unimafy Date: Thu, 28 Sep 2023 19:41:54 +0600 Subject: [PATCH 2/2] add github action --- .github/workflows/danger.yml | 17 ++++++++++ .github/workflows/rubocop.yml | 13 ++++++++ .github/workflows/test.yml | 61 +++++++++++++++++++++++++++++++++++ 3 files changed, 91 insertions(+) create mode 100644 .github/workflows/danger.yml create mode 100644 .github/workflows/rubocop.yml create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/danger.yml b/.github/workflows/danger.yml new file mode 100644 index 0000000..c2db24e --- /dev/null +++ b/.github/workflows/danger.yml @@ -0,0 +1,17 @@ +name: Danger +on: [pull_request] +jobs: + danger: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + - uses: ruby/setup-ruby@v1 + with: + ruby-version: 2.7 + bundler-cache: true + - run: | + # Personal access token for dangerpr-bot - public, but base64 encoded to avoid tripping up GitHub + TOKEN=$(echo -n Z2hwX0xNQ3VmanBFeTBvYkZVTWh6NVNqVFFBOEUxU25abzBqRUVuaAo= | base64 --decode) + DANGER_GITHUB_API_TOKEN=$TOKEN bundle exec danger --verbose diff --git a/.github/workflows/rubocop.yml b/.github/workflows/rubocop.yml new file mode 100644 index 0000000..9c3ec95 --- /dev/null +++ b/.github/workflows/rubocop.yml @@ -0,0 +1,13 @@ +name: Rubocop +on: [push, pull_request] +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: 2.7 + bundler-cache: true + - run: bundle exec rubocop diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..bd5513a --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,61 @@ +name: Test + +on: [push, pull_request] + +jobs: + test: + + strategy: + fail-fast: false + matrix: + entry: + - { ruby: '2.6.6', mongo: 'mongo:4.4', mongoid: '5' } +# - { ruby: 'jruby-9.1.17.0', mongo: 'mongo:4.4', mongoid: '5' } + - { ruby: 'jruby-9.2.11.1', mongo: 'mongo:4.4', mongoid: '5' } + - { ruby: '2.6.6', mongo: 'mongo:4.4', mongoid: '6' } + - { ruby: '2.7.1', mongo: 'mongo:4.4', mongoid: '6' } + - { ruby: '3.0.5', mongo: 'mongo:4.4', mongoid: '6' } + - { ruby: '3.1.3', mongo: 'mongo:4.4', mongoid: '6' } + - { ruby: 'jruby-9.2.11.1', mongo: 'mongo:4.4', mongoid: '6' } + - { ruby: '2.6.6', mongo: 'mongo:4.4', mongoid: '7', coverage: 'true' } + - { ruby: '2.7.1', mongo: 'mongo:4.4', mongoid: '7' } + - { ruby: '3.0.5', mongo: 'mongo:4.4', mongoid: '7' } + - { ruby: '3.1.3', mongo: 'mongo:4.4', mongoid: '7' } + - { ruby: 'jruby-9.2.11.1', mongo: 'mongo:4.4', mongoid: '7' } + - { ruby: '2.6.6', mongo: 'mongo:4.4', mongoid: '8' } + - { ruby: '2.7.1', mongo: 'mongo:4.4', mongoid: '8' } + - { ruby: '3.0.5', mongo: 'mongo:4.4', mongoid: '8' } + - { ruby: '3.1.3', mongo: 'mongo:4.4', mongoid: '8' } + experimental: [false] + + name: test (ruby=${{ matrix.entry.ruby }}, mongo=${{ matrix.entry.mongo }}, mongoid=${{ matrix.entry.mongoid }}) + runs-on: ubuntu-latest + + continue-on-error: ${{ matrix.experimental }} + + services: + mongo: + image: ${{ matrix.entry.mongo }} + ports: ["27017:27017"] + + env: + MONGOID_VERSION: ${{ matrix.entry.mongoid }} + COVERAGE: ${{ matrix.entry.coverage }} + + steps: + - uses: actions/checkout@v3 + + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.entry.ruby }} + bundler-cache: true + + - name: Run tests + run: bundle exec rspec + + - name: Code Climate + if: ${{ env.CC_TEST_REPORTER_ID != '' && success() && matrix.entry.coverage == 'true' }} + uses: paambaati/codeclimate-action@v3.2.0 + env: + CC_TEST_REPORTER_ID: ${{ vars.CC_TEST_REPORTER_ID }}