static Indexable FileToIndexable(FileInfo file)
{
if (!file.Exists) {
Log.Warn("File not exist: {0}", file.FullName);
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);
if (FileSystem.IsSymLink(file.FullName)) {
FSQ.AddStandardPropertiesToIndexable
(indexable, FileSystem.Readlink(file.FullName), Guid.Empty, false);
Log.Warn("{0} -> {1}", file.FullName, FileSystem.Readlink(file.FullName));
}
// Store directory name in the index
string dirname = file.DirectoryName;
indexable.AddProperty (Property.NewUnsearched (Property.ParentDirUriPropKey, PathToUri (dirname)));
return indexable;
}