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 7725023
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T04:50:06+00:00 2026-06-01T04:50:06+00:00

I had some issues with Lucene as it always had a constant score and

  • 0

I had some issues with Lucene as it always had a constant score and it ignored my boost values.

Setting the parser rewriteMethod to SCORING_BOOLEAN_QUERY_REWRITE did the trick but it has a weird side effect on the ‘clauseCount’ that I don’t quite get.

With constant scoring I have no issues with the maxClauseCount which is 1024 on default. With dynamic scoring the clauseCount quickly exceeded 1024 and I really wonder why that is.

Does anyone know the technical details of this?

In another post someone mentioned that queries like ‘ca*’ is rewritten to ‘car OR cars’. But shouldn’t that be always the case, no matter if you use constant or dynamic scoring?

Thanks in advance!

edit:
So here’s my solution. I ran into some problems because the document boosting value I set when the doc was created was always 1.0 when I got the doc later. Maybe a bug, I’m not sure about this. What I know is that when you get a document from the searcher, the document object is newly created and the boost value is never set. Just the fields. Could be related to the C# port.
Anyway, I wrote a CustomScoreQuery that uses the original query and multiplies the score with my initial boost value that I’ve set in the doc field (a nasty workaround, I know)

Enough talk, here’s my code. I’m open to improvements. Especially where I could get the original boost value without the need of a searcher or a field.

public class DynamicBoostingQuery : CustomScoreQuery
{
    private Searcher s;

    public DynamicBoostingQuery(Query q, Searcher searcher)
        : base(q)
    {
        this.s = searcher;
    }

    public override float CustomScore(int doc, float subQueryScore, float valSrcScore)
    {
        float val = base.CustomScore(doc, subQueryScore, valSrcScore);

        try
        {
            Document d = s.Doc(doc);

            float priority = float.Parse(d.Get("raw_categoryPriority"));

            return val * priority;
        }
        catch
        {
            return val;
        }        
    }
}
  • 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-06-01T04:50:07+00:00Added an answer on June 1, 2026 at 4:50 am

    MultiTermQuery’s default (in Lucene 3.5 on Java, don’t know the exact version this was introduced) is CONSTANT_SCORE_AUTO_REWRITE_DEFAULT, which uses the CONSTANT_SCORE_BOOLEAN_QUERY_REWRITE only up to a defined threshold of clauses and hits and beyond that switches to CONSTANT_SCORE_FILTER_REWRITE, which never raises TooManyClauses. You overrode that and forced Lucene into using a BooleanQuery rewrite. Unfortunately, there is no option to use a Filter-based rewrite if you need the score.

    Maybe you can try using CustomScoreQuery to recover your document boosts.

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

Sidebar

Related Questions

So basically this code was working fine before. I had some computer issues and
I had some issues along with others, loading Tomcat 7.0.22.0 with NetBeans on packaged
So, I've had some issues while trying to come over from Latin1 encoded databases,
Having had some Sql Compact db corruption issues in the past and gone through
I had some issues with a different ODM yesterday so I decided to take
I have had some issues with a site (basically MySQL is killing the proccessor)
Trying to install roundcube webmail - had some issues related to driver configuration -
I have had some issues with downtime as a result of hitting the max_user_connections
We recently had some issues where a sql script that would remove duplicate entries
I'm using jScrollPane and I had some issues in Chrome and Safari with the

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.