apache / apache/lucene

FreqFilteringScorerWrapper and min/max freq options on TermQuery [LUCENE-3395]

Open
#4,468 7 comments 0 reactions 0 assignees View on GitHub
legacy-jira-priority:Major type:enhancement
Dominant language
Java
Stars
3.6k
Forks
1.4k
Avg merge
2d 11h
Merged PRs (30d)
88

Description

A Solr User was asking about how specify a minimum tf when searching for a term (ie: documents matching "dog" at least 3 times).

Based on a conversation with rmuir on IRC, that led me to realize that we now explicitly expose a general "freq()" method on Scorer, and that min/max freq constraints could be implemented as a general Scorer Wrapper.

I propose that we add such a wrapper, and add setMinFreq(float)/setMaxFreq(float) methods to TermQuery (similar to the minNumShouldMatches and disableCoord type setters in BooleanQuery) that cause it to be used automatically.

---
Migrated from [LUCENE-3395](https://issues.apache.org/jira/browse/LUCENE-3395) by Chris M. Hostetter (@hossman), updated Sep 03 2018
Attachments: [LUCENE-3395.patch](https://apache.github.io/lucene-jira-archive/attachments/LUCENE-3395/LUCENE-3395.patch)
Linked issues:
- #9351

Contributor guide

Open the contributing guide

Research direction

Start by reading the TermQuery and Scorer entry points, then inspect the attached LUCENE-3395.patch and the discussion history. Done means the proposed general frequency-filtering wrapper and TermQuery min/max frequency options are implemented consistently with the issue's requested behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
search
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.