iMattPro /
similartopics
| 1 | <?php |
||
| 2 | /** |
||
| 3 | * |
||
| 4 | * Precise Similar Topics |
||
| 5 | * |
||
| 6 | * @copyright (c) 2018 Matt Friedman |
||
| 7 | * @license GNU General Public License, version 2 (GPL-2.0) |
||
| 8 | * |
||
| 9 | */ |
||
| 10 | |||
| 11 | namespace vse\similartopics\driver; |
||
| 12 | |||
| 13 | interface driver_interface |
||
| 14 | { |
||
| 15 | /** |
||
| 16 | * Get the name of the driver |
||
| 17 | * |
||
| 18 | * @return string |
||
| 19 | */ |
||
| 20 | public function get_name(); |
||
| 21 | |||
| 22 | /** |
||
| 23 | * Get the type of the driver, i.e.: mysql or postgres |
||
| 24 | * |
||
| 25 | * @return string |
||
| 26 | */ |
||
| 27 | public function get_type(); |
||
| 28 | |||
| 29 | /** |
||
| 30 | * Generate the basic SQL query for similar topic searches |
||
| 31 | * |
||
| 32 | * @param int $topic_id The ID of the main topic |
||
| 33 | * @param string $topic_title The title of the main topic |
||
| 34 | * @param int $length The length of time of the search period |
||
| 35 | * @param float $sensitivity The search score weighting |
||
| 36 | * @return array An SQL query array |
||
| 37 | */ |
||
| 38 | public function get_query($topic_id, $topic_title, $length, $sensitivity); |
||
| 39 | |||
| 40 | /** |
||
| 41 | * Check for database support |
||
| 42 | * |
||
| 43 | * @access public |
||
| 44 | * @return bool True if FULLTEXT is supported, false otherwise |
||
| 45 | */ |
||
| 46 | public function is_supported(); |
||
| 47 | |||
| 48 | /** |
||
| 49 | * Check if a column is a FULLTEXT index in topics table |
||
| 50 | * |
||
| 51 | * @access public |
||
| 52 | * @param string $column Name of the column |
||
| 53 | * @param string $table Name of the table |
||
| 54 | * @return bool True if column is a FULLTEXT index, false otherwise |
||
| 55 | */ |
||
| 56 | public function is_fulltext($column = 'topic_title', $table = TOPICS_TABLE); |
||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
| 57 | |||
| 58 | /** |
||
| 59 | * Get all FULLTEXT indexes for a column in topics table |
||
| 60 | * |
||
| 61 | * @access public |
||
| 62 | * @param string $column Name of the column |
||
| 63 | * @param string $table Name of the table |
||
| 64 | * @return array contains index names |
||
| 65 | */ |
||
| 66 | public function get_fulltext_indexes($column = 'topic_title', $table = TOPICS_TABLE); |
||
|
0 ignored issues
–
show
|
|||
| 67 | |||
| 68 | /** |
||
| 69 | * Make a column into a FULLTEXT index in topics table |
||
| 70 | * |
||
| 71 | * @access public |
||
| 72 | * @param string $column Name of the column |
||
| 73 | * @param string $table Name of the table |
||
| 74 | * @return void |
||
| 75 | */ |
||
| 76 | public function create_fulltext_index($column = 'topic_title', $table = TOPICS_TABLE); |
||
|
0 ignored issues
–
show
|
|||
| 77 | |||
| 78 | /** |
||
| 79 | * Get the database storage engine name |
||
| 80 | * |
||
| 81 | * @access public |
||
| 82 | * @return string The storage engine name |
||
| 83 | */ |
||
| 84 | public function get_engine(); |
||
| 85 | } |
||
| 86 |