<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On &nbsp;Jul 1, 2009, at 10:05, Galder Zamarreno wrote:</div><br><blockquote type="cite"><blockquote type="cite"><br>3 - SearchableCache: -<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Should the name of this class be changed? I don't think so but if anyone<br></blockquote><blockquote type="cite">has any ideas ...<br></blockquote><br>Here's my point of view:<br><br>createQuery() looks to me like factory method and so I think it would suit more a factory interface, i.e. QueryFactory? rather than in an extension of Cache.<br><br>IMO, extending Cache interface would make sense if you're gonna add an operation against the searchable or queryable cache itself, such query(). But this method kind of implies that you actually execute the query against the cache, so you'd imagine taking a CacheQuery as parameter. Bearing in mind my limited knowledge of how users use JBC Searchable, I dunno if having such method makes sense or not. If it does not, not a problem. Stick with a QueryFactory interface that has a create() method that returns Query (or CacheQuery) and that's it.<br><br></blockquote></div><br><div>Well except that your API will be just verbose and complex to use.</div><div>What's better?</div><div><br></div><div>List&lt;Item> results = cache.createQuery(luceneQuery, Item.class).setMaxResults(20).getResultList();</div><div>or</div><div>Query q = cache.getCacheManager().getQueryFactory().create(luceneQuery, Item.class)..setMaxResults(20);</div><div>List&lt;Item> results =&nbsp;cache.query(q);</div><div><br></div><div>in other words, who cares if it's a factory, a factory factory or an abstract factory factory factory. People just want to <b>create</b> a query and<b> get the result list</b>.&nbsp;</div></body></html>