Forum

Thread tagged as: Question, Events, Suggestions

Customize Search Results for the Events App

Hi,

I'm adding a search for the Perch Events app. Results are coming in fine and it was easy to setup.

Had some questions regarding how much customization we can have on the search results at this point in time. I understand its a basic text search and wanted to explore what's possible.

  1. Can I customize how search title field <perch:search id="title" /> displays or add other event fields in search results. For example, is it possible to display eventTitle and eventDateTime wrapped in its own markup?
  2. I see <perch:search id="title" /> and <perch:search id="excerpt" />. Could we return other text fields or thumbnails used in a template or is it limited to eventTitle, eventDateTime, and, I think, eventDescHTML in the excerpt?
  3. Can I customize format of eventDateTime? so a date could display June 20, 2015 instead of 20 Jun 2015. It's an American thing.
  4. Can I filter search results to display past events as well as upcoming events?
  5. Does paging show up depending on # of results automatically and split depending on count number set. I don't see an option for paging on the search template docs

Here is code on search page to display results


<?php $query = perch_get('q'); $opts = array( 'count'=>5, 'excerpt-chars'=>300, 'sort'=>'eventDateTime', 'sort-order'=>'ASC', 'apps' => array('PerchEvents'), 'template'=>'search-result-events.html', ); perch_content_search($query, $opts); ?>

Here is what <perch:showall /> displays for a sample event when I search on the term 'water'.


ID Value perch_page_path /events/search.php url 442 title Women and Water in the Developing World - 18 Jun 2015 excerpt In developing countries, women traditionally collect the water needed for drinking, washing,{...} key water source PerchEvents result_url 442 result_title Women and Water in the Developing World - 18 Jun 2015 result_excerpt In developing countries, women traditionally collect the water needed for drinking, washing,{...} result_key water result_source PerchEvents search_key water paging false total 2 number_of_pages 1 total_pages 1 per_page 5 current_page 1 lower_bound 1 upper_bound 2 prev_url next_url prev_page_number next_page_number perch_item_first true perch_item_zero_index 0 perch_item_index 1 perch_item_rev_index 2 perch_item_rev_zero_index 1 perch_item_odd perch_item_count 2 perch_namespace perch:search

Here are my diagnotics

Diagnostics report
HEALTH CHECK

Perch Runway is up to date
PHP 5.4.39 version is okay, but a little out of date. Consider updating soon.
MySQL 5.5.42 is up to date
Image processing available
SUMMARY INFORMATION

Perch Runway: 2.8.8, PHP: 5.4.39, MySQL: mysqlnd 5.0.10 - 20111026 - $Id: c85105d7c6f7d70d609bb4c000257868a40840ab $, with PDO
Server OS: Darwin, apache2handler
Installed apps: content (2.8.8), assets (2.8.8), categories (2.8.8), collection_4 (2.8.8), perch_events (1.9.2), collection_1 (2.8.8), collection_5 (2.8.8), perch_podcasts (1.1)
App runtimes: <?php $apps_list = array( 'content', 'categories', 'perch_events', 'perch_podcasts', ); ?>
PERCH_LOGINPATH: /perch
PERCH_PATH: /Users/scottgruber/git/ioes-site/perch
PERCH_CORE: /Users/scottgruber/git/ioes-site/perch/core
PERCH_RESFILEPATH: /Users/scottgruber/git/ioes-site/perch/resources
Image manipulation: GD Imagick
PHP limits: Max upload 32M, Max POST 32M, Memory: 256M, Total max file upload: 32M
Resource folder writeable: Yes
HTTP_HOST: dev.environment.ucla.edu:8888
DOCUMENT_ROOT: /Users/scottgruber/git/ioes-site
REQUEST_URI: /perch/core/settings/diagnostics/
SCRIPT_NAME: /perch/core/settings/diagnostics/index.php
Scott Gruber

Scott Gruber 0 points

  • 6 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Can I customize how search title field <perch:search id="title" /> displays or add other event fields in search results. For example, is it possible to display eventTitle and eventDateTime wrapped in its own markup?

Yes, I think so, but I'm checking into it.

I see <perch:search id="title" /> and <perch:search id="excerpt" />. Could we return other text fields or thumbnails used in a template or is it limited to eventTitle, eventDateTime, and, I think, eventDescHTML in the excerpt?

I think this is the same as the first question, isn't it? Or have I missed the point?

Can I customize format of eventDateTime? so a date could display June 20, 2015 instead of 20 Jun 2015. It's an American thing.

Yes, use the format attribute.

Can I filter search results to display past events as well as upcoming events?

I'll check.

Does paging show up depending on # of results automatically and split depending on count number set. I don't see an option for paging on the search template docs

It should be the same as everywhere - the count option.

Yes, the second question was a rephrase of the first.