Esempio n. 1
0
        static Indexable FileToIndexable(FileInfo file)
        {
            if (!file.Exists)
            {
                return(null);
            }

            if (fa_store.IsUpToDateAndFiltered(PathInIndex(file.FullName),
                                               FileSystem.GetLastWriteTimeUtc(file.FullName)))
            {
                return(null);
            }

            // Create the indexable and add the standard properties we
            // use in the FileSystemQueryable.
            Uri       uri       = PathToUri(file.FullName);
            Indexable indexable = new Indexable(uri);

            indexable.Timestamp        = file.LastWriteTimeUtc;
            indexable.FlushBufferCache = true;
            indexable.AddProperty(Property.NewUnsearched("fixme:filesize", file.Length));
            FSQ.AddStandardPropertiesToIndexable(indexable, file.Name, Guid.Empty, false);

            // Store directory name in the index
            string dirname = file.DirectoryName;

            indexable.AddProperty(Property.NewUnsearched(Property.ParentDirUriPropKey, PathToUri(dirname)));

            return(indexable);
        }