<div dir="ltr"><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">Adding Eli ...<br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Aug 1, 2016 at 12:35 PM, Ondra Machacek <span dir="ltr"><<a href="mailto:omachace@redhat.com" target="_blank">omachace@redhat.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On 08/01/2016 12:26 PM, 转圈圈 wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
This is a different meaning.<br>
<br>
List<Vm> vms = vmsService.list().search("name=myvm1 or comment=myvm and<br>
status=up").send().vms();<br>
SQL statement: select * from vms where name = 'myvm1' or comment='myvm'<br>
and status = up<br>
<br>
List<Vm> vms = vmsService.list().search("(name=myvm1 or comment=myvm)<br>
and status=up").send().vms();<br>
SQL statement: select * from vms where (name = 'myvm1'<br>
or comment='myvm') and status = up<br>
<br>
Query result are different.<br>
I want the SQL statement: select * from vms where (name = 'myvm1'<br>
or comment='myvm') and status = up<br>
</blockquote>
<br>
oVirt search pattern is not 100% mapped to SQL query,<br>
so as I said, your query should work for you as expected without braces.<br>
<br>
Eli, can elaborate more for you, what's supported or not in oVirt search patterns, if needed.<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
<br>
------------------ 原始邮件 ------------------<br>
*发件人:* "Ondra Machacek";<<a href="mailto:omachace@redhat.com" target="_blank">omachace@redhat.com</a>>;<br>
*发送时间:* 2016年8月1日(星期一) 晚上6:18<br>
*收件人:* "转圈圈"<<a href="mailto:313922611@qq.com" target="_blank">313922611@qq.com</a>>;<br>
*抄送:* "<a href="mailto:users@ovirt.org" target="_blank">users@ovirt.org</a>"<<a href="mailto:users@ovirt.org" target="_blank">users@ovirt.org</a>>;<br>
*主题:* Re: 回复: 回复: 回复: [ovirt-users]<br>
ovirt-engine-java-sdk-4.0: How fuzzy query<br>
<br>
On 08/01/2016 11:38 AM, 转圈圈 wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
thanks.<br>
for example:<br>
SQL statement: select * from vms where (name = 'myvm1' or<br>
comment='myvm') and status = up<br>
using SDK, created for by 'search':<br>
List<Vm> vms = vmsService.list().search("(name=myvm1 or<br>
comment=myvm) and status=up").send().vms();<br>
The above is wrong,how to do?<br>
</blockquote>
<br>
Just remove brackets:<br>
<br>
List<Vm> vms = vmsService.list().search("name=myvm1 or comment=myvm<br>
and status=up").send().vms();<br>
<br>
It's not needed in this case.<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
<br>
<br>
------------------ 原始邮件 ------------------<br>
*发件人:* "Ondra Machacek";<<a href="mailto:omachace@redhat.com" target="_blank">omachace@redhat.com</a>>;<br>
*发送时间:* 2016年8月1日(星期一) 下午5:31<br>
*收件人:* "转圈圈"<<a href="mailto:313922611@qq.com" target="_blank">313922611@qq.com</a>>;<br>
*主题:* Re: 回复: 回复: [ovirt-users] ovirt-engine-java-sdk-4.0: How<br>
fuzzy query<br>
<br>
On 08/01/2016 11:22 AM, 转圈圈 wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
thanks.<br>
The above is wrong.<br>
if i want to use "like",how to do?<br>
</blockquote>
<br>
You can use star, so for example this:<br>
<br>
Vm vm = vmsService.list().search("name=myvm*").send().vms().get(0);<br>
<br>
Will find for you myvm1,myvm2, etc<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
<br>
------------------ 原始邮件 ------------------<br>
*发件人:* "Ondra Machacek";<<a href="mailto:omachace@redhat.com" target="_blank">omachace@redhat.com</a>>;<br>
*发送时间:* 2016年8月1日(星期一) 下午5:18<br>
*收件人:* "转圈圈"<<a href="mailto:313922611@qq.com" target="_blank">313922611@qq.com</a>>;<br>
*抄送:* "<a href="mailto:users@ovirt.org" target="_blank">users@ovirt.org</a>"<<a href="mailto:users@ovirt.org" target="_blank">users@ovirt.org</a>>;<br>
*主题:* Re: 回复: [ovirt-users] ovirt-engine-java-sdk-4.0: How fuzzy<br>
</blockquote>
query<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
On 08/01/2016 11:06 AM, 转圈圈 wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
thanks.<br>
for example:<br>
List<Vm> vms =<br>
systemService.vmsService().list().search("search=name=myvm and<br>
status=up").send().vms();<br>
but I use query conditions "and" ,have no result.why?<br>
</blockquote>
<br>
Oh, sorry I meant you have to use 'search=' in case of using API,<br>
so URL looks like: fqdn/ovirt-engine/api/vms?search=name=myvm and<br>
status=down<br>
<br>
But in case of using SDK, the 'search=' is created for you by 'search'<br>
method, so<br>
this should actually work for you:<br>
<br>
Vm vm = systemService().vmsService.list().search("name=myvm and<br>
status=up").send().vms().get(0);<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
<br>
<br>
------------------ 原始邮件 ------------------<br>
*发件人:* "Ondra Machacek";<<a href="mailto:omachace@redhat.com" target="_blank">omachace@redhat.com</a>>;<br>
*发送时间:* 2016年8月1日(星期一) 下午4:37<br>
*收件人:* "转圈圈"<<a href="mailto:313922611@qq.com" target="_blank">313922611@qq.com</a>>; "users"<<a href="mailto:users@ovirt.org" target="_blank">users@ovirt.org</a>>;<br>
*主题:* Re: [ovirt-users] ovirt-engine-java-sdk-4.0: How fuzzy query<br>
<br>
On 08/01/2016 07:13 AM, 转圈圈 wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
The above code is wrong,how fuzzy query?<br>
<br>
<br>
<br>
_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@ovirt.org" target="_blank">Users@ovirt.org</a><br>
<a href="http://lists.ovirt.org/mailman/listinfo/users" rel="noreferrer" target="_blank">http://lists.ovirt.org/mailman/listinfo/users</a><br>
<br>
</blockquote>
<br>
You need to prefix with 'search=',<br>
So for example to search by name or status, you should have something<br>
</blockquote>
like:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
....list().search("search=name=myvm or status=up").send()....<br>
<br>
You can check examples here:<br>
<br>
<br>
<br>
</blockquote>
<br>
</blockquote>
<br>
</blockquote>
<a href="https://github.com/oVirt/ovirt-engine-sdk-java/tree/master/sdk/src/test/java/org/ovirt/engine/sdk4/examples" rel="noreferrer" target="_blank">https://github.com/oVirt/ovirt-engine-sdk-java/tree/master/sdk/src/test/java/org/ovirt/engine/sdk4/examples</a><br>
</blockquote>
_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@ovirt.org" target="_blank">Users@ovirt.org</a><br>
<a href="http://lists.ovirt.org/mailman/listinfo/users" rel="noreferrer" target="_blank">http://lists.ovirt.org/mailman/listinfo/users</a><br>
</blockquote></div><br></div>