PageRenderTime 44ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 0ms

/strigi-0.7.7/libstreamanalyzer/plugins/indexers/clucenengindexer/cluceneindexwriter.h

#
C Header | 77 lines | 52 code | 6 blank | 19 comment | 0 complexity | d9fe302075cd402c8082deffe5218b89 MD5 | raw file
Possible License(s): LGPL-2.0
  1. /* This file is part of Strigi Desktop Search
  2. *
  3. * Copyright (C) 2006 Jos van den Oever <jos@vandenoever.info>
  4. *
  5. * This library is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU Library General Public
  7. * License as published by the Free Software Foundation; either
  8. * version 2 of the License, or (at your option) any later version.
  9. *
  10. * This library is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  13. * Library General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU Library General Public License
  16. * along with this library; see the file COPYING.LIB. If not, write to
  17. * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  18. * Boston, MA 02110-1301, USA.
  19. */
  20. #ifndef CLUCENEINDEXWRITER_H
  21. #define CLUCENEINDEXWRITER_H
  22. #include <CLucene.h>
  23. #include <strigi/strigiconfig.h>
  24. #include <strigi/indexwriter.h>
  25. #include <strigi/analysisresult.h>
  26. #include <strigi/analyzerconfiguration.h>
  27. class CLuceneIndexManager;
  28. class CLuceneIndexWriter : public Strigi::IndexWriter {
  29. private:
  30. CLuceneIndexManager* manager;
  31. int doccount;
  32. static const wchar_t* systemlocation();
  33. protected:
  34. void startAnalysis(const Strigi::AnalysisResult*);
  35. void finishAnalysis(const Strigi::AnalysisResult*);
  36. void addText(const Strigi::AnalysisResult*, const char* text, int32_t length);
  37. static void addValue(const Strigi::AnalysisResult* idx,
  38. Strigi::AnalyzerConfiguration::FieldType type, const TCHAR* name,
  39. const TCHAR* value);
  40. static void addValue(const Strigi::AnalysisResult* idx,
  41. Strigi::AnalyzerConfiguration::FieldType type, const TCHAR* name,
  42. const std::string& value);
  43. void addValue(const Strigi::AnalysisResult* idx,
  44. const Strigi::RegisteredField* field, const std::string& value);
  45. void addValue(const Strigi::AnalysisResult*,
  46. const Strigi::RegisteredField* fieldname,
  47. const unsigned char* data, uint32_t size);
  48. void addValue(const Strigi::AnalysisResult*,
  49. const Strigi::RegisteredField* fieldname, uint32_t value);
  50. void addValue(const Strigi::AnalysisResult*,
  51. const Strigi::RegisteredField* fieldname, int32_t value);
  52. void addValue(const Strigi::AnalysisResult*,
  53. const Strigi::RegisteredField* fieldname, double value);
  54. void addTriplet(const std::string& subject,
  55. const std::string& predicate, const std::string& object) {}
  56. void addValue(const Strigi::AnalysisResult*,
  57. const Strigi::RegisteredField* field, const std::string& name,
  58. const std::string& value) {}
  59. void initWriterData(const Strigi::FieldRegister& f);
  60. void releaseWriterData(const Strigi::FieldRegister& f);
  61. public:
  62. explicit CLuceneIndexWriter(CLuceneIndexManager* m);
  63. ~CLuceneIndexWriter();
  64. void commit();
  65. void deleteEntries(const std::vector<std::string>& entries);
  66. void deleteAllEntries();
  67. void deleteEntry(const std::string& entry, lucene::index::IndexWriter* writer, lucene::index::IndexReader* reader);
  68. static const TCHAR* mapId(const TCHAR* id);
  69. static void addMapping(const TCHAR* from, const TCHAR* to);
  70. };
  71. #endif