Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- { ruby: '4.0', mongoid: '9', mongodb: '8.0', bundler: default }
env:
MONGOID_VERSION: ${{ matrix.mongoid }}
COVERAGE: ${{ matrix.ruby == '4.0' && 'true' || 'false' }}
COVERAGE: ${{ (matrix.mongoid == '~> 3.1.0' || matrix.ruby == '4.0') && 'true' || 'false' }}
services:
mongodb:
image: mongo:${{ matrix.mongodb }}
Expand All @@ -43,12 +43,24 @@ jobs:
bundler-cache: true
- run: bundle exec rake spec
- name: Report coverage to Coveralls
if: matrix.ruby == '4.0'
if: matrix.mongoid == '~> 3.1.0' || matrix.ruby == '4.0'
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
file: coverage/.resultset.json
format: simplecov
parallel: true
flag-name: ruby-${{ matrix.ruby }}

coverage:
needs: test
if: ${{ always() && needs.test.result == 'success' }}
runs-on: ubuntu-latest
steps:
- uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
parallel-finished: true

lint:
runs-on: ubuntu-22.04
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
### 0.9.0 (Next)

* [#68](https://github.com/mongoid/mongoid_fulltext/pull/68): Cover candidate-budget boundaries and standalone version loading, and combine coverage from actual legacy and modern drivers - [@dblock](https://github.com/dblock).
* [#61](https://github.com/mongoid/mongoid_fulltext/pull/61): Support weighted fields with configurable maximum or summed field-score aggregation - [@dblock](https://github.com/dblock).
* [#60](https://github.com/mongoid/mongoid_fulltext/pull/60): Extract ngram calculation and index-definition planning for maintainability without changing model APIs or search behavior - [@tomasc](https://github.com/tomasc), [@dblock](https://github.com/dblock).
* [#59](https://github.com/mongoid/mongoid_fulltext/pull/59): Document and cover class-level indexing timeout options - [@dblock](https://github.com/dblock).
Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ group :test do
gem 'database_cleaner', '~> 1.8'
end
gem 'rspec'
gem 'simplecov', '~> 0.22', require: false if ENV['COVERAGE'] == 'true'
gem 'simplecov', RUBY_VERSION < '2.5' ? '~> 0.16.0' : '~> 0.22', require: false if ENV['COVERAGE'] == 'true'
end

group :development do
Expand Down
19 changes: 19 additions & 0 deletions spec/mongoid/candidate_limits_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
require 'spec_helper'

describe 'Full-text candidate limits' do
it 'bounds initial candidates and continues with limited candidates for later ngrams' do
config = BasicArtwork.mongoid_fulltext_config.values.first
original = config[:max_candidate_set_size]
begin
config[:max_candidate_set_size] = 1
artworks = 2.times.map { BasicArtwork.create!(title: 'alphabet beta') }

results = BasicArtwork.fulltext_search('alphabet beta', max_results: 1, return_scores: true)
expect(results.length).to eq(1)
expect(artworks).to include(results.first.first)
expect(results.first.last).to be > 0
ensure
config[:max_candidate_set_size] = original
end
end
end
9 changes: 9 additions & 0 deletions spec/version_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
require 'spec_helper'

describe Mongoid::FullTextSearch do
it 'loads a standalone semantic version' do
stub_const('Mongoid::FullTextSearch', Module.new)
load File.expand_path('../lib/mongoid/full_text_search/version.rb', __dir__)
expect(Mongoid::FullTextSearch::VERSION).to match(/\A\d+\.\d+\.\d+\z/)
end
end
Loading