<html><body 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 - <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><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>* iterator();</div><div>* setFirstResult(int i);</div><div>* setMaxResults(int i);</div><div>* setFetchSize(int i);</div><div>* getResultSize();</div><div>* setSort();</div><div><br></div><div>I think all of the rest - such as filters, criteria and projections - are irrelevant to a query on a cache. WDYT? Emmanuel?</div><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. 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><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. 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><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><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 <<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 <<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 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></body></html>