Clone wiki

Instant Search / Home

Provides an Instant Search macro, a highly customizable "type-ahead" search box. Options:

All Versions

  • Filters: space key, type of content, contributor, label (include / exclude), content with regular expression (include / exclude), last modified date
  • Show/Hide: space key, labels, date created, date last modified, excerpt, search button
  • Customize: maximum search results, input field width, excerpt length, url (include /exclude), search button, watermark, search and result css, result width, tab order, focus on page load

Confluence 4.3+ Instant Search (2.1+)

  • Filters: number of likes
  • Customizations: hide / replace text, show likes, sort by likes
  • Tracking: Track searches and display with Instant Search Log Table macro

More Details

This plugin performs searches that attempt to ignore case. For example: "do" searches as "Do OR do OR Do* OR do*". This would find "do" as well as "Do", "dog", "Dog", "DO", and "DOG". Previously, "do" it would only find "dog", since it uses the wild-card "do*" search, which is both case-insensitive and must match one or more characters beyond the search term (ie "do.+" instead of "do.*"). Additionally, unlike livesearch, we also allow multiple terms to be searched.

Configuration options: spaceKey (includes @self), type, contributor, label, limit, excerptLength, lastModified, and filter (includes @root, @self, @home, and free-text). Note: Does not show space or lastModified date within the search popup, unlike livesearch. If requested, I could add these back in as configurable options.


Replace Search Box

A tip from a user suggests the following when replacing the #quicksearch() macro as part of the RefinedWiki Original Theme:
#set($helper = $action.helper) $helper.renderConfluenceMacro("{instantsearch}")

Usage

To remove bodyContent passages from search results, set bodyContentLength to 0 or less.

  • spaceKey: (optional) specify the key of the space you want to search in. Use comma for multiple spaces. @self key-word allowed (Default all)
  • showSpaceKey: (optional) show the space key. (Default false)
  • type: (optional) specify the content type (could be page, comment, blogpost, attachment, userinfo, spacedesc)
  • contributor: (optional) specify the username of the contributor of the content to be retrieved
  • label: (optional) search for content with these labels: prefix a label with '+' to require a match or '-' to exclude any content with that label. By default, at least one of the labels will be present on any matched content. Separate labels with commas or single-spaces.
  • limit: (optional) search result limit (Default none)
  • inputFieldWidth: (optional) Set the width of the input box using the width style attribute (e.g., 200px).
  • excerptLength: (optional) length of the search display of page hits, roughly in characters. Set to 0 or less to remove excerpts. (Default 40)
  • filter: (optional) every returned url be included or excluded. Prefix with '+' (default) to require a match or '-' to exclude any content with that filter. Separate filters with commas or single-spaces. Also allows special keywords (by themselves): @none (default), @parent, @self, and @home.
  • showLabels: (optional) show returned labels of hits. (Default false)
  • showDateCreated: (optional) Show the date content was created. (Default false)
  • showDateLastModified: (optional) Show the date content was last modified. (Default false)
  • hideExcerptMacro: (optional) hide {excerpt} macro. (Default false)
  • showSearchButton: (optional) Show search button. (Default true)
  • searchButtonHTML: (optional) HTML for search button. @self is replaced to refer to the space name. (Default "Search")
  • watermark: (optional) Text displayed in input field (watermark). @self is replaced to refer to the space name. (Default none displayed.)
  • watermarkClass: (optional) CSS class for watermark. (Default 'plugin_instantsearch_searchbox'.)
  • searchClass: (optional) CSS class for search. (Default 'plugin_instantsearch'.)
  • resultWidth: (optional) Width for search result (including 'none'). (Default none, inherits css .)
  • resultClass: (optional) Class for search result . (Default 'none' .)
  • tabOrder: (optional) The tab order of the search input box. (Default 'none included' .)
  • lastModified: (optional) specify a time period in which the content was last modified: (e.g. 3d = modified in the last 3 days, 1m3d = modified in the last month and three days)
  • focus: (optional) Automatically focus on search box on startup (Default 'false' .)
  • spaceCategory: (optional) Search for only one type of space category (Default 'all').

Examples (Encoded)

{instantsearch:spaceKey=KEY|showSpaceKey=true}
{instantsearch:spaceKey=KEY|type=page|limit=3|bodyContentLength=20|lastModified=3d|showDateLastModified=true}
{instantsearch:spaceKey=KEY|label=+atlassian,+confluence,+content|bodyContentLength=0}
{instantsearch:spaceKey=@self|label=+atlassian,+confluence,+content|filter=@self}
{instantsearch:spaceKey=KEY|label=+atlassian,+confluence,+content|filter=-random_url,+other_url}
{instantsearch:spaceKey=KEY|showLabels=true|hideExcerptMacro=true|inputFieldWidth=200px}
{instantsearch:watermark=Searching in KEY ...|spaceKey=KEY|searchButtonHTML=<img src=/url/to/image>}
{instantsearch:resultClass=mystyle|spaceKey=KEY1,KEY2|resultWidth=400px|focus=true|track=true}

Note: Bad UTF-8 characters in search tracking

If you have bad characters in your search tracking results (typically from UTF-8 issues), you will need to either reset the data in your track database or run a database against your database fixing this data:

    update "AO_72F720_TRACKED_SEARCH"
    set "PAGE_LINK" = '/dosearchsite.action?cql=siteSearch ~ "'||replace("PAGE_DISPLAY", 'Search term: ','')||'"'
    where position(chr(63) in replace("PAGE_LINK",'/dosearchsite.action?cql=siteSearch','')) > 1 and position(chr(63) in "PAGE_DISPLAY") = 0;

Updated