[ 
https://issues.apache.org/jira/browse/LUCENENET-247?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12778029#action_12778029
 ] 

George Aroush commented on LUCENENET-247:
-----------------------------------------

Really nice work DIGY!

I have few change request below.  The first one is to keep logical flow 
consistant with Java Lucene, the rest are just minor cleanup to reduce delta 
noise for next ports.

0) IndexReader.cs -- the "if" check that you added to the method IndexExists() 
can lead to behavior difference if GetCurrentSegmentGeneration() logic is 
changed in the feature.  So, can you modify your current change:

                public static bool IndexExists(System.IO.FileInfo directory)
                {
+            if (System.IO.Directory.Exists(directory.FullName) == false) 
return false;
                        return 
SegmentInfos.GetCurrentSegmentGeneration(System.IO.Directory.GetFileSystemEntries(directory.FullName))
 != - 1;
                }

To:

                public static bool IndexExists(System.IO.FileInfo directory)
                {
+                       System.String[] list = null;
+                       if (System.IO.Directory.Exists(directory.FullName)) 
list = System.IO.Directory.GetFileSystemEntries(directory.FullName);
                        return SegmentInfos.GetCurrentSegmentGeneration(list) 
!= - 1;
                }

This will move back the decision of what to do (if the list is empty) back to 
GetCurrentSegmentGeneration().  Thus, it will keep the logical flow consistent 
with Java Lucene (in case GetCurrentSegmentGeneration() changes in the feature).

The rest are cleanup work.

1) DirectoryReader.cs -- please remove:

+                    //// Sync all files we just wrote
+                    //System.Collections.IEnumerator it = 
segmentInfos.Files(directory, false).GetEnumerator();
+                    //while (it.MoveNext())
+                    //{
+                    //    System.String fileName = 
(string)((System.Collections.DictionaryEntry) it.Current).Value;
+                    //    if (!synced.ContainsKey(fileName))
+                    //    {
+                    //        
System.Diagnostics.Debug.Assert(directory.FileExists(fileName));
+                    //        directory.Sync(fileName);
+                    //        
SupportClass.CollectionsHelper.AddIfNotContains(synced, fileName);
+                    //    }
+                    //}

2) DirectoryReader.cs -- please remove:

+                               //files = 
System.Collections.ArrayList.ReadOnly(new 
System.Collections.ArrayList(infos.Files(dir, true)));

3) DirectoryReader.cs -- please remove:

+                               //lastFiles.Add(segmentInfos.Files(directory, 
false));

3) DirectoryReader.cs -- please remove:

+                               //lastFiles.Add(docWriterFiles);

4) DirectoryReader.cs -- please remove:

+                               //files = 
System.Collections..ArrayList.ReadOnly(new 
System.Collections.ArrayList(segmentInfos.Files(directory, true)));

5) ParallelReader.cs -- please remove:

+                               
//SupportClass.CollectionsHelper.AddAll(fieldSet, names);


> TestIndexReaderReopen.TestMixedReaders
> --------------------------------------
>
>                 Key: LUCENENET-247
>                 URL: https://issues.apache.org/jira/browse/LUCENENET-247
>             Project: Lucene.Net
>          Issue Type: Bug
>         Environment: 2.9.0
>            Reporter: Digy
>         Attachments: Big.patch, Big2.patch, Big3.patch, Big4.patch
>
>
> After I hit the standart type casting error "Can not cast 
> System.Collections.DictionaryEntry to string" , I decided to clean up the 
> GetFieldNames functions a bit.
> In some locations where a string is expected, there is a DictionaryEntry 
> whose key contains another DictionaryEntry which in turns contains a string.
> DIGY

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

Reply via email to