search_api_stats.install 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. <?php
  2. /**
  3. * @file
  4. * Install, update and uninstall functions for the search_api_stats module.
  5. *
  6. */
  7. /**
  8. * Implements hook_install().
  9. */
  10. function search_api_stats_install() {
  11. }
  12. /**
  13. * Implements hook_uninstall().
  14. */
  15. function search_api_stats_uninstall() {
  16. }
  17. /**
  18. * Implements hook_enable().
  19. */
  20. function search_api_stats_enable() {
  21. }
  22. /**
  23. * Implements hook_schema().
  24. */
  25. function search_api_stats_schema() {
  26. $schema['search_api_stats'] = array(
  27. 'description' => 'Table that contains a log of Search API queries and performance.',
  28. 'fields' => array(
  29. 'qid' => array(
  30. 'type' => 'serial',
  31. 'not null' => TRUE,
  32. 'description' => 'Primary Key: Unique log ID.',
  33. ),
  34. 's_name' => array(
  35. 'type' => 'varchar',
  36. 'length' => 50,
  37. 'not null' => TRUE,
  38. 'description' => 'Search API server machine_name',
  39. ),
  40. 'i_name' => array(
  41. 'type' => 'varchar',
  42. 'length' => 50,
  43. 'not null' => TRUE,
  44. 'description' => 'Search API index machine_name',
  45. ),
  46. 'timestamp' => array(
  47. 'type' => 'int',
  48. 'not null' => TRUE,
  49. 'default' => 0,
  50. 'description' => 'Unix timestamp of when query occurred.',
  51. ),
  52. 'numfound' => array(
  53. 'type' => 'int',
  54. 'not null' => TRUE,
  55. 'default' => 0,
  56. 'description' => 'Number of results.',
  57. ),
  58. 'total_time' => array(
  59. 'type' => 'int',
  60. 'not null' => TRUE,
  61. 'default' => 0,
  62. 'description' => 'Total query time (miliseconds).',
  63. ),
  64. 'prepare_time' => array(
  65. 'type' => 'int',
  66. 'not null' => TRUE,
  67. 'default' => 0,
  68. 'description' => 'Time taken by Search API prepare phase for this query (miliseconds).',
  69. ),
  70. 'process_time' => array(
  71. 'type' => 'int',
  72. 'not null' => TRUE,
  73. 'default' => 0,
  74. 'description' => 'Time taken by Search API process phase for this query (miliseconds).',
  75. ),
  76. 'uid' => array(
  77. 'type' => 'int',
  78. 'not null' => TRUE,
  79. 'default' => 0,
  80. 'description' => 'The {users}.uid of the user who triggered the query.',
  81. ),
  82. 'sid' => array(
  83. 'type' => 'varchar',
  84. 'length' => 64,
  85. 'not null' => TRUE,
  86. 'default' => '',
  87. 'description' => 'Session ID of user who triggered the query.',
  88. ),
  89. 'showed_suggestions' => array(
  90. 'type' => 'int',
  91. 'not null' => TRUE,
  92. 'default' => 0,
  93. 'description' => 'Indicates whether a spelling suggestion was shown.',
  94. ),
  95. 'page' => array(
  96. 'type' => 'varchar',
  97. 'length' => 10,
  98. 'not null' => TRUE,
  99. 'default' => '',
  100. 'description' => 'Current results page.',
  101. ),
  102. 'keywords' => array(
  103. 'type' => 'varchar',
  104. 'length' => 128,
  105. 'not null' => FALSE,
  106. 'default' => '',
  107. 'description' => 'Query keywords arguments.',
  108. ),
  109. 'filters' => array(
  110. 'type' => 'text',
  111. 'size' => 'normal',
  112. 'not null' => TRUE,
  113. 'description' => 'Query filter arguments.',
  114. ),
  115. 'sort' => array(
  116. 'type' => 'varchar',
  117. 'length' => 128,
  118. 'not null' => TRUE,
  119. 'description' => 'Query sort arguments.',
  120. ),
  121. ),
  122. 'primary key' => array('qid'),
  123. );
  124. return $schema;
  125. }