Forum

Thread tagged as: Problem

Search functionality isn't working properly?

I've used the same search functionality across a bunch of different sites, but for some reason I can't get it to work on my testing server.

  • I have the search folder in the templates area of the perch directory
  • I have the search.php in my blog folder
  • When I enter something into the search form it goes to the search results page but it keeps saying "Sorry, there are no results for xxxx" Even though I'm confident there are multiple results for the search query.

The only thing different about this set up is I'm using the mailchimp and the members app, but other than that nothing has changed. Does anyone know the best place to start figuring this out? It is probably something on my end but I'm currently at a loss.

Below is my extended Diagnostic Report

Perch: 3.1.1
Production mode: Production (100)
Installed apps: content (3.1.1), assets (3.1.1), categories (3.1.1), perch_blog (5.6.1), perch_forms (1.11), perch_gallery (2.8.9), perch_kraken (1.1), perch_members (1.6.4), perch_backup (1.2), perch_mailchimp (3.1)
DB driver: PDO
DB tables: perch3_blog_authors (1), perch3_blog_comments (0), perch3_blog_index (53), perch3_blog_posts (1), perch3_blog_posts_to_tags (1), perch3_blog_sections (1), perch3_blog_tags (1), perch3_blog_webmention_queue (0), perch3_blogs (1), perch3_categories (0), perch3_category_counts (0), perch3_category_sets (2), perch3_content_index (554), perch3_content_items (232), perch3_content_regions (75), perch3_events (1), perch3_events_categories (0), perch3_events_to_categories (0), perch3_forms (3), perch3_forms_responses (11), perch3_menu_items (16), perch3_navigation (0), perch3_navigation_pages (0), perch3_page_templates (0), perch3_pages (20), perch3_resource_log (294), perch3_resource_tags (36), perch3_resources (173), perch3_resources_to_tags (72), perch3_settings (42), perch3_user_passwords (0), perch3_user_privileges (42), perch3_user_role_privileges (2), perch3_user_roles (2), perch3_users (1)
Users: 1
App runtimes:
<?php
     $apps_list = [ 
        'perch_blog',
        'perch_gallery',
        'perch_forms',
        'perch_mailchimp',
        'perch_members',
    ];
