apache / apache/lucene

SimpleQueryParser to support field filtering (aka Add field:text operator) [LUCENE-8565]

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

Description

SimpleQueryParser lacks support for the `field:` operator for creating queries which operate on fields other than the default field. Seems like one can either get the parsed query to operate on a single field, or on ALL defined fields (+ weights). No support for specifying `field:value` in the query.

It probably wasn't forgotten, but rather left out for simplicity, but since we are using this QP implementation more and more (mostly through Elasticsearch) we thought it would be useful to have it in.

Seems like this is not too hard to pull off and I'll be happy to contribute a patch for it.

---
Migrated from [LUCENE-8565](https://issues.apache.org/jira/browse/LUCENE-8565) by Itamar Syn-Hershko, updated Aug 16 2019
Pull requests: https://github.com/apache/lucene-solr/pull/498

Contributor guide

Open the contributing guide

Research direction

Start with the SimpleQueryParser entry point and review its current handling of default and all-field queries. Trace how a field:value expression would be parsed and represented, then add coverage for field-specific queries and verify the existing parser behavior remains unchanged.

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.