Forum

Thread tagged as: Problem

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/
Cormac Kerrigan

Cormac Kerrigan 0 points

  • 4 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

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

  • Agri Connect

…page-style-tl green Agri Connect…

  • Agri Connect
Drew McLellan

Drew McLellan 2638 points
Perch Support

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 :

<div class="<perch:content type="select" id="pageSelector" label="Select Page Style" order="1" options="Toplevel|page-style-tl, Sublevel|page-style-sl" /> <perch:content type="select" id="selector" label="Select Page Colour" order="1" options="Dark Blue|dark-blue, Blue|blue, Navy|navy, Dark Grey|dark-grey, Grey|grey, Black|black, Orange|orange, Purple|purple, Teal|teal, Green|green, Turquoise|turquoise" />">
<div class="banner" style="background-image:url('<perch:content type="image" id="bannerImage" label="Banner Image" help="Leave this field blank for" />'); background-position: 50% 50%; background-size: cover;"><div class="overlay"></div><img class="corner-graphic tl-corner" sizes="(max-width: 991px) 40vw, 20vw" src="/images/corner-graphic-navy.png" srcset="/images/corner-graphic-navy-p-500.png 500w, /images/corner-graphic-navy-p-800.png 800w, /images/corner-graphic-navy-p-1080.png 1080w, /images/corner-graphic-navy.png 1167w">
<div class="container">
<div class="w-row">
<div class="col-1 w-clearfix w-col w-col-6">

<perch:content type="textarea" editor="redactor" html="true" id="introText" label="Intro Text" />

</div>
<div class="col-2 display-none w-col w-col-6"></div>
</div>
</div>
</div>
Drew McLellan

Drew McLellan 2638 points
Perch Support

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.

Drew McLellan

Drew McLellan 2638 points
Perch Support

You've made the classes editable within the content management system - therefore they're content. That's all.