1 /*****************************************************************************
2 
3 Copyright (c) 2011, 2016, Oracle and/or its affiliates. All Rights Reserved.
4 
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License, version 2.0,
7 as published by the Free Software Foundation.
8 
9 This program is also distributed with certain software (including
10 but not limited to OpenSSL) that is licensed under separate terms,
11 as designated in a particular file or component or in included license
12 documentation.  The authors of MySQL hereby grant you an additional
13 permission to link the program and your derivative works with the
14 separately licensed software that they have included with MySQL.
15 
16 This program is distributed in the hope that it will be useful,
17 but WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19 GNU General Public License, version 2.0, for more details.
20 
21 You should have received a copy of the GNU General Public License along with
22 this program; if not, write to the Free Software Foundation, Inc.,
23 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
24 
25 *****************************************************************************/
26 
27 /******************************************************************//**
28 @file include/fts0priv.h
29 Full text search internal header file
30 
31 Created 2011/09/02 Sunny Bains
32 ***********************************************************************/
33 
34 #ifndef INNOBASE_FTS0PRIV_H
35 #define INNOBASE_FTS0PRIV_H
36 
37 #include "dict0dict.h"
38 #include "pars0pars.h"
39 #include "que0que.h"
40 #include "que0types.h"
41 #include "fts0types.h"
42 
43 /* The various states of the FTS sub system pertaining to a table with
44 FTS indexes defined on it. */
45 enum fts_table_state_enum {
46 					/* !<This must be 0 since we insert
47 					a hard coded '0' at create time
48 					to the config table */
49 
50 	FTS_TABLE_STATE_RUNNING = 0,	/*!< Auxiliary tables created OK */
51 
52 	FTS_TABLE_STATE_OPTIMIZING,	/*!< This is a substate of RUNNING */
53 
54 	FTS_TABLE_STATE_DELETED		/*!< All aux tables to be dropped when
55 					it's safe to do so */
56 };
57 
58 typedef enum fts_table_state_enum fts_table_state_t;
59 
60 /** The default time to wait for the background thread (in microsecnds). */
61 #define FTS_MAX_BACKGROUND_THREAD_WAIT		10000
62 
63 /** Maximum number of iterations to wait before we complain */
64 #define FTS_BACKGROUND_THREAD_WAIT_COUNT	1000
65 
66 /** The maximum length of the config table's value column in bytes */
67 #define FTS_MAX_CONFIG_NAME_LEN			64
68 
69 /** The maximum length of the config table's value column in bytes */
70 #define FTS_MAX_CONFIG_VALUE_LEN		1024
71 
72 /** Approx. upper limit of ilist length in bytes. */
73 #define FTS_ILIST_MAX_SIZE			(64 * 1024)
74 
75 /** FTS config table name parameters */
76 
77 /** The number of seconds after which an OPTIMIZE run will stop */
78 #define FTS_OPTIMIZE_LIMIT_IN_SECS	"optimize_checkpoint_limit"
79 
80 /** The next doc id */
81 #define FTS_SYNCED_DOC_ID		"synced_doc_id"
82 
83 /** The last word that was OPTIMIZED */
84 #define FTS_LAST_OPTIMIZED_WORD		"last_optimized_word"
85 
86 /** Total number of documents that have been deleted. The next_doc_id
87 minus this count gives us the total number of documents. */
88 #define FTS_TOTAL_DELETED_COUNT		"deleted_doc_count"
89 
90 /** Total number of words parsed from all documents */
91 #define FTS_TOTAL_WORD_COUNT		"total_word_count"
92 
93 /** Start of optimize of an FTS index */
94 #define FTS_OPTIMIZE_START_TIME		"optimize_start_time"
95 
96 /** End of optimize for an FTS index */
97 #define FTS_OPTIMIZE_END_TIME		"optimize_end_time"
98 
99 /** User specified stopword table name */
100 #define	FTS_STOPWORD_TABLE_NAME		"stopword_table_name"
101 
102 /** Whether to use (turn on/off) stopword */
103 #define	FTS_USE_STOPWORD		"use_stopword"
104 
105 /** State of the FTS system for this table. It can be one of
106  RUNNING, OPTIMIZING, DELETED. */
107 #define FTS_TABLE_STATE			"table_state"
108 
109 /** The minimum length of an FTS auxiliary table names's id component
110 e.g., For an auxiliary table name
111 
112 	FTS_<TABLE_ID>_SUFFIX
113 
114 This constant is for the minimum length required to store the <TABLE_ID>
115 component.
116 */
117 #define FTS_AUX_MIN_TABLE_ID_LENGTH	48
118 
119 /** Maximum length of an integer stored in the config table value column. */
120 #define FTS_MAX_INT_LEN			32
121 
122 /******************************************************************//**
123 Parse an SQL string. %s is replaced with the table's id.
124 @return query graph */
125 UNIV_INTERN
126 que_t*
127 fts_parse_sql(
128 /*==========*/
129 	fts_table_t*	fts_table,	/*!< in: FTS aux table */
130 	pars_info_t*	info,		/*!< in: info struct, or NULL */
131 	const char*	sql)		/*!< in: SQL string to evaluate */
132 	MY_ATTRIBUTE((nonnull(3), malloc, warn_unused_result));
133 /******************************************************************//**
134 Evaluate a parsed SQL statement
135 @return DB_SUCCESS or error code */
136 UNIV_INTERN
137 dberr_t
138 fts_eval_sql(
139 /*=========*/
140 	trx_t*		trx,		/*!< in: transaction */
141 	que_t*		graph)		/*!< in: Parsed statement */
142 	MY_ATTRIBUTE((nonnull, warn_unused_result));
143 /******************************************************************//**
144 Construct the name of an ancillary FTS table for the given table.
145 @return own: table name, must be freed with mem_free() */
146 UNIV_INTERN
147 char*
148 fts_get_table_name(
149 /*===============*/
150 	const fts_table_t*
151 			fts_table)	/*!< in: FTS aux table info */
152 	MY_ATTRIBUTE((nonnull, malloc, warn_unused_result));
153 /******************************************************************//**
154 Construct the column specification part of the SQL string for selecting the
155 indexed FTS columns for the given table. Adds the necessary bound
156 ids to the given 'info' and returns the SQL string. Examples:
157 
158 One indexed column named "text":
159 
160  "$sel0",
161  info/ids: sel0 -> "text"
162 
163 Two indexed columns named "subject" and "content":
164 
165  "$sel0, $sel1",
166  info/ids: sel0 -> "subject", sel1 -> "content",
167 @return heap-allocated WHERE string */
168 UNIV_INTERN
169 const char*
170 fts_get_select_columns_str(
171 /*=======================*/
172 	dict_index_t*	index,		/*!< in: FTS index */
173 	pars_info_t*	info,		/*!< in/out: parser info */
174 	mem_heap_t*	heap)		/*!< in: memory heap */
175 	MY_ATTRIBUTE((nonnull, warn_unused_result));
176 
177 /** define for fts_doc_fetch_by_doc_id() "option" value, defines whether
178 we want to get Doc whose ID is equal to or greater or smaller than supplied
179 ID */
180 #define	FTS_FETCH_DOC_BY_ID_EQUAL	1
181 #define	FTS_FETCH_DOC_BY_ID_LARGE	2
182 #define	FTS_FETCH_DOC_BY_ID_SMALL	3
183 
184 /*************************************************************//**
185 Fetch document (= a single row's indexed text) with the given
186 document id.
187 @return: DB_SUCCESS if fetch is successful, else error */
188 UNIV_INTERN
189 dberr_t
190 fts_doc_fetch_by_doc_id(
191 /*====================*/
192 	fts_get_doc_t*	get_doc,	/*!< in: state */
193 	doc_id_t	doc_id,		/*!< in: id of document to fetch */
194 	dict_index_t*	index_to_use,	/*!< in: caller supplied FTS index,
195 					or NULL */
196 	ulint		option,         /*!< in: search option, if it is
197                                         greater than doc_id or equal */
198 	fts_sql_callback
199 			callback,	/*!< in: callback to read
200 					records */
201 	void*		arg)		/*!< in: callback arg */
202 	MY_ATTRIBUTE((nonnull(6)));
203 
204 /*******************************************************************//**
205 Callback function for fetch that stores the text of an FTS document,
206 converting each column to UTF-16.
207 @return always FALSE */
208 UNIV_INTERN
209 ibool
210 fts_query_expansion_fetch_doc(
211 /*==========================*/
212 	void*		row,		/*!< in: sel_node_t* */
213 	void*		user_arg)	/*!< in: fts_doc_t* */
214 	MY_ATTRIBUTE((nonnull));
215 /********************************************************************
216 Write out a single word's data as new entry/entries in the INDEX table.
217 @return DB_SUCCESS if all OK. */
218 UNIV_INTERN
219 dberr_t
220 fts_write_node(
221 /*===========*/
222 	trx_t*		trx,		/*!< in: transaction */
223 	que_t**		graph,		/*!< in: query graph */
224 	fts_table_t*	fts_table,	/*!< in: the FTS aux index */
225 	fts_string_t*	word,		/*!< in: word in UTF-8 */
226 	fts_node_t*	node)		/*!< in: node columns */
227 	MY_ATTRIBUTE((nonnull, warn_unused_result));
228 /*******************************************************************//**
229 Tokenize a document. */
230 UNIV_INTERN
231 void
232 fts_tokenize_document(
233 /*==================*/
234 	fts_doc_t*	doc,		/*!< in/out: document to
235 					tokenize */
236 	fts_doc_t*	result)		/*!< out: if provided, save
237 					result tokens here */
238 	MY_ATTRIBUTE((nonnull(1)));
239 
240 /*******************************************************************//**
241 Continue to tokenize a document. */
242 UNIV_INTERN
243 void
244 fts_tokenize_document_next(
245 /*=======================*/
246 	fts_doc_t*	doc,		/*!< in/out: document to
247 					tokenize */
248 	ulint		add_pos,	/*!< in: add this position to all
249 					tokens from this tokenization */
250 	fts_doc_t*	result)		/*!< out: if provided, save
251 					result tokens here */
252 	MY_ATTRIBUTE((nonnull(1)));
253 /******************************************************************//**
254 Initialize a document. */
255 UNIV_INTERN
256 void
257 fts_doc_init(
258 /*=========*/
259 	fts_doc_t*	doc)		/*!< in: doc to initialize */
260 	MY_ATTRIBUTE((nonnull));
261 
262 /******************************************************************//**
263 Do a binary search for a doc id in the array
264 @return +ve index if found -ve index where it should be
265         inserted if not found */
266 UNIV_INTERN
267 int
268 fts_bsearch(
269 /*========*/
270 	fts_update_t*	array,		/*!< in: array to sort */
271 	int		lower,		/*!< in: lower bound of array*/
272 	int		upper,		/*!< in: upper bound of array*/
273 	doc_id_t	doc_id)		/*!< in: doc id to lookup */
274 	MY_ATTRIBUTE((nonnull, warn_unused_result));
275 /******************************************************************//**
276 Free document. */
277 UNIV_INTERN
278 void
279 fts_doc_free(
280 /*=========*/
281 	fts_doc_t*	doc)		/*!< in: document */
282 	MY_ATTRIBUTE((nonnull));
283 /******************************************************************//**
284 Free fts_optimizer_word_t instanace.*/
285 UNIV_INTERN
286 void
287 fts_word_free(
288 /*==========*/
289 	fts_word_t*	word)		/*!< in: instance to free.*/
290 	MY_ATTRIBUTE((nonnull));
291 /******************************************************************//**
292 Read the rows from the FTS inde
293 @return DB_SUCCESS or error code */
294 UNIV_INTERN
295 dberr_t
296 fts_index_fetch_nodes(
297 /*==================*/
298 	trx_t*		trx,		/*!< in: transaction */
299 	que_t**		graph,		/*!< in: prepared statement */
300 	fts_table_t*	fts_table,	/*!< in: FTS aux table */
301 	const fts_string_t*
302 			word,		/*!< in: the word to fetch */
303 	fts_fetch_t*	fetch)		/*!< in: fetch callback.*/
304 	MY_ATTRIBUTE((nonnull));
305 /******************************************************************//**
306 Create a fts_optimizer_word_t instance.
307 @return new instance */
308 UNIV_INTERN
309 fts_word_t*
310 fts_word_init(
311 /*==========*/
312 	fts_word_t*	word,		/*!< in: word to initialize */
313 	byte*		utf8,		/*!< in: UTF-8 string */
314 	ulint		len)		/*!< in: length of string in bytes */
315 	MY_ATTRIBUTE((nonnull));
316 /******************************************************************//**
317 Compare two fts_trx_table_t instances, we actually compare the
318 table id's here.
319 @return < 0 if n1 < n2, 0 if n1 == n2, > 0 if n1 > n2 */
320 UNIV_INLINE
321 int
322 fts_trx_table_cmp(
323 /*==============*/
324 	const void*	v1,		/*!< in: id1 */
325 	const void*	v2)		/*!< in: id2 */
326 	MY_ATTRIBUTE((nonnull, warn_unused_result));
327 /******************************************************************//**
328 Compare a table id with a trx_table_t table id.
329 @return < 0 if n1 < n2, 0 if n1 == n2, > 0 if n1 > n2 */
330 UNIV_INLINE
331 int
332 fts_trx_table_id_cmp(
333 /*=================*/
334 	const void*	p1,		/*!< in: id1 */
335 	const void*	p2)		/*!< in: id2 */
336 	MY_ATTRIBUTE((nonnull, warn_unused_result));
337 /******************************************************************//**
338 Commit a transaction.
339 @return DB_SUCCESS if all OK */
340 UNIV_INTERN
341 dberr_t
342 fts_sql_commit(
343 /*===========*/
344 	trx_t*		trx)		/*!< in: transaction */
345 	MY_ATTRIBUTE((nonnull));
346 /******************************************************************//**
347 Rollback a transaction.
348 @return DB_SUCCESS if all OK */
349 UNIV_INTERN
350 dberr_t
351 fts_sql_rollback(
352 /*=============*/
353 	trx_t*		trx)		/*!< in: transaction */
354 	MY_ATTRIBUTE((nonnull));
355 /******************************************************************//**
356 Parse an SQL string. %s is replaced with the table's id. Don't acquire
357 the dict mutex
358 @return query graph */
359 UNIV_INTERN
360 que_t*
361 fts_parse_sql_no_dict_lock(
362 /*=======================*/
363 	fts_table_t*	fts_table,	/*!< in: table with FTS index */
364 	pars_info_t*	info,		/*!< in: parser info */
365 	const char*	sql)		/*!< in: SQL string to evaluate */
366 	MY_ATTRIBUTE((nonnull(3), malloc, warn_unused_result));
367 /******************************************************************//**
368 Get value from config table. The caller must ensure that enough
369 space is allocated for value to hold the column contents
370 @return DB_SUCCESS or error code */
371 UNIV_INTERN
372 dberr_t
373 fts_config_get_value(
374 /*=================*/
375 	trx_t*		trx,		/* transaction */
376 	fts_table_t*	fts_table,	/*!< in: the indexed FTS table */
377 	const char*	name,		/*!< in: get config value for
378 					this parameter name */
379 	fts_string_t*	value)		/*!< out: value read from
380 					config table */
381 	MY_ATTRIBUTE((nonnull));
382 /******************************************************************//**
383 Get value specific to an FTS index from the config table. The caller
384 must ensure that enough space is allocated for value to hold the
385 column contents.
386 @return DB_SUCCESS or error code */
387 UNIV_INTERN
388 dberr_t
389 fts_config_get_index_value(
390 /*=======================*/
391 	trx_t*		trx,		/*!< transaction */
392 	dict_index_t*	index,		/*!< in: index */
393 	const char*	param,		/*!< in: get config value for
394 					this parameter name */
395 	fts_string_t*	value)		/*!< out: value read from
396 					config table */
397 	MY_ATTRIBUTE((nonnull, warn_unused_result));
398 /******************************************************************//**
399 Set the value in the config table for name.
400 @return DB_SUCCESS or error code */
401 UNIV_INTERN
402 dberr_t
403 fts_config_set_value(
404 /*=================*/
405 	trx_t*		trx,		/*!< transaction */
406 	fts_table_t*	fts_table,	/*!< in: the indexed FTS table */
407 	const char*	name,		/*!< in: get config value for
408 					this parameter name */
409 	const fts_string_t*
410 			value)		/*!< in: value to update */
411 	MY_ATTRIBUTE((nonnull));
412 /****************************************************************//**
413 Set an ulint value in the config table.
414 @return DB_SUCCESS if all OK else error code */
415 UNIV_INTERN
416 dberr_t
417 fts_config_set_ulint(
418 /*=================*/
419 	trx_t*		trx,		/*!< in: transaction */
420 	fts_table_t*	fts_table,	/*!< in: the indexed FTS table */
421 	const char*	name,		/*!< in: param name */
422 	ulint		int_value)	/*!< in: value */
423 	MY_ATTRIBUTE((nonnull, warn_unused_result));
424 /******************************************************************//**
425 Set the value specific to an FTS index in the config table.
426 @return DB_SUCCESS or error code */
427 UNIV_INTERN
428 dberr_t
429 fts_config_set_index_value(
430 /*=======================*/
431 	trx_t*		trx,		/*!< transaction */
432 	dict_index_t*	index,		/*!< in: index */
433 	const char*	param,		/*!< in: get config value for
434 					this parameter name */
435 	fts_string_t*	value)		/*!< out: value read from
436 					config table */
437 	MY_ATTRIBUTE((nonnull, warn_unused_result));
438 /******************************************************************//**
439 Increment the value in the config table for column name.
440 @return DB_SUCCESS or error code */
441 UNIV_INTERN
442 dberr_t
443 fts_config_increment_value(
444 /*=======================*/
445 	trx_t*		trx,		/*!< transaction */
446 	fts_table_t*	fts_table,	/*!< in: the indexed FTS table */
447 	const char*	name,		/*!< in: increment config value
448 					for this parameter name */
449 	ulint		delta)		/*!< in: increment by this much */
450 	MY_ATTRIBUTE((nonnull, warn_unused_result));
451 /******************************************************************//**
452 Increment the per index value in the config table for column name.
453 @return DB_SUCCESS or error code */
454 UNIV_INTERN
455 dberr_t
456 fts_config_increment_index_value(
457 /*=============================*/
458 	trx_t*		trx,		/*!< transaction */
459 	dict_index_t*	index,		/*!< in: FTS index */
460 	const char*	name,		/*!< in: increment config value
461 					for this parameter name */
462 	ulint		delta)		/*!< in: increment by this much */
463 	MY_ATTRIBUTE((nonnull));
464 /******************************************************************//**
465 Get an ulint value from the config table.
466 @return DB_SUCCESS or error code */
467 UNIV_INTERN
468 dberr_t
469 fts_config_get_index_ulint(
470 /*=======================*/
471 	trx_t*		trx,		/*!< in: transaction */
472 	dict_index_t*	index,		/*!< in: FTS index */
473 	const char*	name,		/*!< in: param name */
474 	ulint*		int_value)	/*!< out: value */
475 	MY_ATTRIBUTE((nonnull, warn_unused_result));
476 /******************************************************************//**
477 Set an ulint value int the config table.
478 @return DB_SUCCESS or error code */
479 UNIV_INTERN
480 dberr_t
481 fts_config_set_index_ulint(
482 /*=======================*/
483 	trx_t*		trx,		/*!< in: transaction */
484 	dict_index_t*	index,		/*!< in: FTS index */
485 	const char*	name,		/*!< in: param name */
486 	ulint		int_value)	/*!< in: value */
487 	MY_ATTRIBUTE((nonnull, warn_unused_result));
488 /******************************************************************//**
489 Get an ulint value from the config table.
490 @return DB_SUCCESS or error code */
491 UNIV_INTERN
492 dberr_t
493 fts_config_get_ulint(
494 /*=================*/
495 	trx_t*		trx,		/*!< in: transaction */
496 	fts_table_t*	fts_table,	/*!< in: the indexed FTS table */
497 	const char*	name,		/*!< in: param name */
498 	ulint*		int_value)	/*!< out: value */
499 	MY_ATTRIBUTE((nonnull));
500 /******************************************************************//**
501 Search cache for word.
502 @return the word node vector if found else NULL */
503 UNIV_INTERN
504 const ib_vector_t*
505 fts_cache_find_word(
506 /*================*/
507 	const fts_index_cache_t*
508 			index_cache,	/*!< in: cache to search */
509 	const fts_string_t*
510 			text)		/*!< in: word to search for */
511 	MY_ATTRIBUTE((nonnull, warn_unused_result));
512 /******************************************************************//**
513 Check cache for deleted doc id.
514 @return TRUE if deleted */
515 UNIV_INTERN
516 ibool
517 fts_cache_is_deleted_doc_id(
518 /*========================*/
519 	const fts_cache_t*
520 			cache,		/*!< in: cache ito search */
521 	doc_id_t	doc_id)		/*!< in: doc id to search for */
522 	MY_ATTRIBUTE((nonnull, warn_unused_result));
523 /******************************************************************//**
524 Append deleted doc ids to vector and sort the vector. */
525 UNIV_INTERN
526 void
527 fts_cache_append_deleted_doc_ids(
528 /*=============================*/
529 	const fts_cache_t*
530 			cache,		/*!< in: cache to use */
531 	ib_vector_t*	vector);	/*!< in: append to this vector */
532 /******************************************************************//**
533 Wait for the background thread to start. We poll to detect change
534 of state, which is acceptable, since the wait should happen only
535 once during startup.
536 @return true if the thread started else FALSE (i.e timed out) */
537 UNIV_INTERN
538 ibool
539 fts_wait_for_background_thread_to_start(
540 /*====================================*/
541 	dict_table_t*	table,		/*!< in: table to which the thread
542 					is attached */
543 	ulint		max_wait);	/*!< in: time in microseconds, if set
544 					to 0 then it disables timeout
545 					checking */
546 #ifdef FTS_DOC_STATS_DEBUG
547 /******************************************************************//**
548 Get the total number of words in the FTS for a particular FTS index.
549 @return DB_SUCCESS or error code */
550 UNIV_INTERN
551 dberr_t
552 fts_get_total_word_count(
553 /*=====================*/
554 	trx_t*		trx,		/*!< in: transaction */
555 	dict_index_t*	index,		/*!< in: for this index */
556 	ulint*		total)		/*!< out: total words */
557 	MY_ATTRIBUTE((nonnull, warn_unused_result));
558 #endif
559 /******************************************************************//**
560 Search the index specific cache for a particular FTS index.
561 @return the index specific cache else NULL */
562 UNIV_INTERN
563 fts_index_cache_t*
564 fts_find_index_cache(
565 /*================*/
566 	const fts_cache_t*
567 			cache,		/*!< in: cache to search */
568 	const dict_index_t*
569 			index)		/*!< in: index to search for */
570 	MY_ATTRIBUTE((nonnull, warn_unused_result));
571 /******************************************************************//**
572 Write the table id to the given buffer (including final NUL). Buffer must be
573 at least FTS_AUX_MIN_TABLE_ID_LENGTH bytes long.
574 @return	number of bytes written */
575 UNIV_INLINE
576 int
577 fts_write_object_id(
578 /*================*/
579 	ib_id_t		id,		/*!< in: a table/index id */
580 	char*		str,		/*!< in: buffer to write the id to */
581 	bool		hex_format MY_ATTRIBUTE((unused)))
582 					/*!< in: true for fixed hex format,
583 					false for old ambiguous format */
584 	MY_ATTRIBUTE((nonnull));
585 /******************************************************************//**
586 Read the table id from the string generated by fts_write_object_id().
587 @return TRUE if parse successful */
588 UNIV_INLINE
589 ibool
590 fts_read_object_id(
591 /*===============*/
592 	ib_id_t*	id,		/*!< out: a table id */
593 	const char*	str)		/*!< in: buffer to read from */
594 	MY_ATTRIBUTE((nonnull, warn_unused_result));
595 /******************************************************************//**
596 Get the table id.
597 @return number of bytes written */
598 UNIV_INTERN
599 int
600 fts_get_table_id(
601 /*=============*/
602 	const fts_table_t*
603 			fts_table,	/*!< in: FTS Auxiliary table */
604 	char*		table_id)	/*!< out: table id, must be at least
605 					FTS_AUX_MIN_TABLE_ID_LENGTH bytes
606 					long */
607 	MY_ATTRIBUTE((nonnull, warn_unused_result));
608 /******************************************************************//**
609 Add the table to add to the OPTIMIZER's list. */
610 UNIV_INTERN
611 void
612 fts_optimize_add_table(
613 /*===================*/
614 	dict_table_t*	table)		/*!< in: table to add */
615 	MY_ATTRIBUTE((nonnull));
616 /******************************************************************//**
617 Optimize a table. */
618 UNIV_INTERN
619 void
620 fts_optimize_do_table(
621 /*==================*/
622 	dict_table_t*	table)		/*!< in: table to optimize */
623 	MY_ATTRIBUTE((nonnull));
624 /******************************************************************//**
625 Construct the prefix name of an FTS table.
626 @return own: table name, must be freed with mem_free() */
627 UNIV_INTERN
628 char*
629 fts_get_table_name_prefix(
630 /*======================*/
631 	const fts_table_t*
632 			fts_table)	/*!< in: Auxiliary table type */
633 	MY_ATTRIBUTE((nonnull, malloc, warn_unused_result));
634 /******************************************************************//**
635 Add node positions. */
636 UNIV_INTERN
637 void
638 fts_cache_node_add_positions(
639 /*=========================*/
640 	fts_cache_t*	cache,		/*!< in: cache */
641 	fts_node_t*	node,		/*!< in: word node */
642 	doc_id_t	doc_id,		/*!< in: doc id */
643 	ib_vector_t*	positions)	/*!< in: fts_token_t::positions */
644 	MY_ATTRIBUTE((nonnull(2,4)));
645 
646 /******************************************************************//**
647 Create the config table name for retrieving index specific value.
648 @return index config parameter name */
649 UNIV_INTERN
650 char*
651 fts_config_create_index_param_name(
652 /*===============================*/
653 	const char*		param,		/*!< in: base name of param */
654 	const dict_index_t*	index)		/*!< in: index for config */
655 	MY_ATTRIBUTE((nonnull, malloc, warn_unused_result));
656 
657 #ifndef UNIV_NONINL
658 #include "fts0priv.ic"
659 #endif
660 
661 #endif /* INNOBASE_FTS0PRIV_H */
662