[hibernate-dev] HSEARCH-615 Support time-constrained queries returning the first available results
Emmanuel Bernard
emmanuel at hibernate.org
Sat Nov 6 10:25:48 EDT 2010
You'll need to extend:
- List
- Iterator
- ScrollableResults
Not sure that's a good thing.
You can reuse the query as long as you check hasPartialResults() before calling list/iterate/scroll query again.
PS: we should add tests about query reusability, I'm not sure it works as expected today.
On 6 nov. 2010, at 12:31, Sanne Grinovero wrote:
> Hello,
> about naming I have no better ideas:
> .limitFetchTime() //slightly different, not very happy about it either
>
> about API, does it really make sense to have hasPartialResults() as a
> method of the Query?
> It should be a List property I think - I have no strong opinions about
> this as I don't like having to extend the List implementation.
>
> But really Query is something I might want to reuse - unlikely but I'd
> expect that to work fine.
> So what about:
>
> SomeNewList results = query.list(500, TimeUnit.MILLISECONDS)
> or a batter named method.
>
> So:
>
> if ( results.hasPartialResults() ) {
> displayWarningToUser();
> }
>
> This is one of those cases in which I miss the option of having a
> couple of values from a function.
>
> Sanne
>
> 2010/11/5 Emmanuel Bernard <emmanuel at hibernate.org>:
>> If you can find better name for the API, please advise. I am not happy with the current version
>>
>> Query luceneQuery = ...;
>> FullTextQuery query = fullTextSession.createFullTextQuery(luceneQuery, User.class);
>>
>> //define the timeout in seconds
>> query.limitFetchingTime(500, TimeUnit.MILLISECONDS);
>> List results = query.list();
>>
>> if ( query.hasPartialResults() ) {
>> displayWarningToUser();
>> }
>>
>> Emmanuel
>> _______________________________________________
>> hibernate-dev mailing list
>> hibernate-dev at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/hibernate-dev
>>
More information about the hibernate-dev
mailing list