When people land on your website, one of the first things they might look for is a search box. Just about any website can benefit from providing a search box and many solutions already exist for RapidWeaver. However some solutions are slow to reflect changes in your website content or they fill your search results with adverts or sponsored links to competitors. Others are tedious to setup and keep working in a healthy state. With SimpleSearch, we've gone right back to the basics of website searching and developed a solution we believe is one of the best if your goal is simple searching.

With SimpleSearch, you become the search bot! Into the SimpleSearch stack you add details of pages you want made searchable. Each page you add to the SimpleSearch stack can include complimentary titles, descriptions, links and keywords. When people search your website using SimpleSearch, matching pages are shown on the results page. You can modify search results with additional keywords, to ensure closely-related pages are shown. Plus SimpleSearch works fantastically well in multilingual websites and can display results from other domains.

Example

An example SimpleSearch search box is provided below which you can test with. This is used to search some of the webpages of the Stacks4Stacks website. Try a search keyword like 'video' to return all stacks that are related to video.
 
 
The sample RapidWeaver 6 project file demonstrated in the video above can be downloaded using this link and works with the free demo version of SimpleSearch provided. This file can also be opened in RapidWeaver 7 and RapidWeaver 8.

How does it work?

SimpleSearch is built on a customised version of the opensource (MIT licensed) Tipue search plugin. Normally you would be exposed to a lot of very complicated code when setting up Tipue search. However the SimpleSearch stack has been engineered to hide all the complexities behind an attractive drag-and-drop user interface. It's easy to add new search results or arrange them into a different order; to match a sitemap for example.

If the stack is configured as just a search box, then that is all that's shown on the page. However if you choose to display the search results, then extra code is loaded into the page to receive and process the search keywords.

A key feature of SimpleSearch is that is is a flat-file system. The entire search index is compressed and embedded into the search results page. There is no MySQL database involved. Therefore you should find SimpleSearch is extremely fast at delivering search results on your published website.

Setup

Follow these instructions carefully for getting a basic SimpleSearch stack setup and working in your website.

Search results page (needed to display the search results)
  1. Add a new Stacks page type to your website. Give the page a name of 'search' or similar
  2. Drag and drop a copy of SimpleSearch into your new search page
  3. In the stack settings, change the setup mode to Search Box & Search Results
  4. In the stack settings, set the link of the search page to the current webpage
  5. Click on the blue '+' button and create a new search item entry for each page of your website
  6. Enter a title, description, keywords and link for each search entry item, in the stack settings. Do not include any double quotes (") and remember to escape any special characters with HTML entities
  7. Select the main SimpleSearch stack in edit mode to change any of the other settings desired in the stack settings
  8. Publish the webpage to your server or export your site to MAMP to test it works

It is recommended that an effort is made to try and keep the search results page as simple as possible. The nature of SimpleSearch means that quite a lot of Javascript code has to reside in the page; to receive the search keywords from your website users and process the results. For this reason it is wise to avoid using too many other scripts or complicated addons within the same page. We have made a determined effort to 'conflict proof' SimpleSearch against other addons, but the modular system RapidWeaver uses means that there is always a risk of certain things not working together.

Search box (optional)
  1. Drag and drop a copy of SimpleSearch into any Stacks pages within your project
  2. In the stack settings, change the setup mode to Search Box (default)
  3. In the stack settings, set the link for the search page to the location of where your search results page is located in the website
  4. Change any other display or style settings as required

SimpleSearch does not work in RapidWeaver preview (RapidWeaver lacks the ability of passing search queries onto your search page, via the browser address bar). However you can test SimpleSearch locally in MAMP or publish it to your web server. To see how the search function on this website was created, download the website using the link in the footer.

As always, hovering your mouse cursor over individual settings will display an informational tooltip about what each one does.

Configuring SimpleSearch to work with RapidSearch, RapidSearch Pro or an external website


You can use the SimpleSearch search box standalone as an attractive search box for a whole range of different search plugins and websites. In the stack settings, change the setup mode to Search Box, and then provide the link to the page that does the searching. For RapidSearch and RapidSearch Pro, you just set the link to either of these two pages in your website, and append q= to the end of the link. When the search form is submitted, we pass the keywords over to RapidSearch or RapidSearch Pro. For example:

http://example.com/search?=

For an external website (e.g. Wikipedia, Google, Bing, Yahoo, IMDB, Amazon, eBay), you'll want to use their existing search box in your web browser and carefully look at how the address is structured when a search is run. IMDb for example, has an address like this if you search for 'mission impossible':

http://www.imdb.com/find?q=mission+impossible

In that above example, you can instantly see 'mission impossible' appended after ?q= so you could enter http://www.imdb.com/find?q= as the search link in SimpleSearch, knowing that the keywords would be appended onto the end of that link and the search results would get returned on the IMDb website.

You can conform if a search URL and query string is working, by pasting it into your web browser address bar.

SimpleSearch 2 Advanced Settings

In the SimpleSearch 2 advanced settings, you can configure 4 separate lists of words and links which can be used to fine-tune the search results returned (e.g. ignore common words) or help to make site searching more intelligent, for your website users.

Ignored Words
This is an array of common words that you want ignored, when a search it run. Also know as stopwords, you can get a list of words in different languages here:
http://www.ranks.nl/stopwords
Take a careful note of how the words are entered in the settings. Each word is separated with a comma and placed inside a pair of single quote marks. This is purposefully done so that the SimpleSearch code can read the array really quickly.

Replaced Words
This is a good method to detect search keywords that you may find your website users are commonly spelling wrong. Replaced words can work as a simple form of autocorrect and the search results will clearly tell a user that their search terms have been autocorrected. Each replaced word needs to be entered in the stack settings, in the following array format:
{'word': 'fshcake', 'replace_with': 'fishcake'},
You can probably see quite clearly that we provide the original word and then the replaced word. Repeat this markup for each of the words you want replaced.

Stemmed Words
These are nearly identical to replaced words. The major difference is that the search results will automatically convert words and will not tell a user that their original search terms have been replaced with something else. Again you setup stemmed words as an array:
{'word': 'e-mail', 'stem': 'email'},
{'word': 'eMail', 'stem': 'email'},
{'word': 'E-Mail', 'stem': 'email'},

Link Weighting
This is where you can optional control the ranking of webpage results, with a numerical scoring system. Setup link weighting in the form of an array:
{'url': 'http://example.com', 'score': 200},
{'url': 'http://example.com/blog', 'score': 100},
{'url': 'http://example.com/about', 'score': 100},
The bigger the score, the higher up the search results matching pages will be shown.