index_wrapper.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /*
  2. * Tencent is pleased to support the open source community by making wwsearch
  3. * available.
  4. *
  5. * Copyright (C) 2018-present Tencent. All Rights Reserved.
  6. *
  7. * Licensed under the Apache License, Version 2.0 (the "License"); you may not
  8. * use this file except in compliance with the License. You may obtain a copy of
  9. * the License at
  10. *
  11. * https://opensource.org/licenses/Apache-2.0
  12. *
  13. * Unless required by applicable law or agreed to in writing, software
  14. * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  15. * WARRANTIES OF ANY KIND, either express or implied. See the License for the
  16. * specific language governing permissions and limitations under the License.
  17. */
  18. #pragma once
  19. #include "codec_impl.h"
  20. #include "document.h"
  21. #include "index_writer.h"
  22. #include "logger.h"
  23. #include "search_status.h"
  24. #include "bool_query.h"
  25. #include "query.h"
  26. #include "searcher.h"
  27. #include "storage_type.h"
  28. #include "tokenizer_impl.h"
  29. #include "weight.h"
  30. namespace wwsearch {
  31. /* A simple wrapper use default params.
  32. * Only use in internal test.
  33. */
  34. class DefaultIndexWrapper {
  35. public:
  36. VDBParams params_;
  37. CodecImpl *codec_;
  38. VirtualDB *vdb_;
  39. Tokenizer *tokenizer_;
  40. IndexConfig config_;
  41. IndexWriter *index_writer_;
  42. public:
  43. DefaultIndexWrapper() {
  44. codec_ = nullptr;
  45. vdb_ = nullptr;
  46. tokenizer_ = nullptr;
  47. index_writer_ = nullptr;
  48. }
  49. void SetVdb(VirtualDB *vdb) { vdb_ = vdb; }
  50. VDBParams &DBParams() { return this->params_; }
  51. IndexConfig &Config() { return this->config_; }
  52. virtual ~DefaultIndexWrapper();
  53. SearchStatus Open(bool use_rocksdb = false, bool use_compression = false);
  54. private:
  55. };
  56. } // namespace wwsearch