Bug 736002

Summary: Bug.search creation_time parameter not honored
Product: [Community] Bugzilla Reporter: Ondrej Skutka <oskutka>
Component: WebServiceAssignee: Simon Green <sgreen>
Status: CLOSED WORKSFORME QA Contact:
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 3.6CC: atodorov, ebaak, sgreen
Target Milestone: ---Keywords: Reopened
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-02-26 21:38:10 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---
Attachments:
Description Flags
Run with "mvn test" none

Description Ondrej Skutka 2011-09-06 11:47:53 UTC
Created attachment 521641 [details]
Run with "mvn test"

Description of problem:
When querying bugzilla using Bug.search, the creation_time parameter is not taken into consideration. It's not in the database query and neither it is reflected in the bugs found.

Version-Release number of selected component (if applicable):


How reproducible:
See attached example

Steps to Reproduce:
1. tar -xvzf creation-time-bug-reproducer.tar.gz
2. cd creation-time-bug-reproducer
3. mvn test
  
Actual results:
Finds ~8 bugs.

Expected results:
Should not found any bug since the creation_time parameter is set to the future. (it doesn't work with past time either)

Additional info:
creation_time parameter is described in 
http://www.bugzilla.org/docs/3.6/en/html/api/Bugzilla/WebService/Bug.html#search

Comment 1 Simon Green 2011-09-19 03:13:32 UTC
(In reply to comment #0)
> Expected results:
> Should not found any bug since the creation_time parameter is set to the
> future. (it doesn't work with past time either)

The correct field for Bug.search is creation_ts

From Bugzilla/WebService/Bug.pm:
 442     if (my $when = delete $params->{creation_ts}) {
 443         $params->{WHERE}->{'creation_ts >= ?'} = $when;
 444     }

  -- simon

Comment 2 Ondrej Skutka 2011-09-19 09:07:56 UTC
a) creation_ts doesn't seem to work in the way you describe. Change the creation_time to creation_ts in the attached source and you will find that it never finds any bug. Actually the sql used contains something like "(( bugs.creation_ts IN ('2010-11-18T09:13:00-0500') )" which really cannot be used as a bug search parameter (missing the "or later").

b) update the documentation accordingly.

Comment 3 Ondrej Skutka 2011-11-30 11:24:49 UTC
Hello Simon.

Is there an update on this issue? Or at least a workaround?

Thanks,
Ondra

Comment 4 Alexander Todorov 2012-02-16 12:47:12 UTC
just for the record:

I found this to be working by looking at the parameters passed in the URL when doing the query via FF:

qd = {
    'reporter' : 'atodorov@redhat.com',
    'chfieldfrom' : '2012-02-01',
    'chfieldto' : '2012-02-29',
    'chfield' : '[Bug creation]',
}


Those fields don't appear in getbugfields() method. Why is that?

Comment 5 Simon Green 2012-02-16 12:53:44 UTC
(In reply to comment #4)
> Those fields don't appear in getbugfields() method. Why is that?

They are not fields for a bug, but for the search query.

Comment 6 Ondrej Skutka 2012-02-21 14:34:29 UTC
But the creation_time parameter parameter is a field for the search query. I'm reopening the bug. This hasn't been solved yet.

Comment 7 Simon Green 2012-02-26 21:38:10 UTC
The perl XMLRPC call works as expected:

$call = $rpc->call(
    'Bug.search_new',
    {   
        creation_time => '2012-02-20 00:00:00',
        include_fields => ['id', 'creation_time']
    }   
);

(reporting all bugs opened since 2012-02-20 in your preferred time zone).

(In reply to comment #0)
> creation_time parameter is described in 
> http://www.bugzilla.org/docs/3.6/en/html/api/Bugzilla/WebService/Bug.html#search

Our XMLRPC calls differ from upstream. Their Bug.search call is Bug.search_new in Red Hat Bugzilla. This will be changed when we migrate to Bugzilla 4.2 (where we will take upstream changes with minimal modification)

(In reply to comment #6)
> But the creation_time parameter parameter is a field for the search query. I'm
> reopening the bug. This hasn't been solved yet.

As shown in the above example, this works if you use the Bug.search_new RPC call.

Unfortunately, the Red Hat Bugzilla team don't have the resources to help debug
your specific code. Feel free to reopen if you believe that there is a bug
within Red Hat Bugzilla itself.

  -- simon

Comment 8 Ondrej Skutka 2012-02-27 08:25:42 UTC
Thanks for the explanation. This seems to work correctly.

I must have missed some part of the documentation. Could you point me to a page where the search => search_new is documented?

Comment 9 Simon Green 2012-02-27 13:31:56 UTC
(In reply to comment #8)
> I must have missed some part of the documentation. Could you point me to a page
> where the search => search_new is documented?

https://bugzilla.redhat.com/docs/en/html/api/Bugzilla/WebService/Bug.html#Bug_Information