I'm trying to modify the code for fullpath retrieval from this post: http://mikehillyer.com/articles/managing-hierarchical-data-in-mysql/ in nested-set model to use FULLTEXT instead of exact match.
Here's what I want: I want to obtain best match for searched from MATCH() AGAINST() and than use '=' sign to find only this one result.
Here's what I've tried:
DELIMITER //
DROP PROCEDURE IF EXISTS find_node;
//
CREATE DEFINER = CURRENT_USER PROCEDURE find_node (
IN searched TEXT
)
proc: BEGIN
SELECT DISTINCT parent.content
FROM tree AS node,
tree AS parent
WHERE node.lft BETWEEN parent.lft AND parent.rgt
AND node.content = (SELECT content FROM tree WHERE MATCH(node.content) AGAINST(searched IN BOOLEAN MODE) LIMIT 1)
ORDER BY parent.lft;
END //
DELIMITER ;
Line beggining with AND node.content, but it seems that it's not returning any results after running the procedure. I would like to be able to obtain second, third and n best match as well (maybe using LIMIT 1 OFFSET n, where n is a result number?).
Thanks for your help