示例#1
0
 /// <summary>
 /// Returns a map of the revision files from the given <see cref="IndexCommit"/>s of the search and taxonomy indexes.
 /// </summary>
 /// <exception cref="IOException"></exception>
 public static IDictionary <string, IList <RevisionFile> > RevisionFiles(IndexCommit indexCommit, IndexCommit taxonomyCommit)
 {
     return(new Dictionary <string, IList <RevisionFile> > {
         { INDEX_SOURCE, IndexRevision.RevisionFiles(indexCommit).Values.First() },
         { TAXONOMY_SOURCE, IndexRevision.RevisionFiles(taxonomyCommit).Values.First() }
     });
 }
        /// <summary>
        /// Constructor with the given index directory and callback to notify when the
        /// indexes were updated.
        /// </summary>
        public IndexReplicationHandler(Directory indexDirectory, Func <bool?> callback) // LUCENENET TODO: API - shouldn't this be Action ?
        {
            this.InfoStream     = InfoStream.Default;
            this.callback       = callback;
            this.indexDirectory = indexDirectory;

            currentVersion       = null;
            currentRevisionFiles = null;

            if (DirectoryReader.IndexExists(indexDirectory))
            {
                IList <IndexCommit> commits = DirectoryReader.ListCommits(indexDirectory);
                IndexCommit         commit  = commits[commits.Count - 1];

                currentVersion       = IndexRevision.RevisionVersion(commit);
                currentRevisionFiles = IndexRevision.RevisionFiles(commit);

                WriteToInfoStream(
                    string.Format("constructor(): currentVersion={0} currentRevisionFiles={1}", currentVersion, currentRevisionFiles),
                    string.Format("constructor(): commit={0}", commit));
            }
        }