Custom Search using Embed Component in Pages

Overview

You can create a component allowing users to perform searches on specific applications such as Knowledge Base, Documents or InfoCapture from any Intranet page made in the Pages application by using Embed Components.

 

1. Knowledge Base Search

1.1 Basic Knowledge Base Search. 

Step 1: In Pages add an Embed Component

Step 2: Copy Code below

<div style="padding:30px; text-align:center;">
<form id="kbSearchForm" class="form-inline" action="/intranet/knowledgebase/search.php" method="get" role="search">
<div class="form-group">
<input type="text" class="form-control input-lg" placeholder="Search Knowledge Base..." name="q" width="100%" id="simple_search_keyword" size="35">
<button class="btn btn-primary btn-lg" type="submit">Search</button>
</div>
</form>
</div>

 

Step 3: Paste the code into the embed component

 

1.2. Knowledge Base Search within a Category.

In some cases, you may want to limit the search into certain categories of the Knowledge base by utilising Knowlege Base Advance Search in Pages component.

 

Step1: Find the category ID you wish to limit the search.

This can be found by clicking on the category you wish for and taking a note of the ID in the address bar.

 

Step 2: Copy the code below

<div style="padding:30px; text-align:center;">
<form action="/intranet/knowledgebase/search.php" method="get" class="form-inline">
<div class="form-group">
    <input type="text" id="advanced_search_keyword" class="form-control input-lg" name="advanced_search_keyword" value="" placeholder="Search Category XX" size="35" width="100%" >
<input type="hidden" id="advanced_search_category" name="advanced_search_category" value="XX">
<button type="submit" class="btn btn-primary btn-lg" name="advanced_search" value="advanced_search">Search</button>
</form>
</div>

Replace Search Category XX with the actual category name and value=XX with Category ID you've noted earlier.

 

Step 3: Paste the code into the Pages embed component

 

1.3. Advanced Knowledge Base Search Dropdown

 

In some cases, you may want to limit the search within selected categories within the Knowledge base, this can be achieved by showing Category drop-down. First, you need to find Category Names and IDs to be included in the arrays.

 

Step1: Find the category Names and IDs you wish to present in the search dropdown

This can be found by clicking on the category you wish for and taking a note of the ID in the address bar and make a note of name and ID you wish to be included in the arrays.

 

Step 2: Copy the code below

<div style="padding:30px;">
<form class="form-horizontal" action="/intranet/knowledgebase/search.php" method="get">
<div class="form-group"><label class="control-label col-md-3 col-sm-2">Search</label>
<div class="col-md-9 col-sm-10"><input type="text" id="advanced_search_keyword" class="form-control" name="advanced_search_keyword" value=""></div>
</div>
<div class="form-group"><label class="control-label col-md-3 col-sm-2">Category</label>
<div class="col-md-9 col-sm-10"><select id="advanced_search_category" name="advanced_search_category" class="form-control">
            <option value="0" selected="selected">All Categories</option>
            <option value="XX">Category Name</option>
            <option value="XX">Category Name</option>
</select>
</div>
</div>
<div class="modal-footer">
<button type="submit" class="btn btn-primary" name="advanced_search" value="advanced_search">Search</button>
</div>
</form>
</div>

ReplaceCategory Name with the actual category name and value=XX with Category ID you've noted earlier.

 

Step 3: Paste the code into the Pages embed component

 

Open in a new tab (optional)

If you wish to have search results open in a new tab you can add the following code within <form>  HTML tag

Example:

<form action="/intranet/knowledgebase/search.php" method="get" class="form-inline" target="_blank">

 

 

2. Document Search

 - General search of the Directory (will only return content a user has permission to see)

Embed code to copy :

<div style="padding:30px; text-align:center;">
<form id="search_params" class="form-inline" action="/intranet/documents/data_search.php" method="get" role="search">
<div class="form-group">
<input type="text" class="form-control input-lg" placeholder="Search Documents..." name="q" width="100%" id="CommonSearchFor" size="35">
<button class="btn btn-primary btn-lg" type="submit">Search</button>
</div>
</form>
</div>

 

- Set the search to be within a specific folder only

Take the folder ID (from the end of the URL when in the folder) and add:

<input type=“hidden” name=“doc_folder_id” value=“xx”>

 

Embed code to copy:

<div style=“padding:30px; text-align:center;“>
<form id=“search_params” class=“form-inline” action=“/intranet/documents/data_search.php” method=“get” role=“search”>
<div class=“form-group”>
<input type=“hidden” name=“doc_folder_id” value=“37”>
<input type=“text” class=“form-control input-lg” placeholder=“Search Documents...” name=“q” width=“100%” id=“CommonSearchFor” size=“35">
<button class=“btn btn-primary btn-lg” type=“submit”>Search</button>
</div>
</form>
</div>

 

 

3. InfoCapture Ticket Search

Embed code to copy:

<div style="padding:30px; text-align:center;">
<form id="search_string_form" name="search_form" action="/intranet/infocapture/search.php" method="get" class="form-inline text-center search-form">
<input type="text" name="q" value="" width="100%" id="searchTerm" class="form-control input-lg search-form__input" placeholder="Search InfoCapture Ticket...">
<button class="btn btn-primary btn-lg" type="submit">Search</button>
<input type="hidden" name="obj_stype" value="">
</form>
</div>

 

4. People Search

Embed code to copy:

<div style="padding:30px; text-align:center;">
<form id="people_form" name="people_form" action="/intranet/people/" method="get" class="form-inline text-center search-form">
<input type="text" name="search_terms" value="" width="100%" id="search_terms" class="form-control input-lg search-form__input" placeholder="Search People">
<button class="btn btn-primary btn-lg" type="submit">Search</button>
<input type="hidden" name="obj_stype" value="">
</form>
</div>

 

5. Google Search

It is also possible to embed Google Custom Search or general Google Search by copying the code below into the embed component.

Embed code to copy:

<div style="padding:30px; text-align:center;">
<form target="_blank"  class="form-inline text-center search-form"   id="google" method="get" action="https://www.google.com/search" target="main">
    <input name="q" id="google" placeholder="Google Search"  class="form-control input-lg" value="" type="text" autofocus ></input>
<button class="btn btn-primary btn-lg" type="submit">Search</button>
</form>
</div>
Last modified on 6 December 2023 by Hannah Door
Created on 2 December 2021 by Michael Christian

Was this helpful?  

Share