On 08/01/2016 11:38 AM, ?????? wrote:
thanks.
for example:
SQL statement: select * from vms where (name = 'myvm1' or
comment='myvm') and status = up
using SDK, created for by 'search':
List<Vm> vms = vmsService.list().search("(name=myvm1 or
comment=myvm) and status=up").send().vms();
The above is wrong,how to do?
Just remove brackets:
List<Vm> vms = vmsService.list().search("name=myvm1 or comment=myvm
and status=up").send().vms();
It's not needed in this case.
------------------ ???????? ------------------
*??????:* "Ondra Machacek";<omach...@redhat.com>;
*????????:* 2016??8??1??(??????) ????5:31
*??????:* "??????"<313922...@qq.com>;
*????:* Re: ?????? ?????? [ovirt-users] ovirt-engine-java-sdk-4.0: How
fuzzy query
On 08/01/2016 11:22 AM, ?????? wrote:
thanks.
The above is wrong.
if i want to use "like",how to do?
You can use star, so for example this:
Vm vm = vmsService.list().search("name=myvm*").send().vms().get(0);
Will find for you myvm1,myvm2, etc
------------------ ???????? ------------------
*??????:* "Ondra Machacek";<omach...@redhat.com>;
*????????:* 2016??8??1??(??????) ????5:18
*??????:* "??????"<313922...@qq.com>;
*????:* "users@ovirt.org"<users@ovirt.org>;
*????:* Re: ?????? [ovirt-users] ovirt-engine-java-sdk-4.0: How fuzzy
query
On 08/01/2016 11:06 AM, ?????? wrote:
thanks.
for example:
List<Vm> vms =
systemService.vmsService().list().search("search=name=myvm and
status=up").send().vms();
but I use query conditions "and" ??have no result.why?
Oh, sorry I meant you have to use 'search=' in case of using API,
so URL looks like: fqdn/ovirt-engine/api/vms?search=name=myvm and
status=down
But in case of using SDK, the 'search=' is created for you by 'search'
method, so
this should actually work for you:
Vm vm = systemService().vmsService.list().search("name=myvm and
status=up").send().vms().get(0);
------------------ ???????? ------------------
*??????:* "Ondra Machacek";<omach...@redhat.com>;
*????????:* 2016??8??1??(??????) ????4:37
*??????:* "??????"<313922...@qq.com>; "users"<users@ovirt.org>;
*????:* Re: [ovirt-users] ovirt-engine-java-sdk-4.0: How fuzzy query
On 08/01/2016 07:13 AM, ?????? wrote:
The above code is wrong,how fuzzy query?
_______________________________________________
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users
You need to prefix with 'search=',
So for example to search by name or status, you should have something
like:
....list().search("search=name=myvm or status=up").send()....
You can check examples here:
https://github.com/oVirt/ovirt-engine-sdk-java/tree/master/sdk/src/test/java/org/ovirt/engine/sdk4/examples
_______________________________________________
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users