Bug 1008719 - RFE: Allow for more targetted string searching via REST API.
Summary: RFE: Allow for more targetted string searching via REST API.
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: PressGang CCMS
Classification: Community
Component: REST-API
Version: 1.1
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
: 1.2
Assignee: Lee Newson
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-09-16 22:59 UTC by Matthew Casperson
Modified: 2014-08-04 22:27 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2013-10-17 23:49:43 UTC


Attachments (Terms of Use)

Description Matthew Casperson 2013-09-16 22:59:43 UTC
Running queries to match text current lowers the database field and then matches against a like query i.e.

select name from tag where lower(name) like '%something%';

This style of query effectively means indexes can not be used, and is resulting in a lot of entries in the slow query table.

We should look to extend the query endpoint to allow for queries like  

select name from tag where name = 'something';

where appropriate.

Comment 1 Lee Newson 2013-09-19 01:08:11 UTC
Added in 1.2-SNAPSHOT build 20130919-1021.

As discussed you can now append "-matches" to any String parameter, to change the query logic to "equals" instead of "like". (You can also append "-contains" but since it's the default value it will have no effect.)

eg.

/rest/1/tags/get/json/query;tagName-matches=Task?expand=%7B%22branches%22%3A%5B%7B%22trunk%22%3A%7B%22name%22%3A%20%22tags%22%7D%7D%5D%7D

Comment 2 Lee Newson 2013-09-19 01:09:34 UTC
Note: This version is currently live on the dev/test server.

The next step is to modify any other components to use this new logic, instead of the old contains/like logic.

Comment 3 Matthew Casperson 2013-10-15 03:59:51 UTC
Confirmed that the tag name match with 'tagName-matches' does not add an entry to the MySQL slow query log.


Note You need to log in before you can comment on or make changes to this bug.