Bug 1301383 - Search query returns wrong value for tag association
Summary: Search query returns wrong value for tag association
Alias: None
Product: ovirt-engine
Classification: oVirt
Component: Search-Backend
Version: 3.6.2
Hardware: Unspecified
OS: Unspecified
Target Milestone: ovirt-4.0.0-alpha
: 4.0.0
Assignee: Eli Mesika
QA Contact: Petr Kubica
: 1301385 (view as bug list)
Depends On:
TreeView+ depends on / blocked
Reported: 2016-01-24 17:23 UTC by Nelly Credi
Modified: 2016-07-05 07:39 UTC (History)
5 users (show)

Fixed In Version: ovirt 4.0.0 alpha1
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2016-07-05 07:39:28 UTC
oVirt Team: Infra
rule-engine: ovirt-4.0.0+
rule-engine: planning_ack+
rule-engine: devel_ack+
rule-engine: testing_ack+

Attachments (Terms of Use)

System ID Priority Status Summary Last Updated
oVirt gerrit 52797 None None None 2016-01-27 11:59:10 UTC

Description Nelly Credi 2016-01-24 17:23:38 UTC
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):

How reproducible:

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_*
5.delete tag_1
6.create tag_2
7.associate host with it
8.search - /api/hosts;max=-1;case_sensitive=true?search=tag=tag_*

Actual results:
empty host list
<hosts />

Expected results:
the associated host

Additional info:
* 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?

Comment 1 Gil Klein 2016-01-25 09:46:34 UTC
*** Bug 1301385 has been marked as a duplicate of this bug. ***

Comment 2 Juan Hernández 2016-01-25 12:11:36 UTC
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.

Comment 3 Petr Kubica 2016-06-14 12:49:05 UTC
Verified in 4.1.0-0.0.master.20160613231338.git6e72c0b.el7.centos

Comment 4 Sandro Bonazzola 2016-07-05 07:39:28 UTC
oVirt 4.0.0 has been released, closing current release.

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