Search Segments

Search Segments allow you to create groups of searchable pages.  They are useful if you want to provide the ability to only search certain pages. 

It's important to note that Search Segments only apply to pages managed by the Pages App.  Search Segments are not used by any other app. See Searching Apps & App Instances for how to limit searches to one or more App or App Instance.

Layouts

You can specify different search layouts to be used for search results under one or more Search Segment.  Under the Settings section of the Search administration you can specify layouts and other settings specifically for Search Segment results pages and search form pages.

Individual Search Segments can override the default layout and display information for Search Segments.  This is done when adding or editing a Search Segment.  If more than one Search Segment is being searched, however, the default settings will be used even if one or more of the Search Segments override the default settings.

How to Search a Search Segment

In order for the system to recognize that it's searching within one or more Search Segments the Segment Key needs to be in the URL.

For example: http://mysite.com/search?q=search+term&s=segment-key

If multiple Search Segments are being searched then the "s" parameter get's changed to "s[]".

For example: http://mysite.com/search?q=search+term&s[]=segment-key&s[]=segment-key-two

To get the Search Segment Keys in the URL you would include one or more form fields in the search form. The system will take care of adding the correct parameters and values into the URL.

Form fields for one Search Segment

If you're only searching in one Search Segment you should use the following form fields:

Hidden form field:
<input type="hidden" name="segment" value="segment-key" />

Select menu:
<select name="segment">
  <option value="segment-key">Segment 1</option>
  <option value="segment-key-two">Segment 2</option>
</select>

Radio buttons:
<label><input type="radio" name="segment" value="segment-key">Segment 1</label>
<label><input type="radio" name="segment" value="segment-key-two">Segment 2</label>

Form fields for more than one Search Segment

If your searching more than one Search Segment then you should use the following form fields:

Multiple hidden form fields:
<input type="hidden" name="segment[]" value="segment-key" />
<input type="hidden" name="segment[]" value="segment-key" />

Checkboxes:
<label><input type="checkbox" name="segment" value="segment-key">Segment 1</label>
<label><input type="checkbox" name="segment" value="segment-key-two">Segment 2</label>

Notice that the form field name changed from "segment" to "segment[]".  The "[]" is required in order for more than one Search Segment to be searched. If that is left off then only the last Search Segment specified will be used.