apache / apache/lucene

BlendedInfixSuggester to handle multi term matches better [LUCENE-8347]

Open
#9,394 13 comments 0 reactions 0 assignees View on GitHub
affects-version:7.3.1 legacy-jira-priority:Major module:core/search type:enhancement
Dominant language
Java
Stars
3.6k
Forks
1.4k
Avg merge
2d 11h
Merged PRs (30d)
88

Description

Currently the blendedInfix suggester considers just the first match position when scoring a suggestion.
From the lucene-dev mailing list :
"
If I write more than one term in the query, let's say 
 
"Mini Bar Fridge" 
 
I would expect in the results something like (note that allTermsRequired=true and the schema weight field always returns 1000)
 
- **Mini Bar Fridge** something
- **Mini Bar Fridge** something else
- **Mini Bar** something **Fridge**        
- **Mini Bar** something else **Fridge**
- **Mini** something **Bar Fridge**
...
 
Instead I see this: 
 
- **Mini Bar** something **Fridge**        
- **Mini Bar** something else **Fridge**
- **Mini Bar Fridge** something
- **Mini Bar Fridge** something else
- **Mini** something **Bar Fridge**
...
 
After having a look at the suggester code (BlendedInfixSuggester.createCoefficient), I see that the component takes in account only one position, which is the lowest position (among the three matching terms) within the term vector ("mini" in the example above) so all the suggestions above have the same weight 
"
Scope of this Jira issue is to improve the BlendedInfix to better manage those scenarios.

---
Migrated from [LUCENE-8347](https://issues.apache.org/jira/browse/LUCENE-8347) by Alessandro Benedetti (@alessandrobenedetti), 2 votes, updated Jan 23 2020
Attachments: [LUCENE-8347.patch](https://apache.github.io/lucene-jira-archive/attachments/LUCENE-8347/LUCENE-8347.patch) (versions: 2)
Linked issues:
- #9390

Contributor guide

Open the contributing guide

Research direction

Start with BlendedInfixSuggester.createCoefficient and inspect how it scores the first matching position for multi-term queries. Compare the reported Mini Bar Fridge examples with the attached LUCENE-8347.patch and linked issue #9390. Done means all required terms are considered so suggestions are ranked in the expected order.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend, search
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 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.