searchdexpr.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. //
  2. // Copyright (c) 2017-2026, Manticore Software LTD (https://manticoresearch.com)
  3. // Copyright (c) 2001-2016, Andrew Aksyonoff
  4. // Copyright (c) 2008-2016, Sphinx Technologies Inc
  5. // All rights reserved
  6. //
  7. // This program is free software; you can redistribute it and/or modify
  8. // it under the terms of the GNU General Public License. You should have
  9. // received a copy of the GPL license along with this program; if you
  10. // did not, you can find it at http://www.gnu.org/
  11. //
  12. #ifndef _searchdexpr_
  13. #define _searchdexpr_
  14. #include "sphinxexpr.h"
  15. #include "sphinxdefs.h"
  16. class CSphIndex;
  17. /// searchd expression hook
  18. /// needed to implement functions that are builtin for searchd,
  19. /// but can not be builtin in the generic expression engine itself,
  20. /// like SNIPPET() function that must know about indexes, tokenizers, etc
  21. class ExprHook_c : public ISphExprHook
  22. {
  23. public:
  24. int IsKnownIdent ( const char * ) const final { return -1; }
  25. int IsKnownFunc ( const char * sFunc ) const final;
  26. ISphExpr * CreateNode ( int iID, ISphExpr * pLeft, const ISphSchema * pRsetSchema, ESphEvalStage * pEvalStage, bool * pNeedDocIds, CSphString & sError ) final;
  27. ESphAttr GetIdentType ( int ) const final;
  28. ESphAttr GetReturnType ( int iID, const CSphVector<ESphAttr> & dArgs, bool, CSphString & sError ) const final;
  29. void CheckEnter ( int ) final {}
  30. void CheckExit ( int ) final {}
  31. void SetIndex ( const CSphIndex * pIndex ) { m_pIndex = pIndex; }
  32. void SetProfiler ( QueryProfile_c * pProfiler ) { m_pProfiler = pProfiler; }
  33. void SetQueryType ( QueryType_e eType ) { m_eQueryType = eType; }
  34. private:
  35. const CSphIndex * m_pIndex = nullptr; /// BLOODY HACK
  36. QueryProfile_c * m_pProfiler = nullptr;
  37. QueryType_e m_eQueryType = QUERY_API;
  38. };
  39. #endif // _searchdexpr_