Extract of
MySQL manual:
By default, the MATCH() function performs a natural language search for a string against a text collection. A collection is a set of one or more columns included in a FULLTEXT index. The search string is given as the argument to AGAINST(). For each row in the table, MATCH() returns a relevance value; that is, a similarity measure between the search string and the text in that row in the columns named in the MATCH() list.
I did some tests regarding the full text search with ajaxSearch and my first conclusions is that the correct form of the sql statement should looks like:
SELECT DISTINCT sc.id, sc.pagetitle, sc.description, sc.content,sc.introtext , MATCH (sc.pagetitle, sc.longtitle, sc.description, sc.introtext, sc.content) AGAINST ('muraille de chine') AS score
FROM `modx_site_content` sc LEFT JOIN `modx_site_tmplvar_contentvalues` stc ON sc.id = stc.contentid
WHERE ( MATCH (sc.pagetitle, sc.longtitle, sc.description, sc.introtext, sc.content) AGAINST ('muraille de chine')
OR MATCH (stc.value) AGAINST ('muraille de chine') )
AND sc.privateweb = 0
AND sc.published = 1
AND sc.searchable=1
AND sc.deleted=0
ORDER BY score DESC(muraille de chine = china wall)
But for the moment the fulltext index define on modx_site_content is:
FULLTEXT KEY `content_ft_idx` (`pagetitle`,`description`,`content`)
and for modx_site_tmplvar_contentvalues it doesn’t exist a FULLTEXT KEY. The same for modx_jot_content regarding the content field (some guys asks for a search in the jot comments as in the TVs)
So I have some questions ...
How have been defined the FULLTEXT Key of Modx tables and does it possible to plan some changes ?
For example to add the fields longtitle and introtext in the index of modx_site_content
And create a new one for the modx_site_tmplvar_contentvalues ?
And obviously how could we evaluate the impacts of these changes on the database volume ?
Any ideas & remarks ? Feed backs about these points are welcome