Scheduled tasks for perch_blog: delete_spam_comments (1440 mins), publish_posts (1 mins), process_webmentions (1 mins)
Scheduled tasks for perch_mailchimp: import_data (1 mins)
Editor plug-ins: ckeditor
H1: 412578392029211dbe356be522c89f9a
L1: 8204bba57efa118b4fa754635ac31d7a
F1: 3b606135b33e6a102526838f4152a807
headerColour: #c0c0c0
content_singlePageEdit: 1
helpURL:
hideBranding: 1
content_collapseList: 1
lang: en-gb
installedAt: 3.1.1
update_3.1.1: done
latest_version:
on_sale_version: 3.1.1
headerScheme: dark
perch_backup_mysqldump_path:
perch_blog_site_name:
perch_blog_post_url: /blog/{postSlug}
perch_blog_slug_format: {postTitle}-%m-%Y
perch_blog_max_spam_days: 0
perch_gallery_bucket_mode: single
perch_gallery_bucket: default
perch_kraken_api_key:
perch_kraken_api_secret:
perch_kraken_dev_mode: 1
dashboard: 1
sidebar_back_link: 1
hide_pwd_reset: 0
keyboardShortcuts: 0
content_hideNonEditableRegions: 0
content_frontend_edit: 0
content_skip_region_list: 0
assets_restrict_buckets: 0
perch_blog_comment_notify: 0
perch_blog_webmention_tx: 0
perch_blog_webmention_rx: 0
perch_gallery_basicUpload: 0
siteURL: localhost/testingserver1/
perch_kraken_url: https://localhost/testingserver1/
perch_mailchimp_api_key:
perch_mailchimp_campaign_url: /mailchimp/campaign/{campaignSlug}
perch_events_update: 1.8
perch_blog_akismet_key: f0b83eafcd93
perch_members_login_page: /members/login.php?r={returnURL}
logoPath: /_cms/resources/logosquare.png
perch_blog_update: 5.6
PERCH_DEVELOPMENT: 10
PERCH_STAGING: 50
PERCH_PRODUCTION: 100
PERCH_DB_USERNAME: worktest_mvach
PERCH_DB_SERVER: localhost
PERCH_DB_DATABASE: worktest_perch
PERCH_DB_PREFIX: perch3_
PERCH_TZ: America/Denver
PERCH_DATE_LONG: %b, %e %Y
PERCH_DATE_SHORT: %b, %e %Y
PERCH_TIME_LONG : %I:%M %P
PERCH_TIME_SHORT: %I:%M %P
PERCH_EMAIL_FROM: matt@coloradoseodesign.com
PERCH_EMAIL_FROM_NAME: Matt Holovach
PERCH_LOGINPATH: /_cms
PERCH_PATH: /home/worktest1/public_html/_cms
PERCH_CORE: /home/worktest1/public_html/_cms/core
PERCH_RESFILEPATH: /home/worktest1/public_html/_cms/resources
PERCH_RESPATH: /_cms/resources
PERCH_HTML5: 1
PERCH_GMAPS_API_KEY: AIzaSyDYTD76SL7jnc5XDL2_vREg0rLShNqZ2Sc
PERCH_RWD: 1
PERCH_SCHEDULE_SECRET: wildcats
PERCH_RUNWAY:
PERCH_ERROR_MODE: DIE
PERCH_TIME_LONG: %H:%M:%S
PERCH_RUNWAY_ROUTED:
PERCH_STRONG_PASSWORDS:
PERCH_ASSET_VERSION: 8255e4c4a367cfa3e2bd
PERCH_DEBUG:
PERCH_PREVIEW_ARG: preview
PERCH_TEMPLATE_PATH: /home/worktest1/public_html/_cms/templates
PERCH_TEMPLATE_FILTERS:
PERCH_DEFAULT_DOC: index.php
PERCH_DEFAULT_EXT: .php
PERCH_PRODUCTION_MODE: 100
PERCH_XHTML_MARKUP:
PERCH_HTML_ENTITIES:
PERCH_SSL:
PERCH_STRIPSLASHES:
PERCH_PROGRESSIVE_FLUSH: 1
PERCH_PARANOID:
PERCH_FORCE_SECURE_COOKIES:
PERCH_DEFAULT_BUCKET: default
PERCH_TRANSLATION_ASSIST:
PERCH_PASSWORD_MIN_LENGTH: 6
PERCH_MAX_FAILED_LOGINS: 10
PERCH_AUTH_LOCKOUT_DURATION: 1 HOUR
PERCH_VERIFY_UPLOADS:
PERCH_PRIV_ASSIST:
PERCH_CUSTOM_EDITOR_CONFIGS:
PERCH_ENABLE_EXIF: 1
PERCH_AUTH_PLUGIN:
PERCH_DB_CHARSET: utf8
PERCH_DB_PORT:
PERCH_DB_SOCKET:
PERCH_APPS_EDITOR_PLUGIN: markitup
PERCH_APPS_EDITOR_MARKUP_LANGUAGE: markdown
Hosting settings
PHP: 5.4.45
Zend: 2.4.0
OS: Linux
SAPI: cgi-fcgi
Safe mode: not detected
MySQL client: 5.5.51-38.2
MySQL server: 5.5.51-38.2
Free disk space: 65.73 GB
Extensions: Core, date, ereg, libxml, openssl, pcre, sqlite3, zlib, bcmath, bz2, calendar, ctype, curl, dom, hash, fileinfo, filter, ftp, gd, gettext, gmp, SPL, iconv, session, intl, json, mbstring, mcrypt, mssql, mysql, mysqli, odbc, standard, PDO, pdo_mysql, pdo_sqlite, Phar, posix, pspell, Reflection, imap, SimpleXML, soap, sockets, exif, tidy, tokenizer, wddx, xml, xmlreader, xmlrpc, xmlwriter, xsl, zip, cgi-fcgi, imagick, SourceGuardian, mhash, ionCube Loader, Zend Guard Loader
GD: Yes
ImageMagick: Yes
PHP max upload size: 64M
PHP max form post size: 64M
PHP memory limit: 256M
Total max uploadable file size: 64M
Resource folder writeable: Yes
Session timeout: 24 minutes
Native JSON: Yes
Filter functions: Yes
Transliteration functions: Yes
DOCUMENT_ROOT: /home/worktest1/public_html
GATEWAY_INTERFACE: CGI/1.1
HTTP_ACCEPT: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8
HTTP_ACCEPT_ENCODING: gzip, deflate
HTTP_ACCEPT_LANGUAGE: en-US,en;q=0.9
HTTP_COOKIE: _ga=GA1.2.146471284.1526305131; _gid=GA1.2.27939080.1527389802; PHPSESSID=9b3d3d952c72522add8d7f0b472c1102; cmsa=1
HTTP_HOST: testingserver1.work
HTTP_REFERER: https://testingserver1.work/_cms/core/settings/diagnostics/
HTTP_UPGRADE_INSECURE_REQUESTS: 1
HTTP_USER_AGENT: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.189 Safari/537.36 Vivaldi/1.95.1077.60
HTTP_X_HTTP_PROTO: HTTP/1.1
HTTP_X_REAL_IP: 67.177.206.242
PATH: /bin:/usr/bin
QUERY_STRING: extended
REDIRECT_STATUS: 200
REMOTE_ADDR: 67.177.206.242
REMOTE_PORT: 58639
REQUEST_METHOD: GET
REQUEST_URI: /_cms/core/settings/diagnostics/?extended
SCRIPT_FILENAME: /home/worktest1/public_html/_cms/core/settings/diagnostics/index.php
SCRIPT_NAME: /_cms/core/settings/diagnostics/index.php
SERVER_ADDR: 50.87.153.155
SERVER_ADMIN: webmaster@testingserver1.work
SERVER_NAME: testingserver1.work
SERVER_PORT: 80
SERVER_PROTOCOL: HTTP/1.1
SERVER_SIGNATURE: <address>Apache Server at testingserver1.work Port 80</address>
SERVER_SOFTWARE: Apache
UNIQUE_ID: Wwr@CTJXmGkADqlYN@AAAAER
PHP_SELF: /_cms/core/settings/diagnostics/index.php
REQUEST_TIME_FLOAT: 1527447049.79
REQUEST_TIME: 1527447049
argc: 1
Matt Holovach

