apache / apache/lucene

Need QueryParser support for BooleanQuery.minNrShouldMatch [LUCENE-466]

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

Description

Attached 2 new classes:

1) CoordConstrainedBooleanQuery
A boolean query that only matches if a specified number of the contained clauses
match. An example use might be a query that returns a list of books where ANY 2
people from a list of people were co-authors, eg:
"Lucene In Action" would match ("Erik Hatcher" "Otis Gospodnetić" "Mark Harwood"
"Doug Cutting") with a minRequiredOverlap of 2 because Otis and Erik wrote that.
The book "Java Development with Ant" would not match because only 1 element in
the list (Erik) was selected.

2) CustomQueryParserExample
A customised QueryParser that allows definition of
CoordConstrainedBooleanQueries. The solution (mis)uses fieldnames to pass
parameters to the custom query.

---
Migrated from [LUCENE-466](https://issues.apache.org/jira/browse/LUCENE-466) by Mark Harwood (@markharwood), 1 vote, updated Mar 19 2014
Environment:
```
Operating System: other
Platform: Other
```

Linked issues:
- #1473

Contributor guide

Open the contributing guide

Research direction

Start by reading QueryParser and BooleanQuery's minNrShouldMatch behavior, then inspect the described CoordConstrainedBooleanQuery and CustomQueryParserExample classes. Determine how QueryParser should represent the minimum required overlap without relying on field names. Done means the parser can express the requested constrained query and its matching behavior is covered by tests.

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
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.