2. Module "Search"

The module "Search" provides a search function for ConPresso frontend as well as for its backend.

Content editing users can use the module in the backend for researching article contents. In the frontend visitors of the ConPresso project can search through sections that have been specified for this search.

The search function is considered a basic function in ConPresso, therefore it is included in the default installation of ConPresso since version 4.0.5. However, you can also install the module later (e.g. if you have ConPresso versions 4.0.0 to 4.0.4). Download the module from ConPresso-Website. For more information please read Section 2.1, “Installation of the Module "Search"”.

The search function has been realized as a module on purpose, that way it can be used several times in the frontend. You can configure the function and the layout of this module differently in different installations. This is necessary, for example, if you do not only want to provide a standard search function in your ConPresso frontend but also a special search function for a particular section (e.g. the FAQs).

[Note]Note

You do not have to obtain a registration for this module. You can use it for commercial as well as for non-commercial ConPresso installations. Please note, though, that other modules may require a registration and that you may have to obtain a "License for commercial use".

2.1. Installation of the Module "Search"

The module "Search" is part of the default installation of ConPresso (since version 4.0.5). If you would like to install the module for an older ConPresso version, please read the following instructions.

If you are planning to provide multiple search functions in the frontend of your project a multiple installation is required. To install the module please proceed as follows.

Download the Archive

Please download the archive containing the current version of the module from the ConPresso-Website and save it locally. .

Unpack the Archive and Upload the Module Directory

After downloading the archive unpack it locally, that is to your computer. Name the module directory as you like (e.g. "mod_search" or "mod_search_faq") and transfer it to the ConPresso directory of your project via FTP.

[Note]Note

If you are using a ConPresso version above 4.0.5 and if you want to carry out an additional installation of the module, you can also download your existing module directory, rename it and upload it again to your ConPresso directory.

Installation and Activation of the Module

In the ConPresso backend click on the entry “Manage Modules verwalten” in the menu “Modules”.

Install the module by clicking on the button Install in the column “Manage”. Then activate the module by clicking on the button Activate module in the column “Manage”. For mor information on the installation, activating and uninstalling a module please refer to Section 1, “Manage Modules”.

After the installation of the module the backend navigation will list the entry “Search” so that users can search through the backend of the ConPresso project.

Configure Module Settings

You can configure the search module for the ConPresso frontend. You can specify, for instance, in which rubrics the search should be performed, how many hits you want to be displayed on the output-page and how the output should be formatted.

Configure the module's settings in the view “Configure module settings”. Open this view by clicking on the entry “Manage modules” in the menu “Modules” and pressing the button Configure module settings in the column “Manage”.

Rubric Restriction

Use the settings of “Rubric restriction” to limit the search to specific rubrics. This should be done if you want to exclude certain rubrics from being searched.

Choose the option “include”, to include the rubrics selected in “Rubrics” into the search function. Choose the option “exclude” to exclude the rubrics selected in “Rubrics” from the search function.

Rubrics

The settings of “Rubrics” correlate with the settings of “Rubric Restriction”, if you specify which rubrics should be included in the search function and which ones should be excluded from it.

Highlight the rubrics you want to in- or exclude. To highlight several rubrics, hold down the shift or ctrl key (shift or apple key on a Mac) while clicking on the rubrics.

Search Options

If you want extend the search function to the names of article authors, links, images and files please check the relevant boxes.

Search Title

If you check this box, the search in the frontend will produce search results with titles that contain the search term.

Search Content” [Default]

Check this box if you want the search function to search through the content of articles. Texts based on placeholders of the types "Text" and "HTML", links as well as image and file descriptions will be included in this search.

Search Keywords” [Default]

If you check this box, the search in the frontend will produce search results with “Keywords” containing the search term. For more information on keywords please refer to Section 1, “Create Article”.

Search Authors

If you check this box, the search in the frontend will produce search results with the search term being part of the user name or name of the article author.

Number of Results per Page

Here you can specify how many results should be listed on the output-page.

Number of Characters

The search results will show the search term highlighted in its context. How much of this context will be displayed is specified with the setting “Number of Characters”. Please enter the number of characters (e.g.50) to be displayed.

Date Format

The publication date can be an additional information in the list of search results. If you choose to display this information you can use the setting “Date Format” to specify the format of the publication date.

Template

Use the template to format the input and output layout of the search function. The following placeholders are available:

<!-- START_MOD_SEARCH -->

Defines the start of the search template.

<!-- SEARCH_NAV -->

Required in a "hidden" field, ensures that the navigation is displayed correctly after sending off a query.

<!-- SEARCH_PHRASE -->

Contains the search term of the current query or an empty string.

<!-- SEARCH_MESSAGE -->

Displays messages like "no results", "please enter a search term", etc.

<!-- SEARCH_MATCHES -->

Shows the number of search results of the current query.

<!-- START_SEARCH_MATCH -->

Starts the section of an individual search result.

<!-- SEARCH_NUM -->

Shows the consecutive number of the result displayed.

<!-- SEARCH_LINK -->

This placeholder contains the URL of the article found. If can be used as the "href" attribute of a link tag, for example.

<!-- SEARCH_TITLE -->

Contains the title of the article.

<!-- SEARCH_RUBRIC -->

Contains the rubric in which the article was found.

<!-- SEARCH_AUTHOR -->

Contains the name of the article's author.

<!-- SEARCH_PUB_DATE -->

Contains the publication date of the article.

<!-- SEARCH_ARTICLE_ID -->

