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

  • Home
  • SEARCH
  • 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 592995
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T15:47:54+00:00 2026-05-13T15:47:54+00:00

I currently have a SOLR query which uses the query (q), query fields (qf)

  • 0

I currently have a SOLR query which uses the query (q), query fields (qf) and phrase fields (pf) to retrieve the results I want. An example is:

/solr/select
?q=superbowl
&qf=title^3+headline^2+intro+fulltext
&pf=title^3+headline^2+intro+fulltext
&fl=id,title,ts_modified,score
&debugQuery=true

The idea is that the title and headline of the “main item” give the best indication of what the result is “about”, but the intro and fulltext provides some input too. Ie, imagine a collection of links, where the collection itself has metadata (what it’s a collection of), but each link has it’s own data (title of the link, synopsis, etc). If we search for “superbowl”, the most relevant results are the ones with “superbowl” in the collection metadata, the least relevant results are those with “superbowl” in just the synopsis of one of the links… but they’re all valid results.

What I’m trying to do is add a boost to the relevancy score so that the most recent results float towards the top, but retaining title,headline,intro,fulltext as part of the formula. A recent result with the search string in the collection metadata would be more relevant than one with it only in the links metadata… but that “links only” recent result might be more relevant than a very old result with the search string in the collection metadata. (I hope that’s somewhat clear).

The problem is that I can’t figure out how to combine the boost function documented on the SOLR site with the use of the qf/pf fields. Specifically…

From the SOLR site, something like the following works to boost the results by date:

/solr/select
?q={!boost%20b=$dateboost%20v=$qq}
&dateboost=ord(ts_modified)
&qq=superbowl
&fl=ts_modified,score
&debugQuery=true

However, I can’t figure out how to combine that query with the use of qf and pf. Any suggestions would be more than welcome.

Thanks to danben’s response, I was able to come up with the following:

/solr/select
?q={!boost%20b=$dateboost%20v=$qq%20defType=dismax}
&dateboost=ord(ts_modified)
&qq=superbowl
&qf=title^3+headline^2+intro^2+fulltext
&pf=title^3+headline^2+intro^2+fulltext
&fl=ts_modifieds,score
&debugQuery=true

It looks like the actual problems I was having were:

  • I left spaces in the q param instead of escaping them (%20) when copy/pasting
  • I didn’t include the defType=dismax in my q param, so that it would pay attention to the qf/pf parameters
  • 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-13T15:47:55+00:00Added an answer on May 13, 2026 at 3:47 pm

    Check out http://wiki.apache.org/solr/SolrRelevancyFAQ#How_can_I_boost_the_score_of_newer_documents

    This is based on the ms function, which returns the difference in milliseconds between two timestamps / dates, and ReciprocalFloatFunction which increases as the value passed decreases.

    Since you are using the DisMaxRequestHandler, you may need to specify your query using the bq/bf parameters. From http://lucene.apache.org/solr/api/org/apache/solr/handler/DisMaxRequestHandler.html:

    bq – (Boost Query) a raw lucene query that will be included in the
    users query to influence the score. If
    this is a BooleanQuery with a default
    boost (1.0f), then the individual
    clauses will be added directly to the
    main query. Otherwise, the query will
    be included as is. This param can be
    specified multiple times, and the
    boosts are are additive. NOTE: the
    behaviour listed above is only in
    effect if a single bq paramter is
    specified. Hence you can disable it by
    specifying an additional, blank, bq
    parameter.

    bf – (Boost Functions) functions (with optional boosts) that will be
    included in the users query to
    influence the score. Format is:
    "funcA(arg1,arg2)^1.2
    funcB(arg3,arg4)^2.2". NOTE:
    Whitespace is not allowed in the
    function arguments. This param can be
    specified multiple times, and the
    functions are additive.

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

Sidebar

Ask A Question

Stats

  • Questions 312k
  • Answers 312k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Unit tests help you develop code with fewer bugs but… May 13, 2026 at 10:33 pm
  • Editorial Team
    Editorial Team added an answer Some general comments: I don't think that @ast4 really means… May 13, 2026 at 10:33 pm
  • Editorial Team
    Editorial Team added an answer It turns out that WebKit has a policy of not… May 13, 2026 at 10:33 pm

Related Questions

I have managed to build an index in Solr which I can search on
Given a time (eg. currently 4:24pm on Tuesday), I'd like to be able to
I have a default tomcat installation with no change to the logging configuration. The
I currently have a fairly robust server-side validation system in place, but I'm looking
I currently have a class and I'm trying to create an easy GUI to

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.