And is there any way to return a defined TV as part of the search result?Unfortunately not. Adds the TV value as field returned by the FROM ... LEFT JOIN select statement will bring as much as records than the number of different TVs linked with a document record which match a search word. So for performance reasons, it is not planed today to display the content of the TVs. Just the document fields.
search "card word" - useAllWords = '0', searchStyle = 'partial' SELECT DISTINCT sc.id, sc.pagetitle, sc.description, sc.content, sc.introtext, sc.longtitle FROM `modx_site_content` sc LEFT JOIN `modx_site_tmplvar_contentvalues` stc ON sc.id = stc.contentid WHERE ( (sc.pagetitle LIKE '%card world%' OR sc.description LIKE '%card world%' OR sc.content LIKE '%card%' OR sc.introtext LIKE '%card%' OR stc.value LIKE '%card%') OR (sc.pagetitle LIKE '%card world%' OR sc.description LIKE '%card world%' OR sc.content LIKE '%world%' OR sc.introtext LIKE '%world%' OR stc.value LIKE '%world%')
this could be done by getting only the ids from the search Query and then execute ditto to grab the required fieldsUse ditto to compensate the lack of a feature in ajaxSearch (display of tv values) is IMHO a little bit excessive and probably not performant
SELECT DISTINCT sc.id, sc.pagetitle, sc.description, sc.content, sc.introtext, sc.longtitle FROM `modx_site_content` sc LEFT JOIN `modx_site_tmplvar_contentvalues` stc ON sc.id = stc.contentid WHERE ( sc.pagetitle LIKE '%card' OR sc.description LIKE '%card' OR sc.content LIKE '%card%' OR sc.introtext LIKE '%card%' OR stc.value LIKE '%card%');
SELECT sc.id, sc.pagetitle, sc.description, sc.content, sc.introtext, sc.longtitle, stc.value FROM `modx_site_content` sc, `modx_site_tmplvar_contentvalues` stc WHERE stc.value LIKE '%card%' AND sc.id = stc.contentid UNION SELECT sc.id, sc.pagetitle, sc.description, sc.content, sc.introtext, sc.longtitle, "" FROM `modx_site_content` sc WHERE ( sc.pagetitle LIKE '%card' OR sc.description LIKE '%card' OR sc.content LIKE '%card%' OR sc.introtext LIKE '%card%') AND NOT EXISTS ( SELECT stc.value FROM `modx_site_tmplvar_contentvalues` stc WHERE stc.value LIKE '%card%' AND sc.id = stc.contentid ) ORDER BY value;
This discussion is closed to further replies. Keep calm and carry on.