<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div apple-content-edited="true"> <span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>--</div><div>Emmanuel Bernard</div><div><a href="http://in.relation.to/Bloggers/Emmanuel">http://in.relation.to/Bloggers/Emmanuel</a> |&nbsp;<a href="http://blog.emmanuelbernard.com">http://blog.emmanuelbernard.com</a> |&nbsp;<a href="http://twitter.com/emmanuelbernard">http://twitter.com/emmanuelbernard</a></div><div>Hibernate Search in Action (<a href="http://is.gd/Dl1">http://is.gd/Dl1</a>)</div></div></span></div></span></div></span></div></span></div></span> </div><br><div><div>On &nbsp;Jun 24, 2008, at 13:15, Manik Surtani wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hi guys - a few comments on the public interfaces of SearchableCache -&nbsp;<div><br></div><div>1) IMO, I think that the SearchableCache.createQuery() method should *not* return a FullTextQuery, but instead a JBCS-specific CacheQuery interface with a subset of the methods in FullTextQuery.</div></div></blockquote><div><br></div><div>+1</div><div><br></div><br><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><br></div><div>I think the only methods in FullTextQuery that are relevant and that should be carried across to CacheQuery are:</div><div><br></div><div>* list()</div></div></blockquote>+1<br><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>* iterator();</div></div></blockquote>don't think it's that useful in practice, scroll is probably more practical as it lazily loads Lucene data (contrary to iterator)<br><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>* setFirstResult(int i);</div></div></blockquote>+1<br><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>* setMaxResults(int i);</div></div></blockquote>+1<br><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>* setFetchSize(int i);</div></div></blockquote>+1<br><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>* getResultSize();</div></div></blockquote>+1<br><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>* setSort();</div></div></blockquote>+1</div><div>scroll()</div><div>setFilter,&nbsp;enableFullTextFilter,&nbsp;disableFullTextFilter&nbsp;is a total must have to do temporal patterns, category filter and so on. This is Lucene filters, not Hibernate Core filters.</div><div>setProjection()&nbsp;you need projection for metadata setResultTransformer is a consequence. It probably makes sense to project regular properties too (memory wise for sure, needs probably more testing speed wise)</div><div>uniqueResult() is quite nice</div><div><br></div><div><br></div><div><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><br></div><div>I think all of the rest - such as filters, criteria and projections - are irrelevant to a query on a cache. &nbsp;WDYT? &nbsp;Emmanuel?</div></div></blockquote><div><br></div><div>they are relevant, see above</div><br><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><br></div><div>2) Also, rather than implement FullTextQuery.scroll() to return a ScrollableResults instance, I'd rather that iterator() returns an instance of a new interface, QueryResultsIterator, which extends j.u.ListIterator. &nbsp;This gives us the ability to scroll back and forth over a result set, and we could add additional methods to jump to a specific point in the result set and helpers such as isLast(), isFirst(), isBeforeLast(), isAfterFirst(), first(), last(), afterFirst(), beforeLast().</div></div></blockquote><div><br></div><div>That's the point of Scroll, but you can rename it if you want. What's important is that you need a .close() method to release the lucene resources. also scroll() could return null if the object is not found in the cache (inconsistency), iterate() will just ignore the entry.</div><br><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><br></div><div>I think that any benefit of a scrollable result set window preventing loading unnecessary objects from a DB are lost when your backing store is a cache and the objects are in memory anyway. &nbsp;And besides, any further optimisations can be in the iterator implementation, such as just maintaining a list of CachedEntityIds (a composite of Fqn and key) and fetching the objects from the cache lazily, as required.</div></div></blockquote><div><br></div><div>iterate() lazily load object from the DB but eagerly loads Lucene stuffs</div><div>scroll() lazily load everything but need a .close()</div><br><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><br></div><div>Also, with the above, 2, we don't leak any Hibernate or Hibernate Search interfaces into the user API which again IMO is a good thing.</div></div></blockquote><div><br></div><div>You can use your own Scrolalble interface, that's fair. Essentially Search should look natural to cache users, not Hibernate users :)</div><br><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><br></div><div>Thoughts, comments?</div><div><br></div><div>Cheers</div><div>Manik</div><div><br></div><div><br></div><div><br></div><div><br><div><div>On 24 Jun 2008, at 11:47, Navin Surtani wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><br><div>Begin forwarded message:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font face="Helvetica" size="3" color="#000000" style="font: 12.0px Helvetica; color: #000000"><b>From: </b></font><font face="Helvetica" size="3" style="font: 12.0px Helvetica">Emmanuel Bernard &lt;<a href="mailto:emmanuel@hibernate.org">emmanuel@hibernate.org</a>></font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font face="Helvetica" size="3" color="#000000" style="font: 12.0px Helvetica; color: #000000"><b>Date: </b></font><font face="Helvetica" size="3" style="font: 12.0px Helvetica">24 June 2008 08:19:03 BST</font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font face="Helvetica" size="3" color="#000000" style="font: 12.0px Helvetica; color: #000000"><b>To: </b></font><font face="Helvetica" size="3" style="font: 12.0px Helvetica">Navin Surtani &lt;<a href="mailto:navin@surtani.org">navin@surtani.org</a>></font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font face="Helvetica" size="3" color="#000000" style="font: 12.0px Helvetica; color: #000000"><b>Subject: </b></font><font face="Helvetica" size="3" style="font: 12.0px Helvetica"><b>Re: More hibernate questions</b></font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><br></div> </div><div>Scroll is more important than iterate because it allows to read objects s a window and get rid of them on a regular basis without facing out of memory exception.<br>I think it's used more often than iterate<br><br>On &nbsp;Jun 23, 2008, at 18:17, Navin Surtani wrote:<br><br><blockquote type="cite">Hey again -<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">I have a CacheQueryImpl class that extends the FullTextQuery interface and I am implementing the methods as similar as possible.<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">A couple of problems occur when you are taking in and using certain Hibernate objects for example. A problem lies with the scroll() method. I think it is very similar to the iterate() method and does not need to be implemented in CacheQueryImpl. Do you know if Hibernate users generally use this method and find that they need it? If so then I will try and implement it otherwise then I will just make it throw an exception.<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Thanks again :)<br></blockquote><blockquote type="cite">Navin.<br></blockquote><br></div></blockquote></div><br></div></blockquote></div><br><div apple-content-edited="true"> <span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>--</div><div>Manik Surtani</div><div>Lead, JBoss Cache</div><div><a href="mailto:manik@jboss.org">manik@jboss.org</a></div><div><br></div><div><br></div></div></span><br class="Apple-interchange-newline"></div></span><br class="Apple-interchange-newline"></div></span><br class="Apple-interchange-newline"> </div><br></div></div>_______________________________________________<br>hibernate-dev mailing list<br><a href="mailto:hibernate-dev@lists.jboss.org">hibernate-dev@lists.jboss.org</a><br>https://lists.jboss.org/mailman/listinfo/hibernate-dev<br></blockquote></div><br></body></html>