When things doesn't work as they should.
-
simeon
- Posts: 4
- Joined: Thu Jan 31, 2019 10:54 am
Post
by simeon » Tue Feb 12, 2019 3:14 pm
Hi,
I'm trying to do a search through the API where all terms must be matched, the same as when 'Match all' is checked using the Mayan frontend search page. It doesn't seem to work, it looks like the terms are always OR'd.
These two API calls return the same thing but the document with
metadata_type__name=test is not in the cabinet
Examples.
Code: Select all
/api/search/documents.Document/?_match_all=on&cabinets__label=Examples&metadata__metadata_type__name=test
Code: Select all
/api/search/documents.Document/?_match_all=on&cabinets__label=Examples
I'm wondering how the frontend manages this?
[edit: fixed my typos]
-
rosarior
- Posts: 181
- Joined: Tue Aug 21, 2018 3:28 am
Post
by rosarior » Tue Feb 12, 2019 8:28 pm
Hi,
The _match_all query item is implemented in the HTML view but not in the API. The reason it that it was added as an initial attempt at the feature.
We are currently rebuilding the API system from the ground up and this is one of the tickets in the list. We want to improve the initial implementation of field inclusions for search but want to do it in a more generalized way. The current code supports field groupings using scopes. We need now to expose this in a general way on the API, that's the part we are still designing. Here is an example of the current search code and the search description code enabled for debugging.
-
Attachments
-

- Screenshot from 2019-02-12 16-25-34.png (17.01 KiB) Viewed 32 times
-
simeon
- Posts: 4
- Joined: Thu Jan 31, 2019 10:54 am
Post
by simeon » Wed Feb 13, 2019 9:11 am
Ah I see, thanks for the reply. It will certainly be very useful to do this via the API. For the moment I will have to do some client side filtering of the API results.
Sim
-
simeon
- Posts: 4
- Joined: Thu Jan 31, 2019 10:54 am
Post
by simeon » Thu Feb 14, 2019 11:33 am
I should have been using the API /search/advanced/ which does actually honour the _match_all parameter.
I then discovered a bug in the get_serializer method, I have a patch for that.