search_status.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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 "header.h"
  20. namespace wwsearch {
  21. enum kSearchStatusCode {
  22. kOK = 0,
  23. kSearchStatusCodeBase = -18525,
  24. kDocumentExistStatus = 18526,
  25. kDocumentNotExistStatus = 18527,
  26. kSerializeErrorStatus = -18528,
  27. kRocksDBErrorStatus = -18529,
  28. kDocumentIDCanNotZero = 18530,
  29. kDataErrorStatus = -18531,
  30. kTokenizerErrorStatus = -18532,
  31. kOtherDocumentErrorStatus = 18533,
  32. kIndexWriterOpenErrorStatus = -18534,
  33. kVirtualDBOpenErrorStatus = -18535,
  34. kScorerErrorStatus = -18536,
  35. kDocumentTooLargeStatus = 18537,
  36. kReachMaxDocListSizeLimit = 18538,
  37. };
  38. class SearchStatus {
  39. private:
  40. int status_code_;
  41. std::string status_msg_;
  42. public:
  43. SearchStatus();
  44. SearchStatus(const SearchStatus &o);
  45. ~SearchStatus();
  46. void SetStatus(int status_code, const char *msg);
  47. const std::string &GetState() const;
  48. bool DocumentExist();
  49. bool DocumentNotExist();
  50. bool ReachMaxDocListSizeLimit();
  51. bool OK();
  52. int GetCode() const;
  53. private:
  54. };
  55. } // namespace wwsearch