This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 244432

Summary: Add a public access to CategoryResult.MAX_RESULTS and .ALL_MAX_RESULTS
Product: platform Reporter: arittner <arittner>
Component: Quick SearchAssignee: Jaroslav Havlin <jhavlin>
Status: NEW ---    
Severity: normal    
Priority: P3    
Version: 8.0   
Hardware: PC   
OS: Windows 7   
Issue Type: ENHANCEMENT Exception Reporter:
Attachments: Proposed Patch

Description arittner 2014-05-12 05:29:29 UTC
The SearchRequest Class should expose the values from CategoryResult.MAX_RESULTS and/or *.ALL_MAX_RESULTS to optimize queries for the SearchProvider.

Sometimes it would be useful to know the real search result limits to prepare queries (e.g. database select optimizations, like the FIRST or ROWS clause, JDBC-setFetchSize, ...).

Example:

public class PersonNameSearch implements SearchProvider {

  @Override
  public void evaluate(SearchRequest request, SearchResponse response) {
        
    String req = request.getText();
    int limit = request.getResultLimit(); // proposal

    ...

    PreparedStatement stmt = ...

    stmt.setFetchSize (limit);
Comment 1 Jaroslav Havlin 2014-05-23 14:45:15 UTC
Created attachment 147414 [details]
Proposed Patch

Please check the attached patch. If the changes seem ok to you, I'll add unit tests and start an API review.
Thank you for reporting.