Skip to content

Commit 251ea69

Browse files
committed
Document exact match; Transitive search
Document other string matching modes using := (exact case-sensitive including spaces), ~= substring case-insensitive match. issue?messages.author=1 will find issues where one or more messages was authored by admin.
1 parent bd097c7 commit 251ea69

File tree

1 file changed

+44
-12
lines changed

1 file changed

+44
-12
lines changed

doc/rest.txt

Lines changed: 44 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -334,24 +334,56 @@ only does an exact match.
334334

335335
Searching for strings (e.g. the issue title, or a keyword name)
336336
performs a case-insensitive substring search, so searching for
337-
title=Something will find all issues with "Something" or "someThing",
338-
etc. in the title. There is currently no way to perform an exact
339-
string match.
337+
``title=Something`` (or in long form title~=Something) will find all
338+
issues with "Something" or "someThing", etc. in the title. Changing
339+
the search to ``title:=Something`` (note the `:`) an exact
340+
case-sensitive string match for exactly one word ``Something`` with a
341+
capital ``S``. Another example is:
342+
``title:=test+that+nosy+actually+works.`` where the + signs are spaces
343+
in the string. Replacing `+` with the `URL encoding`_ for space
344+
``%20`` will also work. Note that you must match the spaces when
345+
performing exact matches. So `title:=test++that+nosy+actually+works.``
346+
matches the word test with two spaces after ``test`` in the title.
340347

341348
To make this clear, searching
342-
``https://.../rest/data/issue?keyword=foo`` will not work unless there
343-
is a keyword with a name field of ``foo`` which is the key field of
344-
the keyword. However searching the text property ``name`` using
345-
``https://.../rest/data/keyword?name=foo`` (note searching keyword
346-
class not issue class) will return matches for ``foo``, ``foobar``,
347-
``foo taz`` etc.
349+
``https://.../rest/data/issue?keyword=Foo`` will not work unless there
350+
is a keyword with a (case sensitive) name field of ``Foo`` which is
351+
the key field of the keyword. However searching the text property
352+
``name`` using ``https://.../rest/data/keyword?name=Foo`` (note
353+
searching keyword class not issue class) will return matches for
354+
``Foo``, ``foobar``, ``foo taz`` etc.
348355

349356
In all cases the field ``@total_size`` is reported which is the total
350357
number of items available if you were to retrieve all of them.
351358

352359
Other data types: Date, Interval Integer, Number need examples and may
353360
need work to allow range searches. Full text search (e.g. over the
354-
body of msgs) is a work in progress.
361+
body of a msg) is a work in progress.
362+
363+
.. _URL Encoding: https://en.wikipedia.org/wiki/Percent-encoding
364+
365+
Transitive Searching
366+
~~~~~~~~~~~~~~~~~~~~
367+
368+
In addition to searching an issue by its properties, you can search
369+
for issues where linked items have a certain property. For example
370+
using ``/issues?messages.author=1`` will find all issues that include
371+
(link to) a message created by the admin user. This can also be done
372+
using: ``/issues?messages.author=admin``. Note that this requires
373+
search permission for messages.author, user.id, and users.username (to
374+
perform search with ``admin``. If these search permissions are not
375+
present, the search will silently drop the attribute.
376+
377+
Similarly you can find all issues where the nosy list includes James
378+
Bond with: ``issue?nosy.realname=james+bond``. The alternate way to
379+
perform this is to query the user class for the realname:
380+
``user?realname=james+bond`` and retrieve the id. Then you can execute
381+
a second rest call ``issue?nosy=7`` to retrieve issues with id 7.
382+
383+
Make sure that search access to the class/properties are granted to the
384+
user. Note that users can search a field even if they can't view
385+
it. However they may be able to use searches to discover the value of
386+
the field even if they can't view it.
355387

356388
Sorting
357389
^^^^^^^
@@ -1427,7 +1459,7 @@ There are 5 steps to set this up:
14271459
timelog links to the ``times`` property of the issue.
14281460

14291461
Create role
1430-
"""""""""""
1462+
~~~~~~~~~~~
14311463

14321464
Adding this snippet of code to the tracker's ``schema.py`` should create a role with the
14331465
proper authorization::
@@ -1473,7 +1505,7 @@ value of the ``times`` value so your code can verify that it worked.
14731505
This does potentially leak info about the previous id's in the field.
14741506

14751507
Create rest endpoints
1476-
"""""""""""""""""""""
1508+
~~~~~~~~~~~~~~~~~~~~~
14771509

14781510
Here is code to add to your tracker's ``interfaces.py`` (note code has
14791511
only been tested with python3)::

0 commit comments

Comments
 (0)