Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6470251
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T06:05:16+00:00 2026-05-25T06:05:16+00:00

Say, I have this code in my model: class Facility < ActiveRecord::Base … searchable

  • 0

Say, I have this code in my model:

class Facility < ActiveRecord::Base
...
searchable do
  text :name
  text :facility_type do
end
...

And this in search controller:

 @search = Facility.search do
    keywords(query) do
      boost_fields :name =>  1.9,
                   :facility_type => 1.98
    end
    ...

And I have two Facility objects – first one having a type “cafe”, but not having a word “cafe” in the name, a second one – called “cafe sun”, for example, but being of a “bar” type in fact.

I run the search with query=”cafe” and get both facilities in the response, but the score is 5.003391 for a “cafe sun” and 1.250491 for a real “cafe”

For the second try I set

boost_fields :name =>  1.9, :facility_type => 3

Score for “cafe sun” doesn’t change, but “cafe” somewhat grew up – 1.8946824

So, as long as results get sorted by the score, I am interested how is it calculated ?

Or am I choosing wrong tokenizers or something, here is what I have in schema.xml

<fieldType name="text" class="solr.TextField" omitNorms="false">
  <analyzer type="index">
    <tokenizer class="solr.StandardTokenizerFactory"/>
    <filter class="solr.StandardFilterFactory"/>
    <filter class="solr.LowerCaseFilterFactory"/>
    <filter class="solr.EdgeNGramFilterFactory"
            minGramSize="3"
            maxGramSize="30"/>
  </analyzer>
  <analyzer type="query">
    <tokenizer class="solr.StandardTokenizerFactory"/>
    <filter class="solr.StandardFilterFactory"/>
    <filter class="solr.LowerCaseFilterFactory"/>
  </analyzer>
</fieldType>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T06:05:17+00:00Added an answer on May 25, 2026 at 6:05 am

    Scoring results is the domain of the Lucene library, and the crux of its algorithm is described in detail here:

    • http://lucene.apache.org/core/3_6_1/api/core/org/apache/lucene/search/Similarity.html
    • http://lucene.apache.org/core/3_6_1/scoring.html

    To inspect the raw scoring data, run a query against your Solr instance directly and append the debugQuery=on parameter to see scoring data.

    http://localhost:8983/solr/select?q=test&defType=dismax&qf=name_text+facility_type_text&debugQuery=on
    

    For general relevancy optimizations in Solr, you can consult the SolrRelevancyFAQ. It also has one question specifically demonstrating the output of debugQuery

    All in all: you ask a very good question with a very deep answer. I may edit my response down the road to expand on the subject.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let's say you have this Model: //model public class Stuff { public string Name
Say I have this code: #import <UIKit/UIKit.h> @interface MyView : UIView @end @implementation MyView
Lets say I have this code: <?php class hello { var $greeting = hello;
Say I have this line of code in the view. <?php echo CHtml::activeTextField($model,'start_time'); ?>
Say I have jquery code like this: html += '<div class=index>' + item.index +
Let's say I have two models like so: class Comment < ActiveRecord::Base belongs_to :user
Let's say I have this code: class Score { public Update(int score) { update
Say I have this code - public interface ParentInterface1 { public List<? extends ChildInterface1>
Lets say we have this code: bool KeepGoing = true; DataInThread = new Thread(new
Let's say I have this code: if (md5($_POST[$foo['bar']]) == $somemd5) { doSomethingWith(md5($_POST[$foo['bar']]); } I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.