Naviga Web
Docs Home
  • Introduction
  • Release notes
  • Starter kit
    • Introduction
    • Environment Variables
    • Makefile
    • Changelog
    • API
  • Feature: Advanced Search
    • User guide
    • Search Help
    • How to Setup
    • Technical Details
  • Developer documentation
    • Developer prerequisites
      • Developer hardware suggestions
      • Setup on Windows
      • Setup on Linux/Ubuntu
    • Getting started with development
      • Composer package management
      • Gulp and asset building (optional)
      • Git
      • Hosts file
      • Certificate
      • Initiate Naviga Web
      • Start Naviga Web
      • Bin scripts
      • Create theme
      • Environments
      • Deployment
      • Onboarding tasks
        • #0 - New site
        • #1 - Configuration
        • #2 - Front page
        • #3 - Content presentation
        • #4 - OC List
        • #5 - Content containers
        • #6 - Teaser template
        • #7 - Single article
        • #8 - Widget
        • #9 - Custom task
        • #10 - Feedback
    • Architecture
    • Paywall and authentication
      • CloudFront Paywall
      • Engage paywall
      • Lua Paywall (deprecated)
    • Project management: A typical project
    • Database dump
    • Debugging
    • Keep your project up-to-date
    • Gulp and Sass
    • Domain mapping
    • Widgets overview
  • Starter kit packages
    • Base package
      • Changelog
    • Boards plugin (EveryBoard)
      • Installation
      • Setup
      • Board Widgets
        • Linked board
        • Template board
        • Embed widget
        • OC List item
        • Content container
      • Teaser templates
      • Actions and filters
      • Export - import
      • Changelog
    • ContentSync plugin
      • Usage
      • Changelog
    • Drop In Plugins package
      • Changelog
    • Everyware plugin
      • Installation
      • Setup
      • Actions and filters
      • Fetching lists and their content
      • Sorting
      • Widgets
      • Changelog
    • Imengine package
      • Helper class: Imengine
      • Changelog
    • NewsML package
      • Idf Parser
      • Changelog
      • Usage
    • NGINX conf package
      • API
      • Changelog
      • Usage
    • Presentation Preview plugin
      • API
      • Changelog
      • Usage
    • Support package
      • Changelog
    • Theme EU resources package*
      • Changelog
    • Theme US resources package
      • Changelog
    • Twig package
      • Development
        • Filters
          • class_string
          • spacey
          • trim_array
        • Functions
          • php_function
          • php_method
          • render_classes
          • render_partial
        • Operators
          • contains
      • Helper classes
        • View
        • ViewSetup
      • Changelog
  • Widgets and component packages
    • Article List widget
      • Installation
      • Using Article List
      • Changelog
    • Menu handler
      • Usage
      • Changelog
    • Section Header widget
      • Changelog
    • Social media icons widget
      • Installation
      • Changelog
    • Google Analytics plugin
      • Set up Google Analytics
      • Most read widget
      • Changelog
    • Redirect Original URLs plugin
      • Installation
      • Changelog
    • Settings Parameters plugin
      • Installation
      • Usage
      • Changelog
  • Design and theme packages
    • Base theme 1
      • Changelog
    • Base theme 2
      • Colors
      • Fonts
      • Header
      • Menus
      • Pages with Board
      • Sidebars
      • Teaser layouts
      • Article page (text)
      • Article page (embeds)
      • Changelog
    • Example theme
      • Changelog
  • MU Plugins
    • Project Plugin
      • Installation
      • Changelog
    • Starter Package Catalyst
    • Concepts
      • Admin Pages
        • All Concepts
        • Add New Concept
        • Types
        • Errors
        • Concept duplicates
      • API
      • Console
      • Changelog
    • Network
      • Changelog
    • Cache Invalidator
      • Getting Started & WP admin
      • Implementation of Lua endpoint
      • Filters
      • Changelog
    • RSS Feeds
      • Setup
      • Administration pages
      • Changelog
  • Services
    • Imengine
    • Imengine documentation
    • Open Content
    • Writer Bookmarklet
Powered by GitBook
On this page

Was this helpful?

  1. Feature: Advanced Search

Technical Details