Matt Holovach 0 points

  • 3 years ago
Rachel Andrew

Rachel Andrew 394 points
Perch Support

What do you get when you enable debug and search?

This is what I have from the debug

Debug Message - Perch 3.1.1
[42] SELECT DISTINCT settingID, settingValue FROM perch3_settings WHERE userID=0
[1] SELECT * FROM perch3_pages WHERE pagePath='/blog/search.php' LIMIT 1
Search term: Smokin
SELECT SQL_CALC_FOUND_ROWS DISTINCT 'PerchContent_SearchHandler' AS source, MATCH(ci.itemSearch) AGAINST('Smokin') AS score, r.regionPage AS col1, ci.itemSearch AS col2, ci.itemJSON AS col3, r.regionOptions AS col4, p.pageNavText AS col5, p.pageTitle AS col6, regionTemplate AS col7, r.regionKey AS col8 FROM perch3_content_regions r, perch3_content_items ci, perch3_pages p WHERE r.regionID=ci.regionID AND r.regionRev=ci.itemRev AND r.pageID=p.pageID AND r.regionPage!='*' AND r.regionSearchable=1 AND (MATCH(ci.itemSearch) AGAINST('Smokin') OR MATCH(ci.itemSearch) AGAINST('Smokin') ) AND (r.regionPage LIKE '/%') UNION SELECT 'PerchBlog_SearchHandler' AS source, MATCH(postTitle, postDescRaw, postTags) AGAINST('Smokin') AS score, postTitle, postSlug, postDateTime, postDescHTML, postID, sectionSlug, "", "" FROM perch3_blog_posts p, perch3_blog_sections s WHERE postStatus='Published' AND postDateTime<'2018-05-27 13:36:28' AND p.sectionID=s.sectionID AND MATCH(postTitle, postDescRaw, postTags) AGAINST('Smokin') UNION SELECT 'PerchMailchimp_SearchHandler' AS source, MATCH(campaignSubject, campaignHTML) AGAINST('Smokin') AS score, campaignSubject, campaignSlug, campaignSendTime, campaignText, campaignID, "", "", "" FROM perch3_mailchimp_campaigns mcc, perch3_mailchimp_lists mcl WHERE mcc.listID=mcl.listID AND mcl.listPublic=1 AND mcl.listSearchable=1 AND MATCH(campaignSubject, campaignHTML) AGAINST('Smokin') ORDER BY score DESC LIMIT 0, 10
Invalid query: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'worktest_perch.perch3_mailchimp_campaigns' doesn't exist
SELECT SQL_CALC_FOUND_ROWS DISTINCT 'PerchContent_SearchHandler' AS source, 0-(LENGTH(r.regionPage)-LENGTH(REPLACE(r.regionPage, '/', ''))) AS score, r.regionPage AS col1, ci.itemSearch AS col2, ci.itemJSON AS col3, r.regionOptions AS col4, p.pageNavText AS col5, p.pageTitle AS col6, regionTemplate AS col7, r.regionKey AS col8 FROM perch3_content_regions r, perch3_content_items ci, perch3_pages p WHERE r.regionID=ci.regionID AND r.regionRev=ci.itemRev AND r.pageID=p.pageID AND r.regionPage!='*' AND r.regionSearchable=1 AND ci.itemSearch REGEXP '[[:<:]]Smokin[[:>:]]' AND (r.regionPage LIKE '/%') UNION SELECT 'PerchBlog_SearchHandler' AS source, postDateTime AS score, postTitle, postSlug, postDateTime, postDescHTML, postID, sectionSlug, "", "" FROM perch3_blog_posts p, perch3_blog_sections s WHERE postStatus='Published' AND postDateTime<'2018-05-27 13:36:28' AND p.sectionID=s.sectionID AND ( concat(" ", postTitle, " ") REGEXP '[[:<:]]Smokin[[:>:]]' OR concat(" ", postDescRaw, " ") REGEXP '[[:<:]]Smokin[[:>:]]' OR concat(" ", postTags, " ") REGEXP '[[:<:]]Smokin[[:>:]]' ) UNION SELECT 'PerchMailchimp_SearchHandler' AS source, campaignSendTime AS score, campaignSubject, campaignSlug, campaignSendTime, campaignText, campaignID, "", "", "" FROM perch3_mailchimp_campaigns mcc, perch3_mailchimp_lists mcl WHERE mcc.listID=mcl.listID AND mcl.listPublic=1 AND mcl.listSearchable=1 AND ( concat(" ", campaignSubject, " ") REGEXP '[[:<:]]Smokin[[:>:]]' OR concat(" ", campaignHTML, " ") REGEXP '[[:<:]]Smokin[[:>:]]' ) ORDER BY score ASC LIMIT 0, 10
Invalid query: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'worktest_perch.perch3_mailchimp_campaigns' doesn't exist
[0] SELECT FOUND_ROWS() AS `count`
Using template: /templates/search/search-result.html
Using template: /templates/search/search-form.html
[1] SELECT regionID, regionTemplate, regionPage, regionRev AS rev FROM perch3_content_regions WHERE regionKey='Google Analytics' AND (regionPage='/blog/search.php' OR regionPage='*')
[1] SELECT * FROM ( SELECT idx.itemID, c.regionID, idx.pageID, c.itemJSON, idx2.indexValue as sortval FROM perch3_content_index idx JOIN perch3_content_items c ON idx.itemID=c.itemID AND idx.itemRev=c.itemRev AND idx.regionID=c.regionID JOIN perch3_content_index idx2 ON idx.itemID=idx2.itemID AND idx.itemRev=idx2.itemRev AND idx2.indexKey='_order' WHERE ((idx.regionID=12 AND idx.itemRev=3)) AND idx.itemID=idx2.itemID AND idx.itemRev=idx2.itemRev ) as tbl GROUP BY itemID, pageID, itemJSON, sortval, regionID ORDER BY sortval ASC
[1] Using template: /templates/content/block-google.html
[1] SELECT * FROM ( SELECT idx.itemID, c.regionID, idx.pageID, c.itemJSON, idx2.indexValue as sortval FROM perch3_content_index idx JOIN perch3_content_items c ON idx.itemID=c.itemID AND idx.itemRev=c.itemRev AND idx.regionID=c.regionID JOIN perch3_content_index idx2 ON idx.itemID=idx2.itemID AND idx.itemRev=idx2.itemRev AND idx2.indexKey='_order' WHERE ((idx.regionID=12 AND idx.itemRev=3)) AND idx.itemID=idx2.itemID AND idx.itemRev=idx2.itemRev ) as tbl GROUP BY itemID, pageID, itemJSON, sortval, regionID ORDER BY sortval ASC
[1] Using template: /templates/content/block-google.html

It looks like there is an issue between the search functionality and the Mailchimp app. Here is the main item in red in the debug and it shows up twice? I could be wrong but it kind of looks that way. I currently have mailchimp installed but I don't have a campaign active because I'm waiting the credentials from my client.

Invalid query: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'worktest_perch.perch3_mailchimp_campaigns' doesn't exist
Rachel Andrew

Rachel Andrew 394 points
Perch Support

Have you visited the MailChimp App in admin so it can install?

Yes I have visited the app but I don't have a list in the system yet. I'm waiting on getting the API key but I need my clients credentials to get them.

I will wait to test search again until after I have implemented the list in Mail Chimp. It appears like that is the issue. Have a great day.