Hello!
Im trying to replicate the search functionality of manticore documentation, such that as i write i can see the matching results highlighted like so:
So far I have been able to implement the HIGHLIGHT function with partial success.
I created my table like this:
CREATE TABLE ITEMS(
id bigint,
itemid text,
displayname text,
brand text,
lastmodifieddate timestamp
)
min_prefix_len = '1'
min_infix_len = '2'
ngram_len = '1'
charset_table = 'non_cjk, 0..9'
ngram_chars = 'cont';
the following is my query and the result i get
mysql> SELECT HIGHLIGHT({},'displayname' ,'contain*') FROM items WHERE MATCH('contain*');
+-------------------------------------------+
| highlight({},'displayname' ,'contain*') |
+-------------------------------------------+
| SK AISLE <b>CONTAINMENT</b>, DOOR, 1200MM |
| HOPPER <b>CONTAINER</b> - 7L |
| CHAIN <b>CONTAINER</b> |
| HOPPER <b>CONTAINER</b> - 14L |
| HOPPER <b>CONTAINER</b> - 3L |
+-------------------------------------------+
At the moment this works for me but it would be great if i can get the following output:
mysql> SELECT HIGHLIGHT({},'displayname' ,'contain*') FROM items WHERE MATCH('contain*');
+-------------------------------------------+
| highlight({},'displayname' ,'contain*') |
+-------------------------------------------+
| SK AISLE <b>CONTAIN</b>MENT, DOOR, 1200MM |
| HOPPER <b>CONTAIN</b>ER - 7L |
| CHAIN <b>CONTAIN</b>ER |
| HOPPER <b>CONTAIN</b>ER - 14L |
| HOPPER <b>CONTAIN</b>ER - 3L |
+-------------------------------------------+
I have read several times the documentation but so far I have been unable to figure out the solution.