Beispiel #1
0
        private static void _addToLuceneIndex(ArchiveDocument document, IndexWriter writer)
        {
            _removeFromLuceneIndex(document, writer);

            // add new index entry
            var doc = new Document();

            doc.Add(new Field("Id", document.Id, Field.Store.YES, Field.Index.NOT_ANALYZED));
            doc.Add(new Field("Name", document.Name, Field.Store.YES, Field.Index.ANALYZED));
            doc.Add(new Field("Fulltext", document.Fulltext, Field.Store.YES, Field.Index.ANALYZED));

            writer.AddDocument(doc);
        }
Beispiel #2
0
        private static void _removeFromLuceneIndex(ArchiveDocument document, IndexWriter writer)
        {
            var searchQuery = new TermQuery(new Term(LUCENE_IDENTIFIER, document.Id.ToString()));

            writer.DeleteDocuments(searchQuery);
        }
Beispiel #3
0
        /**************
        * Remove Document(s)
        **************/

        public static void RemoveSingleDocumentFromIndex(ArchiveDocument doc)
        {
            RemoveMultipleDocumentsFromIndex(new List <ArchiveDocument> {
                doc
            });
        }
Beispiel #4
0
        /**************
        * Add Document(s)
        **************/

        public static void AddSingleDocumentToIndex(ArchiveDocument doc)
        {
            AddMultipleDocumentsToIndex(new List <ArchiveDocument> {
                doc
            });
        }