reportportal / service-api

Report portal. Main API Service

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

/api/v1/widget/shared/search?term returns the first result which contains the term instead of matching it exactly

rujutashinde opened this issue · comments

If we use the api /api/v1/widget/shared/search?term= to search for a widget with name "launch1 Launches Table"
it returns results which contain the word launch1 Launches Table instead of matching the exact string

This way if there is launch1 Launches Table and hello_launch1 Launches table, it returns the entry which was created first, so hello_lauch1 Launches Table is returned

e.g

url: https://<RP INSTANCE URL>/api/v1/<project_name>/widget/shared/search?term=launch1 Launches Table
 r.status_code: 200
 r.text: {"content":[{"description":"RP PreProc Auto widget","owner":"teflo_user","share":true,"id":360,"name":"teflo_launch1 Launches Table","widgetType":"launchesTable","contentParameters":{"contentFields":[],"itemsCount":10}}],"page":{"number":1,"size":20,"totalElements":1,"totalPages":1}}

Current version:API Service: 5.6.3
Authorization Service: 5.6.3
Service UI: 5.6.0

Could it be because it is looking for find any instead of exact string?

return Arrays.stream(DataProviderType.values()).filter(type -> type.getType().equalsIgnoreCase(name)).findAny();