apache / apache/lucene

When executing MoreLikeThis with multiple fields, it should create a query considering all fieldNames [LUCENE-6869]

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

Description

When executing MLT with multiple fields, it should
considerem them all

If a document has the same term in multiple fields, the
mlt generates a query considering only the field with
the higher idf. This commit changes the behaviour, to
include in the query all fieldnames.

Eg.:
Last behaviour:
Doc ("fieldName1", "value")
("fieldName2", "value")

Old behaviour generates query: "fieldName1:value"
New Behaviour generates query: "fieldName1:value
fieldName2:value"

Proposed solution:
https://github.com/prosanes/lucene-solr/pull/1/files

---
Migrated from [LUCENE-6869](https://issues.apache.org/jira/browse/LUCENE-6869) by Pedro Rosanes (@prosanes)

Contributor guide

Open the contributing guide

Research direction

Start at the MoreLikeThis implementation and its existing query-generation tests, then trace how terms shared across multiple fields are selected. Confirm completion by adding coverage showing that matching terms from every fieldName appear in the generated query, rather than only the field with the higher IDF.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
search
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.