Skip to content

Commit 2b15331

Browse files
author
Gerit Wagner
committed
update docs
1 parent 86450e1 commit 2b15331

File tree

11 files changed

+77
-39
lines changed

11 files changed

+77
-39
lines changed

docs/source/cli.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,23 @@ To translate a search query on the command line, run
1010

1111
.. code-block:: bash
1212
13-
search-query-translate --from colrev_web_of_science \
13+
search-query-translate --from wos \
1414
--input input_query.txt \
15-
--to colrev_pubmed \
15+
--to pubmed \
1616
--output output_query.txt
1717
1818
**Arguments**
1919

2020
- ``--from`` (required):
2121
The source query format.
22-
Example: ``colrev_web_of_science``
22+
Example: ``wos``
2323

2424
- ``--input`` (required):
2525
Path to the input file containing the original query.
2626

2727
- ``--to`` (required):
2828
The target query format.
29-
Example: ``colrev_pubmed``
29+
Example: ``pubmed``
3030

3131
- ``--output`` (required):
3232
Path to the file where the converted query will be written.
@@ -38,9 +38,9 @@ Suppose you have a Web of Science search query saved in ``input_query.txt`` and
3838

3939
.. code-block:: bash
4040
41-
search-query-translate --from colrev_web_of_science \
41+
search-query-translate --from wos \
4242
--input input_query.txt \
43-
--to colrev_pubmed \
43+
--to pubmed \
4444
--output output_query.txt
4545
4646
The converted query will be saved in ``output_query.txt``.

docs/source/dev_docs/_autosummary/search_query.constants.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,6 @@ search\_query.constants
2727
Operators
2828
PLATFORM
2929
QueryErrorCode
30+
SearchField
3031
Token
3132
TokenTypes

docs/source/dev_docs/_autosummary/search_query.query.rst

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,3 @@ search\_query.query
1818
.. autosummary::
1919

2020
Query
21-
SearchField
22-
Term
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
search\_query.query\_range
2+
==========================
3+
4+
.. automodule:: search_query.query_range
5+
6+
7+
8+
9+
10+
11+
12+
13+
14+
15+
16+
.. rubric:: Classes
17+
18+
.. autosummary::
19+
20+
RangeQuery
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
search\_query.query\_term
2+
=========================
3+
4+
.. automodule:: search_query.query_term
5+
6+
7+
8+
9+
10+
11+
12+
13+
14+
15+
16+
.. rubric:: Classes
17+
18+
.. autosummary::
19+
20+
Term

docs/source/dev_docs/_autosummary/search_query.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@
4444
search_query.query_near
4545
search_query.query_not
4646
search_query.query_or
47+
search_query.query_range
48+
search_query.query_term
4749
search_query.search_file
4850
search_query.serializer_base
4951
search_query.serializer_structured

docs/source/dev_docs/parser_development.rst

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,16 +77,13 @@ Implement ``parse_query_tree()`` to build the query object, creating nested quer
7777

7878
Parsers can be developed as top-down parsers (see PubMed) or bottom-up parsers (see Web of Science).
7979

80-
For NOT operators, it is recommended to parse them as an AND query with negated children, e.g., ``A NOR B`` should be parsed as:
80+
For NOT operators, it is recommended to parse them as a query with two children. The second child is the negated part (i.e., the operator is interpreted as ``AND NOT``). For example, ``A NOT B`` should be parsed as:
8181

8282
.. code-block:: python
8383
84-
AND[
85-
A,
86-
NOT[B]
87-
]
84+
NOT[A, B]
8885
89-
Check whether ``SearchFields`` can be created for nested queries (e.g., ``TI=(eHealth OR mHealth)``or only for individual terms, e.g., ``eHealth[ti] OR mHealth[ti]``.)
86+
Check whether ``SearchFields`` can be created for nested queries (e.g., ``TI=(eHealth OR mHealth)`` or only for individual terms, e.g., ``eHealth[ti] OR mHealth[ti]``.)
9087

9188
**Parser Skeleton**
9289

docs/source/dev_docs/tests.rst

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -104,22 +104,22 @@ Test Types
104104
105105
3. **Translation Tests**
106106
- Purpose: Confirm that parsing + serialization results in the expected generic or structured query string.
107-
- Example:
108-
109-
**TODO:**
110-
111-
::
112107

113-
@pytest.mark.parametrize(
114-
"query_string, expected_translation",
115-
[
116-
("TS=(eHealth) AND TS=(Review)", "AND[eHealth[TS=], Review[TS=]]"),
117-
],
118-
)
119-
def test_parser_translation(query_string, expected_translation):
120-
parser = XYParser(query_string)
121-
query_tree = parser.parse()
122-
assert query_tree.to_generic_string() == expected_translation
108+
Example:
109+
110+
.. code-block:: python
111+
112+
@pytest.mark.parametrize(
113+
"query_string, expected_translation",
114+
[
115+
("TS=(eHealth) AND TS=(Review)",
116+
"AND[eHealth[TS=], Review[TS=]]"),
117+
],
118+
)
119+
def test_parser_translation(query_string, expected_translation):
120+
parser = XYParser(query_string)
121+
query_tree = parser.parse()
122+
assert query_tree.to_generic_string() == expected_translation
123123
124124
125125
.. note::

docs/source/improve.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ Modification
4444
4545
4646
query = AndQuery([
47-
OrQuery(["labour", "employment"], search_field="ti"),
48-
OrQuery(["robot", "algorith"], search_field="ti")
49-
], search_field="ti")
47+
OrQuery(["labour", "employment"], search_field="title"),
48+
OrQuery(["robot", "algorith"], search_field="title")
49+
], search_field="title")
5050
5151
expand_spelling_variants(query)
5252
add_plural_wildcards(query)
@@ -82,9 +82,9 @@ See Cooper et al. 2018
8282
}
8383
8484
query = AndQuery([
85-
OrQuery(["microsourcing"], search_field="ti"),
86-
OrQuery(["online"], search_field="ti")
87-
], search_field="ti")
85+
OrQuery(["microsourcing"], search_field="title"),
86+
OrQuery(["online"], search_field="title")
87+
], search_field="title")
8888
8989
# Evaluate the search
9090
results = query.evaluate(records_dict)

docs/source/index.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ Creating a query programmatically is simple:
4747
from search_query import OrQuery, AndQuery
4848
4949
# Typical building-blocks approach
50-
digital_synonyms = OrQuery(["digital", "virtual", "online"], search_field="ab")
51-
work_synonyms = OrQuery(["work", "labor", "service"], search_field="ab")
50+
digital_synonyms = OrQuery(["digital", "virtual", "online"], search_field="abstract")
51+
work_synonyms = OrQuery(["work", "labor", "service"], search_field="abstract")
5252
query = AndQuery([digital_synonyms, work_synonyms])
5353
5454
..

0 commit comments

Comments
 (0)