Question:
How do I modify SimpleSearch results to exclude metadata?
Do I need to write a custom function to exclude the search results keywords?
Issue:
SimplesSearch is picking up code source (metadata) i.e. “label=mentor”
I have already tried but unsuccessful to get the results I want:
- [[!SimpleSearch? &tpl=
search-results-body
&exclude=26,76,81,92,96,105,158,159,160,161,162,163,164,165,166,167,168,169,170,233,235,243,257
]]
- Unchecking “Searchable” in settings for pages i deleted.
Context:
After deleting/removing Resources pages from my website. I want to make sure the metadata from the deleted pages will not show up on a search that uses SimpleSearch. Currently, I am still getting results.
Are you saying SimpleSearch is still showing resources, which you say you have deleted?
I don’t think SimpleSearch can find deleted resources.
How is the meta data added to the resource? Are you using an extra, or a snippet, to add meta data to your resources, or to associate meta data with resources. Or is the metadata simply added to the standard MODX fields?
Overall I think I need to write an exclusion in SimpleSearch to ignore/exclude any metadata with keyword “mentor” . But need help writing one.
things i have done:
- uncheck Searchable in settings for Mentor pages
- deleted Mentor page
- add Mentor page id to SimpleSearch &exclude.
@bruno17 , it is not showing resources from pages that were deleted (Mentor page) but it is picking up mentor metadata and return it on the results page.
@andytough , the metadata is coming from html/head/script called googleAnalytics (a Chunk). When I check googleAnalytics it uses something called analyticsCrossDomain (a Snippet). When I check analyticsCrossDomain it reference/points to env.inc.php file that is found in my root folder src/core/config/env.inc.php. The env.inc.php does not reference any metadata
SimpleSearch only searches in certain fields of the resource for the search term. By default these fields are pagetitle,longtitle,alias,description,introtext,content
(but you can change this with the property &docFields
).
If I understand you correctly, then the keyword “mentor” is located in the <head>
-section of your html code which is usually in the template of a page. But the template isn’t included in the search.
So I’m a bit confused.
Where is this chunk “googleAnalytics” placed in your page? In the content?