Advance Search is a featured template which enables us to create a search engine based on various filters.

PreviousHow to SetupNextDeveloper prerequisites

Last updated 1 year ago

Was this helpful?

Advanced Search Template

There is a page template named Advanced Search. Applying this template to any Page will enable the feature on the page.

Template file page-advanced-search.php and SearchPageAdv.php File

This is the main file template page which calls SearchPageAdv.php file and the SearchPageAdv.php file contains all the functions that actually perform all search operations.

Location of SearchPageAdv:

/www/wp-content/themes/{THEME-FOLDER}/src/ViewModels/SearchPageAdv.php

Facets

Facets are the Indexfields mentioned in OC Admin dashboard. It is a variable name and meta data of articles. Each article contains some values for these facets, e.g. An article has a facet field named Section and its value is Sports. So once one will search articles of Sports the article may appear in search result.

Config JSON file

The config JSON file contains all the key values that one wanted to include in facets. Like, if you need to add 3 facets/filters on Search page then you need to mention all three Indexfields in this JSON file.

In this JSON file you can mention what values of facets (filters) you need to show on screen.

{ "facet": { "facetItems": { "Section": { "Name":"Section", "fieldName":"lvsection", "IncludedFieldsStatus":"FALSE", "IncludedFields":[ "Sport", "News", "Entertainment", "Business", "Finance" ] }, "ConceptCategoryUuids": { "Name":"Category", "fieldName":"lvcat", "IncludedFieldsStatus":"FALSE", "IncludedFields":[ "b0184795-0887-4620-9d11-f3a66e72ac42", "bad9a923-f480-4c99-83f6-61049558ad5e", "086b5ea1-9527-4907-869a-b04285f9cd00", "2c24dca5-3f7a-4983-b070-ee403f37fbc3", "7703b196-5d51-4c05-9c7d-6dac2af02559" ] }, "Channels": { "Name":"Channels", "fieldName":"lvchannels", "IncludedFieldsStatus":"FALSE", "IncludedFields":[ "Lavender", "Nigella", "Zinnia", "The Insurer", "Detroit Free Press", "Lancashire Post" ] } } } }
  1. "Section" and "Channels" are the field names displayed in the Advanced Search Page as facets.

  2. "Name":"Section" is the label used as the heading for each facet.

  3. "fieldName":"lvsection" defines the attribute name for input fields in the URL of the Advanced Search Page.

  4. "IncludedFieldsStatus":"TRUE"

    1. When "IncludedFieldsStatus" is set to TRUE: The values listed in "IncludedFields" will be displayed in the facets.

    2. When "IncludedFieldsStatus" is set to FALSE: The values specified in "IncludedFields" will be ignored. All values will be shown in the facets, regardless of what is specified in "IncludedFields.

  5. "IncludedFields" is used to add facet values for each index field. You can provide these values using either UUID or Name.

*The above points mentions "fieldName":"lvsection" where the example is taken for lavendar project, in other cases this will change based on the project.

In future if one more facet needs to be added then just adding details in JSON file will create front-end interface along with the back-end query for the new facet. JSON structure can be changed from customer to customer and accordingly codes need to change. NGINX Settings: (To set the max-age = 0 for caching) Note:here location ~ ^/(advanced-search/) will be based on title of the advanced-search template page(Example: for "Page AdvSearch" title it will be location ~ ^/(page-advsearch/)

location ~ ^/(advanced-search/) {
  # This disables the monitoring.
  fastcgi_param PHP_VALUE "newrelic.browser_monitoring.auto_instrument=0";
  # This disables the caching.
  header_filter_by_lua_block {
    ngx.header["Cache-Control"] = "max-age=" .. 0
    ngx.header["expires"] = -1
        ngx.header["disablecaching"] = 1
  }
  # The rest is to be consistent with the server vars etc are the same as for the usual PHP location.
  include common/fastcgi_params;

  fastcgi_param SCRIPT_NAME           "/index.php";
  fastcgi_param DOCUMENT_URI          "/index.php";

  fastcgi_param SCRIPT_FILENAME       $document_root/index.php;
  fastcgi_index index.php;
  fastcgi_pass php-fpm;
}

Customer/Deployed Environments List: WBM Stage