What about use D) and also give a way to user specify the default classes to all queries?<br><br><div class="gmail_quote">On Wed, Apr 27, 2011 at 5:10 AM, Emmanuel Bernard <span dir="ltr">&lt;<a href="mailto:emmanuel@hibernate.org">emmanuel@hibernate.org</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div class="im"><br>
On 27 avr. 2011, at 08:57, Sanne Grinovero wrote:<br>
<br>
&gt; 2011/4/27 Emmanuel Bernard &lt;<a href="mailto:emmanuel@hibernate.org">emmanuel@hibernate.org</a>&gt;:<br>
&gt;&gt; Users can put indexed or nit indexed superclasses in the query target type. That would not work for you as you can&#39;t discover known subtypes wo scanning or having a closure of types somewhere.<br>
&gt;<br>
&gt; sure they can with Hibernate Search. but should they be able with<br>
&gt; Infinispan Query?<br>
&gt; If the answer is yes, then we still need to find an alternative.<br>
<br>
</div>Well it&#39;s an OO query and thus subtype polymorphism should apply.<br>
<div><div></div><div class="h5"><br>
&gt;<br>
&gt;<br>
&gt;&gt; On 26 avr. 2011, at 23:32, Sanne Grinovero &lt;<a href="mailto:sanne.grinovero@gmail.com">sanne.grinovero@gmail.com</a>&gt; wrote:<br>
&gt;&gt;<br>
&gt;&gt;&gt; Hello,<br>
&gt;&gt;&gt; I&#39;m forking off this thread, as we never resolved how to cope with the<br>
&gt;&gt;&gt; main issue:<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; how is Infinispan Query going to be aware of which entities are to be<br>
&gt;&gt;&gt; considered as default targets for a Query?<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; the realistic ideas so far:<br>
&gt;&gt;&gt; A) class scanning: seems nobody liked this idea, but I&#39;ll still<br>
&gt;&gt;&gt; mention it as the other options aren&#39;t looking great either.<br>
&gt;&gt;&gt; B) scan known indexes (need to define what the &quot;known indexes&quot; are as<br>
&gt;&gt;&gt; we usually infer that from the classes)<br>
&gt;&gt;&gt;   -- could enforce a single index<br>
&gt;&gt;&gt; C) have to list all fully qualified class names in the configuration<br>
&gt;&gt;&gt; D) don&#39;t care: consider it a good practice to specify all targeted<br>
&gt;&gt;&gt; types when performing a Query.<br>
&gt;&gt;&gt; E) please suggest :)<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; The currently implemented solution is D, as it requires no coding at all :)<br>
&gt;&gt;&gt; considering the simplicity of it I&#39;m liking it more the more I think<br>
&gt;&gt;&gt; about it; I could even polish the approach by adding a single line to<br>
&gt;&gt;&gt; log a warning when the user doesn&#39;t respect the best practice, or to<br>
&gt;&gt;&gt; mandate it.<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; Considering that when a Query is invoked specifying the target types<br>
&gt;&gt;&gt; there is no doubt we know the classes, I could add a warning in case<br>
&gt;&gt;&gt; the Query is performed without specifying the type: in that case it<br>
&gt;&gt;&gt; usually implies the query targets all known types, which is always<br>
&gt;&gt;&gt; fine when using Hibernate Search, but could be inconsistent with<br>
&gt;&gt;&gt; Infinispan Query as it might not have discovered all types yet (1), so<br>
&gt;&gt;&gt; a very simple solution is to mandate the type parameter.<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; [1] - when the Cache interceptor hits an event adding a new type, the<br>
&gt;&gt;&gt; Search engine is reconfigured.<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; thoughts?<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; Sanne<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; 2011/4/5 Emmanuel Bernard &lt;<a href="mailto:emmanuel@hibernate.org">emmanuel@hibernate.org</a>&gt;:<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; On 5 avr. 2011, at 13:38, Sanne Grinovero wrote:<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt; 2011/4/5 Emmanuel Bernard &lt;<a href="mailto:emmanuel@hibernate.org">emmanuel@hibernate.org</a>&gt;:<br>
&gt;&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;&gt; On 5 avr. 2011, at 12:20, Galder Zamarreño wrote:<br>
&gt;&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt; On Apr 4, 2011, at 6:23 PM, Sanne Grinovero wrote:<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt; &lt;/snip&gt;<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt; there&#39;s one catch:<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt; when searching for a class type, it will only include results from<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt; known subtypes. The targeted type is automatically added to the known<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt; classes, but eventually existing subtypes are not discovered.<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt; Bringing this issue to an extreme, if the query is not targeting any<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt; type, and no indexed types where added to the grid (even if some exist<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt; already as they might have been inserted by other JVMs or previous<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt; runs), all queries will return no results.<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt; How to solve this?<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt; - class scanning?<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt; Nope, too expensive.<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt; - explicitly list indexed entities in Infinispan configuration?<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt; No<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt; - a metadata cache maintaining a distributed&amp;stored copy of known types<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt; That sounds more appealing. It could be a good middle ground until Search can search for types.<br>
&gt;&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;&gt; Do you have any specific idea in mind?<br>
&gt;&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;&gt; To magically find types:<br>
&gt;&gt;&gt;&gt;&gt;&gt;  - we scan every file system, databases, caches available to the app and look for Lucene metadata =&gt; unrealistic<br>
&gt;&gt;&gt;&gt;&gt;&gt;  - there is some kind of convention on where the indexes are and we do index scanning at startup =&gt; scanning are very likely to be slower that class scanning (potential remote access, bigger dataset etc)<br>


&gt;&gt;&gt;&gt;&gt;&gt;  - we enforce one or a fixed number of Lucene indexes for all data in Infinispan =&gt; not sure that&#39;s a good idea but this can be explored<br>
&gt;&gt;&gt;&gt;&gt;&gt;  - we somehow ask the framework using HSearch to fill up classes<br>
&gt;&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;&gt; other approaches?<br>
&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt; why was class scanning discarded in the first answer? as H. Search can<br>
&gt;&gt;&gt;&gt;&gt; auto-discover classes by working on top of JPA entity autodiscovery, I<br>
&gt;&gt;&gt;&gt;&gt; guess that each application node could look into it&#39;s own known<br>
&gt;&gt;&gt;&gt;&gt; classpath.<br>
&gt;&gt;&gt;&gt;&gt; After all if some type is not visible to him as it was added from<br>
&gt;&gt;&gt;&gt;&gt; another node from a different app, he won&#39;t be able to return<br>
&gt;&gt;&gt;&gt;&gt; instances of it either.<br>
&gt;&gt;&gt;&gt;&gt; We could face the opposite problem of building metadata of classes<br>
&gt;&gt;&gt;&gt;&gt; people doesn&#39;t mean to index in this cache.<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; Right. scanning (class or index) will be a bit aggressive and could build unneeded metadata (or even worse, return unexpected classes).<br>
&gt;&gt;<br>
<br>
<br>
_______________________________________________<br>
infinispan-dev mailing list<br>
<a href="mailto:infinispan-dev@lists.jboss.org">infinispan-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/infinispan-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/infinispan-dev</a><br>
</div></div></blockquote></div><br>