You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
**Message**: ``Unnecessary parentheses in queries``
9
+
10
+
**Problematic query**:
11
+
12
+
.. code-block:: text
13
+
14
+
("digital health" OR "eHealth") OR ("remote monitoring" OR "telehealth")
15
+
16
+
**Recommended query**:
17
+
18
+
.. code-block:: text
19
+
20
+
"digital health" OR "eHealth" OR "remote monitoring" OR "telehealth
21
+
22
+
**Explanation**: Parentheses are unnecessary when all operators used are **associative and have equal precedence** (like a series of ORs or a series of ANDs). In such cases, the grouping does not influence the evaluation result and adds unnecessary complexity.
Copy file name to clipboardExpand all lines: search_query/constants.py
+65Lines changed: 65 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -706,6 +706,71 @@ class QueryErrorCode(Enum):
706
706
""",
707
707
)
708
708
709
+
UNNECESSARY_PARENTHESES= (
710
+
"QUALITY_0004",
711
+
"unnecessary-parentheses",
712
+
"Unnecessary parentheses in queries",
713
+
"""
714
+
715
+
**Problematic query**:
716
+
717
+
.. code-block:: text
718
+
719
+
("digital health" OR "eHealth") OR ("remote monitoring" OR "telehealth")
720
+
721
+
**Recommended query**:
722
+
723
+
.. code-block:: text
724
+
725
+
"digital health" OR "eHealth" OR "remote monitoring" OR "telehealth
726
+
727
+
**Explanation**: Parentheses are unnecessary when all operators used are **associative and have equal precedence** (like a series of ORs or a series of ANDs). In such cases, the grouping does not influence the evaluation result and adds unnecessary complexity.""",
728
+
)
729
+
730
+
REDUNDANT_TERM= (
731
+
"QUALITY_0005",
732
+
"redundant-term",
733
+
"Redundant term in the query",
734
+
"""
735
+
**Problematic query (AND)**:
736
+
737
+
.. code-block:: text
738
+
739
+
"digital health" AND "health"
740
+
741
+
**Recommended query (AND)**:
742
+
743
+
.. code-block:: text
744
+
745
+
"digital health"
746
+
747
+
.. note::
748
+
749
+
The term "digital health" is more specific than "health".
750
+
The AND query will not retrieve results that match "health" but not "digital health".
751
+
Therefore, the more specific term ("digital health") is sufficient.
752
+
753
+
**Problematic query (OR)**:
754
+
755
+
.. code-block:: text
756
+
757
+
"digital health" OR "health"
758
+
759
+
**Recommended query (OR)**:
760
+
761
+
.. code-block:: text
762
+
763
+
"health"
764
+
765
+
.. note::
766
+
767
+
The term "health" is broader than "digital health".
768
+
In the OR query, all results that match "digital health" will also match "health".
769
+
Therefore, the broader term ("health") is sufficient.
770
+
771
+
**Typical fix**: Remove redundant terms that do not add value to the query.""",
0 commit comments