Ejemplo n.º 1
0
 public bool RemoveAllIndex()
 {
     try
     {
         using (var indexWriter = LuceneHelper.GetIndexWriter(_analyzer, _directory))
         {
             indexWriter.DeleteAll();
             _analyzer.Close();
             indexWriter.Dispose();
             return(true);
         }
     }
     catch (Exception e)
     {
         return(false);
     }
 }
Ejemplo n.º 2
0
 public bool RemoveIndexByTerm(Term term)
 {
     try
     {
         using (var indexWriter = LuceneHelper.GetIndexWriter(_analyzer, _directory))
         {
             indexWriter.DeleteDocuments(term);
             _analyzer.Close();
             indexWriter.Dispose();
             return(true);
         }
     }
     catch (Exception e)
     {
         return(false);
     }
 }
Ejemplo n.º 3
0
 public bool AddIndex(Document doc)
 {
     try
     {
         using (var indexWriter = LuceneHelper.GetIndexWriter(_analyzer, _directory))
         {
             indexWriter.AddDocument(doc);
             _analyzer.Close();
             indexWriter.Dispose();
             return(true);
         }
     }
     catch (Exception e)
     {
         return(false);
     }
 }
Ejemplo n.º 4
0
 public bool UpdateIndex(Term term, Document doc)
 {
     try
     {
         using (var indexWriter = LuceneHelper.GetIndexWriter(_analyzer, _directory))
         {
             indexWriter.UpdateDocument(term, doc);
             _analyzer.Close();
             indexWriter.Dispose();
             return(true);
         }
     }
     catch (Exception e)
     {
         return(false);
     }
 }
Ejemplo n.º 5
0
 public LuceneSearch()
 {
     _analyzer  = LuceneHelper.GetAnalyzer(AnalyzerType.StandardAnalyzer);
     _directory = LuceneHelper.GetFsDirectory(Env.IndexPath);
 }