Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Relevance always returning 1.0 #107

Open
mysticaltech opened this issue Dec 20, 2016 · 0 comments
Open

Relevance always returning 1.0 #107

mysticaltech opened this issue Dec 20, 2016 · 0 comments

Comments

@mysticaltech
Copy link

mysticaltech commented Dec 20, 2016

Hello folks,

First of all thank you for your good work.

To make this gem work with the latest mongoid, I needed to use this branch:
gem 'mongoid_search', git: 'git://github.com/sivagollapalli/mongoid_search.git', branch: 'mongoid_rc_support'

I think it's already in your pipeline to merge with your master.

The search works as expected however I am getting an issue with relevance value, it always comes as 1.0 for all results for whatever query I input.

I am searching in 3 Strings fields:

search_in :name, :name_refined, :short_description

And using full_text_search('keyword')

My config in config/initializers/mongoid.rb is as follows:

require 'lingua/stemmer'

Mongoid.raise_not_found_error = false

Mongoid::Search.setup do |config|
  config.match = :any
  config.allow_empty_search = true
  config.relevant_search = true
  config.stem_keywords = true
  config.stem_proc = Proc.new { |word| Lingua.stemmer(word, :language => 'en') }
  config.ignore_list = YAML.load(File.open(Rails.root.to_s + '/config/ignorelist.yml'))["ignorelist"]
  config.regex_search = true
  config.ligatures = { "œ"=>"oe", "æ"=>"ae" }
  config.minimum_word_size = 2
end

Any idea what might be causing my relevancy to always be 1.0 ?

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant