[ 
https://issues.apache.org/jira/browse/LUCENE-3918?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13561419#comment-13561419
 ] 

Shai Erera commented on LUCENE-3918:
------------------------------------

bq. the 3.6 impl seemed somewhat more RAM efficient (left things on disk and 
seek'd on each lookup)

>From what I remember (and I looked at the code again now), the 3.6 impl read 
>the posting into a RAMOutputStream:

{code}
    private static final String TEMP_FILE = "temp";
    private final RAMDirectory tempDir = new RAMDirectory();
    private RAMOutputStream out;
{code}

You can look at how seek(TermsEnum) iterates on {{original}}, writing 
everything to {{out}} and then calls to {{next()}} are served from this 
in-memory file.
That concept has not changed in this version.

I agree that List<Integer> seems an overkill here, and a growable int[] would 
be better. Since the array is sorted, perhaps we can grow the array (using 
ArrayUtil.grow), but keep an 'upto' and fill the extra values in the array with 
Integer.MAX_VALUE, so that they are always sorted last (instead of trimming the 
array). Then nextDoc() will just iterate up to 'upto'.

bq. Some places seem to open a DirectoryReader but not close it, eg 
DocumentSorter.oldToNew.

I think first that tests need to extend LuceneTestCase (from what I can tell, 
they don't now) and then use {{newDirectory()}}. This should catch all these 
places I think?

Also, from a quick at the tests:

* They don't need a package.html, it can be removed
* You can omit the Assert.* from all assert calls. E.g. rather than calling 
Assert.assertEquals, just call assertEquals.
* Tests should use MockAnalyzer, rather than Standard (this thing should not 
add a dependency on analyzers module)
                
> Port index sorter to trunk APIs
> -------------------------------
>
>                 Key: LUCENE-3918
>                 URL: https://issues.apache.org/jira/browse/LUCENE-3918
>             Project: Lucene - Core
>          Issue Type: Task
>          Components: modules/other
>    Affects Versions: 4.0-ALPHA
>            Reporter: Robert Muir
>             Fix For: 4.2, 5.0
>
>         Attachments: LUCENE-3918.patch
>
>
> LUCENE-2482 added an IndexSorter to 3.x, but we need to port this
> functionality to 4.0 apis.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to