You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Jason Rutherglen (JIRA)" <ji...@apache.org> on 2011/01/24 22:13:57 UTC

[jira] Closed: (SOLR-569) SimpleFacet binarysearch optimization

     [ https://issues.apache.org/jira/browse/SOLR-569?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jason Rutherglen closed SOLR-569.
---------------------------------

    Resolution: Won't Fix

Sorry if this spam's things, however it's unlikely that I'll work on these.

> SimpleFacet binarysearch optimization
> -------------------------------------
>
>                 Key: SOLR-569
>                 URL: https://issues.apache.org/jira/browse/SOLR-569
>             Project: Solr
>          Issue Type: Improvement
>          Components: search
>    Affects Versions: 1.3
>            Reporter: Jason Rutherglen
>            Priority: Minor
>
> Looks like the SimpleFacets.getFieldCacheCounts could have small optimization:
> {noformat}
> startTermIndex = Arrays.binarySearch(terms,prefix,nullStrComparator);
> if (startTermIndex<0) startTermIndex=-startTermIndex-1;
> // find the end term.  \uffff isn't a legal unicode char, but only compareTo
> // is used, so it should be fine, and is guaranteed to be bigger than legal chars.
> endTermIndex = Arrays.binarySearch(terms,prefix+"\uffff\uffff\uffff\uffff",nullStrComparator);
> endTermIndex = -endTermIndex-1;
> {noformat} 
> to:
> {noformat}
> startTermIndex = Arrays.binarySearch(terms,prefix,nullStrComparator);
> if (startTermIndex<0) startTermIndex=-startTermIndex-1;
> // find the end term.  \uffff isn't a legal unicode char, but only compareTo
> // is used, so it should be fine, and is guaranteed to be bigger than legal chars.
> endTermIndex = Arrays.binarySearch(terms, startTermIndex,
> terms.length, prefix+"\uffff\uffff\uffff\uffff",nullStrComparator);
> endTermIndex = -endTermIndex-1;
> {noformat} 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org