apache / apache/lucene

QueryNode implementors should override equals method [LUCENE-2457]

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

Discussed on thread: http://markmail.org/thread/gjqk35t7e3y4fo5j

"QueryNode(s) are data objects, and it makes sense to override
their equals method. But before, we need to define what is a QueryNode
equality. Should two nodes be considered equal if they represent
syntactically or semantically the same query? e.g. an ORQueryNode created
from the query <a OR b OR c> will not have the same children ordering as the
query <b OR c OR a>, so they are syntactically not equal, but they are
semantically equal, because the order of the OR operands (usually) does not
matter when the query is executed. I say it usually does not matter, because
it's up to the Query object implementation built from that ORQueryNode
object, for this reason, I vote for defining that two query nodes should be
equals if they are syntactically equal.

I also vote for excluding query node tags from the equality check, because
they are not meant to represent the query structure, but to attach extra
info to the node, which is usually used for communication between
processors."

---
Migrated from [LUCENE-2457](https://issues.apache.org/jira/browse/LUCENE-2457) by Adriano Crestani, 2 votes, updated May 09 2016

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.