apache / apache/lucene

CommonTermsQuery should be able to query fields other than the one used as a source of commonness [LUCENE-5435]

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

Description

It'd be wonderful if I could use the "commonness" of one term, say the contents of a document, to power a search across both the document and its title. Continuing the metaphor, I'd like be able to build a query like this:
"the first"
that is rewritten into:
(title:the OR body:the) +(title:first OR body:first)
with the help of the CommonTermsQuery logic. Essentially, I'd like CommonTermsQuery to soften the implicit AND for "the" into and OR because it is common.

---
Migrated from [LUCENE-5435](https://issues.apache.org/jira/browse/LUCENE-5435) by Nik Everett (@nik9000)
Attachments: [LUCENE-5435.patch](https://apache.github.io/lucene-jira-archive/attachments/LUCENE-5435/LUCENE-5435.patch)

Contributor guide

Open the contributing guide

Research direction

Start with CommonTermsQuery and the attached LUCENE-5435.patch to understand the existing commonness logic. Determine how a source field could provide term commonness while the query spans title and body, then verify the requested rewrite behavior for "the first" with focused tests. Done means the example rewrites with common terms softened across both fields.

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.