Red Hat Bugzilla – Bug 1301383
Search query returns wrong value for tag association
Last modified: 2016-07-05 03:39:28 EDT
Description of problem:
If you have the same query, but expecting different result,
the query may return wrong value
My example is on tags, where there is a host associated with it, but the query returns empty host list, but it maybe for other queries as well
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1.create tag - tag_1
2.associate host with it
3.search - /api/hosts;max=-1;case_sensitive=true?search=tag=tag_*
7.associate host with it
8.search - /api/hosts;max=-1;case_sensitive=true?search=tag=tag_*
empty host list
the associated host
* If you query /api/hosts;max=-1;case_sensitive=true?search=tag=tag_2 it will return with correct search result
* it doesnt matter which API you use, you can start with rest & move to cli, but still the result will be the same - empty host list
* maybe there is some caching?
*** Bug 1301385 has been marked as a duplicate of this bug. ***
There is a cache in the "SearchQuery.queriesCache" static field that stores the SQL code generated from the search text. This data in this cache is cleared when it is one day old. In addition the "BaseConditionFieldAutoCompleter.formatValue" method translates the search text so that if it includes something like "tag=whatever" the "whatever" part is converted into set of identifiers of the tags that match it, before generating the SQL code. In you case it will be translated into the id of "tag_1". The resulting SQL is then stored in the cache, and will stay there for one day. So even if you remove "tag_1" the cached SQL statement will still contain the identifier of the removed "tag_1", thus producing zero results.
Verified in 4.1.0-0.0.master.20160613231338.git6e72c0b.el7.centos
oVirt 4.0.0 has been released, closing current release.