Forum
Perch Search pulling in everything
I've got Perch search working on a website using the default search templates. However it appears to pull in everything to the results page....? i.e. it displays text results for a search query but it will pull in class names, etc... is there a way to limit this to only content?
Perch: 3.0.8, PHP: 7.1.1, MySQL: mysqlnd 5.0.12-dev - 20150407 - $Id: b396954eeb2d1d9ed7902b8bae237b287f21ad9e $, with PDO
Server OS: Darwin, apache2handler
Installed apps: content (3.0.8), assets (3.0.8), categories (3.0.8), perch_blog (5.5.1)
App runtimes: <?php $apps_list = array( 'content', 'categories', 'perch_blog', );
PERCH_LOGINPATH: /perch
PERCH_PATH: /Applications/MAMP/htdocs/perch
PERCH_CORE: /Applications/MAMP/htdocs/perch/core
PERCH_RESFILEPATH: /Applications/MAMP/htdocs/perch/resources
Image manipulation: GD
PHP limits: Max upload 32M, Max POST 32M, Memory: 128M, Total max file upload: 32M
F1: 0c66c2e1f82f9e0b7617b2cb8270f2c7
Resource folder writeable: Yes
HTTP_HOST: localhost:8888
DOCUMENT_ROOT: /Applications/MAMP/htdocs
REQUEST_URI: /perch/core/settings/diagnostics/
Can you give an example?
Not really Drew without screenshots... but safe to say if I search for the term 'Agri' My results page presents several instances where this word has been found and links to the appropriate pages. That's all fine bar the string in the middle (…page-style-tl green) is a div class that controls background-color and is hard-coded into the page. It seems odd to be picking this up and would surely confuse an end user?
example
…page-style-tl green Agri Connect…
If it's hardcoded into the page, I'm not sure how Perch would have it. Are you sure it's not part of your content?
Hi Drew. There's limited content in the pages as it is bar headings and lorem ipsum text. Also, the page has a number of background-color options. It looks like Perch is not getting anything in it's search and taking the option selects' class name as a search result. It is definitely not picking up this from content. If there was a way to prevent search doing this...? otherwise I'm going to have to instruct the client to fill out their website with expected content and monitor how to search function then reacts. here is the template that's calling the class options for the page style :
You've defined those classes as content, so Perch is searching them like content. By default, it has no way to know it's not visible content.
If you don't want a field to be searchable, you need to declare it with
searchable="false"
Thanks Drew! that seems to have fixed the problem. However, when you say I've 'defined them as content', how do you mean? To me that's a div with multiple class options that's using perch select to pick background colors. It seems to be happening to the select items only. Don't really understand how this is seen as content.
You've made the classes editable within the content management system - therefore they're content. That's all.