apache / apache/lucene

Search Results Filtering Based on Bitwise Operations on Integer Fields [LUCENE-2460]

Open
#3,534 6 comments 1 reaction 0 assignees View on GitHub
legacy-jira-fix-version:4.9 legacy-jira-fix-version:6.0 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

This package makes it possible to filter results returned from a query based on the results of a bitwise operation on an integer field in the documents returned from the pre-constructed query.

You can perform three basic types of operations on these integer fields

- BitwiseOperation.BITWISE_AND (bitwise AND)
- BitwiseOperation.BITWISE_OR (bitwise inclusive OR)
- BitwiseOperation.BITWISE_XOR (bitwise exclusive OR)

You can also negate the results of these operations.

For example, imagine there is an integer field in the index named "flags" with the a value 8 (1000 in binary). The following results will be expected :

1. A source value of 8 will match during a BitwiseOperation.BITWISE_AND operation, with negate set to false.
2. A source value of 4 will match during a BitwiseOperation.BITWISE_AND operation, with negate set to true.

The BitwiseFilter constructor accepts the following values

- The name of the integer field (A string)
- The BitwiseOperation object. Example BitwiseOperation.BITWISE_XOR
- The source value (an integer)
- A boolean value indicating whether or not to negate the results of the operation
- A pre-constructed org.apache.lucene.search.Query

---
Migrated from [LUCENE-2460](https://issues.apache.org/jira/browse/LUCENE-2460) by Israel Ekpo, 3 votes, updated May 09 2016
Attachments: [LUCENE-2460-bitwise.tar.gz](https://apache.github.io/lucene-jira-archive/attachments/LUCENE-2460/LUCENE-2460-bitwise.tar.gz)

Contributor guide

Open the contributing guide

Research direction

Start by inspecting the attached LUCENE-2460-bitwise.tar.gz and the existing org.apache.lucene.search.Query API referenced in the issue. Determine where a BitwiseFilter would belong and how its constructor inputs map to the three operations and negation; done means the documented examples work against a pre-constructed query.

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.