apache / apache/lucene

CustomScoreQuery should support arbitrary Queries [LUCENE-1608]

Open
#2,682 5 comments 0 reactions 0 assignees View on GitHub
legacy-jira-priority:Minor module:core/query/scoring type:enhancement
Dominant language
Java
Stars
3.6k
Forks
1.4k
Avg merge
2d 11h
Merged PRs (30d)
88

Description

CustomScoreQuery only allows the secondary queries to be of type ValueSourceQuery instead of allowing them to be any type of Query. As a result, what you can do with CustomScoreQuery is pretty limited.

It would be nice to extend CustomScoreQuery to allow arbitrary Query objects. Most of the code should stay about the same, though a little more care would need to be taken in CustomScorer.score() to use 0.0 when the sub-scorer does not produce a score for the current document.

---
Migrated from [LUCENE-1608](https://issues.apache.org/jira/browse/LUCENE-1608) by Steven Bethard, updated Feb 10 2011
Attachments: [CustomScoreQueryWithSubqueries.java](https://apache.github.io/lucene-jira-archive/attachments/LUCENE-1608/CustomScoreQueryWithSubqueries.java), [LUCENE-1608.patch](https://apache.github.io/lucene-jira-archive/attachments/LUCENE-1608/LUCENE-1608.patch)
Linked issues:
- #1925

Contributor guide

Open the contributing guide

Research direction

Start with CustomScoreQuery and its CustomScorer, using the attached CustomScoreQueryWithSubqueries.java and LUCENE-1608.patch as context. Confirm that secondary inputs accept arbitrary Query objects and that a sub-scorer with no score for the current document contributes 0.0; the issue is complete when those behaviors are covered.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
search
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.