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

Doug Sale resolved LUCENENET-138.
---------------------------------

    Resolution: Fixed

In the code below (from IndexReader.cs), when the passed-in array of files 
contains path information, the test matching the start of the filename fails.

                public static long GetCurrentSegmentGeneration(System.String[] 
files)
                {
                        if (files == null)
                        {
                                return - 1;
                        }
                        long max = - 1;
                        for (int i = 0; i < files.Length; i++)
                        {
                                System.String file = files[i];
                                if (file.StartsWith(IndexFileNames.SEGMENTS) && 
!file.Equals(IndexFileNames.SEGMENTS_GEN))
                                {
                                        long gen = 
GenerationFromSegmentsFileName(file);
                                        if (gen > max)
                                        {
                                                max = gen;
                                        }
                                }
                        }
                        return max;
                }

The fix is to change the following line:
                                System.String file = files[i];
to:
                                System.String file = 
System.IO.Path.GetFileName(files[i]);


> IndexReader.IndexExists() always returns false
> ----------------------------------------------
>
>                 Key: LUCENENET-138
>                 URL: https://issues.apache.org/jira/browse/LUCENENET-138
>             Project: Lucene.Net
>          Issue Type: Bug
>            Reporter: Doug Sale
>         Attachments: SegmentInfos.patch
>
>   Original Estimate: 0h
>  Remaining Estimate: 0h
>


-- 
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