apache / apache/lucene

QueryParser with Locale Based Operators (French included) [LUCENE-682]

Open
#1,757 13 comments 0 reactions 1 assignee Claimed by @hossman 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

Here is a version of the QueryParser that can "understand" the AND, OR and NOT keyword in other languages.

If activated,
- "a ET b" should return the same query as "a AND b", namely: "+a +b"
- "a OU b" should return the same query as "a OR b", namely: "a b"
- "a SAUF b" should return the same query as "a NOT b", namely: "a -b"

Here are its main points :

1) Patched from revision 454774 of lucene 2.1dev (trunk) (probably could be used with other versions)
2) The "ant test" target is still successful when the modified QueryParser is used
3) It doesn't break actual code
4) The default behavior is the same as before
5) It has to be deliberately activated
6) It use ResourceBundle to find the keywords translation
7) Comes with FRENCH translation
8) Comes with JUnit testCases
9) Adds 1 public method to QueryParser
10) Expands the TOKEN <TERM>
11) Use TOKEN_MGR_DECLS to set some field for the TokenManager

---
Migrated from [LUCENE-682](https://issues.apache.org/jira/browse/LUCENE-682) by Patrick Turcotte, 3 votes, updated Feb 28 2013
Attachments: [LocalizedQueryParser.patch](https://apache.github.io/lucene-jira-archive/attachments/LUCENE-682/LocalizedQueryParser.patch) (versions: 2), [LocalizedQueryParser.zip](https://apache.github.io/lucene-jira-archive/attachments/LUCENE-682/LocalizedQueryParser.zip), [LocalizedQueryParserDemo.java](https://apache.github.io/lucene-jira-archive/attachments/LUCENE-682/LocalizedQueryParserDemo.java), [LocalizedQueryParserOperatorsMicroBench.java](https://apache.github.io/lucene-jira-archive/attachments/LUCENE-682/LocalizedQueryParserOperatorsMicroBench.java), [QueryParser_fr.properties](https://apache.github.io/lucene-jira-archive/attachments/LUCENE-682/QueryParser_fr.properties), [QueryParser.jj](https://apache.github.io/lucene-jira-archive/attachments/LUCENE-682/QueryParser.jj), [QueryParser.jj.patch](https://apache.github.io/lucene-jira-archive/attachments/LUCENE-682/QueryParser.jj.patch), [QueryParser.properties](https://apache.github.io/lucene-jira-archive/attachments/LUCENE-682/QueryParser.properties), [TestQueryParserLocaleOperators.java](https://apache.github.io/lucene-jira-archive/attachments/LUCENE-682/TestQueryParserLocaleOperators.java)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.