Contains the article's ID number.

<!-- SEARCH_CONTENT -->

Contains the context of the search term.

<!-- END_SEARCH_MATCH -->

Ends the section of an individual search result.

<!-- SEARCH_PAGES -->

Generates the output of a navigation between pages, if the number of search results exceeds a certain limit.

<!-- END_MOD_SEARCH -->

Defines the end of the search template.

Highlight CSS

Please enter the class that defines the format for highlighting the search term within the search results.

Message 'no search term'

Please enter the message that should be displayed if the query was sent off without a search term.

Message 'no results'

Please enter the message that should be displayed if the query does not produce any results.

Message 'results'

Please enter the message that should be shown above the results. To display the number of results please use the placeholder "%s".

Integrating the Module into the ConPresso Frontend

There are two ways of integrating the search module into the ConPresso frontend.

The first way is to refer the visitor to the input page of the search module. For that purpose you have to embed a link leading to this page into the article itself or, alternatively, into the header or footer file.

If you have installed ConPresso in the directory conpresso on your webserver "http://www.example.com" and if the module is in the default directory mod_search, please use the following URL or adapt the URL according to your settings: http://www.example.com/conpresso/mod_search/index.php

Of course you can also integrate the search module into the navigation of your ConPresso project. For that purpose, generate a new navigation element at the desired location and enter the URL named above as the “external link”. For more information on editing the navigation please read Section 5, “Edit Navigation”.

The graphical appearance of the search field and the search results is specified in the module's settings as described in the section called “Configure Module Settings”.

The second way of integrating the search module consists in inserting the search field into a header or footer file. If you use the gobal header or footer, the search field will be available in all pages generated by ConPresso. For more information on headers and footers please refer to Section 2.1, “Customizing Header and Footer Files”.

You may use the following code example.

Example 13.1. Search form for the backend

<form method="get" action="../mod_search/index.php" >
    <input type="hidden" name="action" value="search" />
    <input type="hidden" name="rubric" value="<?php echo $cpoRubric['id']; ?>" />
    Please enter a search term:<br />
    <input type="text" name="q" value="" />
    <input type="submit" value="Search">
</form>


[Note]Note

Please note that you might have to change the path to the index file of the respective search module in the first "<form>" line.

2.2. Searching in the ConPresso Backend

To get to the search function please click on the entry “Search” in the ConPresso navigation. ConPresso will open the view “Search” in its work space. Use the search function if you want to search contents for various criteria.

Query

Search Term

Please enter the search term here.

Search Options

Please specify which elements should be searched.

Search titles” [Default]

Select “Search titles” to produce search results (articles) whose titles are containing your search term.

Search content” [default]

Select “Search content” to search through the whole article content. Texts based on placeholders of the types "Text" and "HTML", links as well as image and file descriptions will be searched.

Search keywords” [default]

Select “Search keywords”, to produce search results (articles) whose “Keywords” are containing your search term. For more information on keywords please refer to Section 1, “Create Article”.

Search authors

Select “Search authors” to search for articles written by a certain author. Please enter the user name, the name or a part of the name as the search term and submit your query.

Search comments

Select “Search comments” to produce search results (articles) whose “Comment” contains your search term. For more information on comments please read Section 1, “Create Article”.

Rubrics

Please choose the rubrics you want to search. To highlight more than one rubric, please hold down the shift or CTRL key (shift or apple key on a Mac) while clicking on the rubrics.

Approval status

Use the option “Approval status” to limit your search to articles with a specific approval status.

Publication period

Use the option“Publication period” to limit your search to articles with a certain publication period.

If you do not specify the publication period the module will search through all articles: those waiting for publication, articles within their publication period and for articles whose publication period has expired. This is the default setting.

Article-template

Use this option to find articles that are using a specific article-template. Please select the article-template from the dropdown menu and submit your query.

Last modified by

Use the option “Last modified by” to find articles that have last been edited by a certain user. Please select the user from the dropdown menu and submit your query.

Search Result Output

The search result output consists of a message reporting the number of articles found and showing the list of search results. This list view resembles other list views in ConPresso and provides similar functions. The search result list contains the following columns:

Title/Author

The column “Title/Author” shows the title of the article as well as the name of the author and the name of the user who last edited the article. The title is preceded either by a green or orange coloured box. The colour indicates whether the article can be seen in the frontend of the project or not.

Rubric

The column “Rubric” shows the name of the article's rubric. If you want to edit the article, select its rubric first by clicking on it.

Status

The column “Status” shows the approval status of an article. For more information on the topic of approving an article please refer to Section 2.1, “The ConPresso Approval Mechanism”.

Publication

The column “Publication” displays the information on the publication period of an article. For more information on the topic of publication periods please refer to Section 2.2, “Publication Period”.

Context

The column “Context” displays the search term with the context it was found in.

2.3. Searching in the Frontend

In the frontend of your ConPresso project the module "Search" provides an input field into which visitors can enter their search terms. The output of search results depends on the module's configuration as described in the section called “Configure Module Settings”).

For more information on providing the search function in the ConPresso frontend please read the section called “Integrating the Module into the ConPresso Frontend”.

[Note]Note

The search function in the ConPresso frontend performs searches with regard to restricted and personalized rubrics.

Thus it makes sure that frontend users can only see contents they are intended to see. The search function will not produce search results from restricted rubrics for users without the appropriate access rights. Frontend users with differing access rights will therefore see different outputs.

For more information please refer to Chapter 16, Restricted Sections and Personalization.