<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">&lt;<a href="mailto:omachace@redhat.com" target="_blank">omachace@redhat.com</a>&gt;</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&lt;Vm&gt; vms = vmsService.list().search(&quot;name=myvm1 or comment=myvm and<br>
status=up&quot;).send().vms();<br>
SQL statement: select * from vms where name = &#39;myvm1&#39; or comment=&#39;myvm&#39;<br>
and  status = up<br>
<br>
List&lt;Vm&gt; vms = vmsService.list().search(&quot;(name=myvm1 or comment=myvm)<br>
and status=up&quot;).send().vms();<br>
SQL statement: select * from vms where (name = &#39;myvm1&#39;<br>
or comment=&#39;myvm&#39;) and  status = up<br>
<br>
Query result are different.<br>
I want the SQL statement: select * from vms where (name = &#39;myvm1&#39;<br>
or comment=&#39;myvm&#39;) 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&#39;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>
*发件人:* &quot;Ondra Machacek&quot;;&lt;<a href="mailto:omachace@redhat.com" target="_blank">omachace@redhat.com</a>&gt;;<br>
*发送时间:* 2016年8月1日(星期一) 晚上6:18<br>
*收件人:* &quot;转圈圈&quot;&lt;<a href="mailto:313922611@qq.com" target="_blank">313922611@qq.com</a>&gt;;<br>
*抄送:* &quot;<a href="mailto:users@ovirt.org" target="_blank">users@ovirt.org</a>&quot;&lt;<a href="mailto:users@ovirt.org" target="_blank">users@ovirt.org</a>&gt;;<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 = &#39;myvm1&#39; or<br>
comment=&#39;myvm&#39;) and  status = up<br>
   using SDK, created for by &#39;search&#39;:<br>
        List&lt;Vm&gt; vms = vmsService.list().search(&quot;(name=myvm1 or<br>
comment=myvm) and status=up&quot;).send().vms();<br>
   The above is wrong,how to do?<br>
</blockquote>
<br>
Just remove brackets:<br>
<br>
   List&lt;Vm&gt; vms = vmsService.list().search(&quot;name=myvm1 or comment=myvm<br>
and status=up&quot;).send().vms();<br>
<br>
It&#39;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>
*发件人:* &quot;Ondra Machacek&quot;;&lt;<a href="mailto:omachace@redhat.com" target="_blank">omachace@redhat.com</a>&gt;;<br>
*发送时间:* 2016年8月1日(星期一) 下午5:31<br>
*收件人:* &quot;转圈圈&quot;&lt;<a href="mailto:313922611@qq.com" target="_blank">313922611@qq.com</a>&gt;;<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 &quot;like&quot;,how to do?<br>
</blockquote>
<br>
You can use star, so for example this:<br>
<br>
   Vm vm = vmsService.list().search(&quot;name=myvm*&quot;).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>
*发件人:* &quot;Ondra Machacek&quot;;&lt;<a href="mailto:omachace@redhat.com" target="_blank">omachace@redhat.com</a>&gt;;<br>
*发送时间:* 2016年8月1日(星期一) 下午5:18<br>
*收件人:* &quot;转圈圈&quot;&lt;<a href="mailto:313922611@qq.com" target="_blank">313922611@qq.com</a>&gt;;<br>
*抄送:* &quot;<a href="mailto:users@ovirt.org" target="_blank">users@ovirt.org</a>&quot;&lt;<a href="mailto:users@ovirt.org" target="_blank">users@ovirt.org</a>&gt;;<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&lt;Vm&gt; vms =<br>
systemService.vmsService().list().search(&quot;search=name=myvm and<br>
status=up&quot;).send().vms();<br>
but I use query conditions &quot;and&quot; ,have no result.why?<br>
</blockquote>
<br>
Oh, sorry I meant you have to use &#39;search=&#39; 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 &#39;search=&#39; is created for you by &#39;search&#39;<br>
method, so<br>
this should actually work for you:<br>
<br>
   Vm vm = systemService().vmsService.list().search(&quot;name=myvm and<br>
status=up&quot;).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>
*发件人:* &quot;Ondra Machacek&quot;;&lt;<a href="mailto:omachace@redhat.com" target="_blank">omachace@redhat.com</a>&gt;;<br>
*发送时间:* 2016年8月1日(星期一) 下午4:37<br>
*收件人:* &quot;转圈圈&quot;&lt;<a href="mailto:313922611@qq.com" target="_blank">313922611@qq.com</a>&gt;; &quot;users&quot;&lt;<a href="mailto:users@ovirt.org" target="_blank">users@ovirt.org</a>&gt;;<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 &#39;search=&#39;,<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(&quot;search=name=myvm or status=up&quot;).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>