A utility for making Lucene Documents from a File.
Ejemplo n.º 1
0
        internal static void IndexDocs(IndexWriter writer, FileInfo file)
        {
            Console.Out.WriteLine("adding " + file);

            try
            {
                writer.AddDocument(FileDocument.Document(file));
            }
            catch (FileNotFoundException)
            {
                // At least on Windows, some temporary files raise this exception with an
                // "access denied" message checking if the file can be read doesn't help.
            }
            catch (UnauthorizedAccessException)
            {
                // Handle any access-denied errors that occur while reading the file.
            }
            catch (IOException)
            {
                // Generic handler for any io-related exceptions that occur.
            }
        }