ankane / searchkick

Intelligent search made easy
MIT License
6.56k stars 757 forks source link

boost_by not working #558

Closed navaneeth closed 8 years ago

navaneeth commented 9 years ago

In my case, every document has a field called pindex. This pindex contains the popularity that this document has. Now when I search for documents, I search in the specified fields and I need to boost the documents which has high pindex value. My boost_by looks like the following.

{page: options[:page_no], per_page: options[:page_size], load: false, fields: ['title^20', 'offers.original_category_paths.0^5', 'brand', 'offers.original_product_ids', 'offers.offer_titles'], boost_by: [:pindex]}

But this boost_by seems to be not working. I still see documents with higher pindex comes in the bottom of the search results. Am I using this incorrectly or is this a bug with searchkick?

ankane commented 8 years ago

Use the explain option to see how Elasticsearch is scoring your queries. You may need to increase the boost factor.

vasilakisfil commented 8 years ago

@navaneeth did you make it work ? boost_by is not working for me either no matter what factor I add.

navaneeth commented 8 years ago

It worked for me. In my case, the factor was small and not making a noticeable difference.

On Tue, Jan 12, 2016 at 3:56 PM, Filippos Vasilakis < notifications@github.com> wrote:

@navaneeth https://github.com/navaneeth did you make it work ? boost_by is not working for me either no matter what factor I add.

— Reply to this email directly or view it on GitHub https://github.com/ankane/searchkick/issues/558#issuecomment-170866704.

Thanks Navaneeth

UnquietCode commented 8 years ago

I am having issues here as well. It seems with the normal boost_by with a large factor I'm still not getting the correct results. When I switch too boost_mode multiply then I start to see it working. Is it possible that score_mode sum isn't working properly anymore? Also, it would be great if the readme mentioned the scoring modes.

ankane commented 8 years ago

Cleaning up issues. For future readers, cases of boost_by not working are likely due to scoring, which you can inspect with the explain option.