Home
Categories
Dictionary
Download
Project Details
Changes Log
What Links Here
How To
Syntax
Wiki usage
Tutorials
FAQ
License

Full text search



If the "fullTextSearch" property is set in the configuration file or the command-line, then the search box includes a full-text search in the articles content. Clicking on a link will navigate to a Search page which will present links for all the pages which contain the searched term.

The Full text search uses the elasticlunr Javascript library (or its associated Java conversion for the JavaHelp implementation) to implement the search.

Full text search options

Full text search compression level

By default, the JSON or Javascript file for the full text search is compressed to save space. It is possible to have a more readable file by setting the fullTextSearchCompressionLevel configuration property, or in the command-line.

There are several values for the compression level:
  • "false" or "0" or "minimum" or "no" does not compress the file. This format indent the file to make it more readable, but can be very large
  • "true" or "1" or "normal" apply the normal compression to the file (this is the default value). This format does not indent the file and can be three times smaller than the uncompressed one
  • "2" or "maximum" apply the maximum compression to the file. This format is much smaller (even than the one with the normal compression), but the json format for the serialized index is not compatible with the regular elasticlunr JavaScript library. However, the version of the JavaScript library shipped with the generator is compatible with it, so the full-text search will still work if you use the shipped library as is


Note that for example, for this wiki:
  • The size of the index for no compression is 3200 Ko
  • The size of the index for the normal compression is 750 Ko
  • The size of the index for the maximum compression is 310 Ko

Removing accents

It is possible to remove the accents for the full text search by setting the fullTextSearchRemoveAccents configuration property, or in the command-line. Accents are removed by default.

Use the Metaphone algorithm

It is possible to use the Metaphone algorithm for the full text search by setting the fullTextSearchMetaphone configuration property, or in the command-line. The algorithm is not used by default.

Metaphone is a phonetic algorithm for indexing words by their English pronunciation. It does a better job of matching words and names which sound similar.
Main Article: HTTP Server

The Full text search feature is available in the search box. Note that you will not see the context of the search if you open the wiki in the browser by double clicking on the index.html page.

For example:
searchboxFullText
After clicking on "help" at the bottom of the popup window, the following page will appear:
searchboxFullTextResults
To be able to see the context of the search, you must:
  • Double click on the server.bat console file (or server.sh on Linux or MacOS X)
  • Open the wiki on the browser by navigating to the http://localhost:8080/ address
After clicking on "help" at the bottom of the popup window, the following page will appear:
searchboxFullTextResults2

Cross-origin resource sharing

The reason why you will not see the context of the search if you open the wiki in the browser by double clicking on the index.html page is because of the Cross-origin resource sharing policy (CORS):
  • Getting the context of the search is performed by create a DOM object in the Search results page each page where the term has been found. It gets the resources for this other page in the context of the results page
  • The computation of the context is done by Javascript on the Client browser on each of the page on the results page
  • CORS does not allow a web page to access restricted resources on a domain name different from the domain that served the web page. By default local pages are considered as in another domain to avoid security problems. This leads to the javascript function which tries to get the DOM content of the page to fail because of this restriction
Opening the wiki using the HTTP Server allows to bypass this problem because the pages are served on http://localhost:8080/ and are no more viewed as local files by the browser anymore.

See also


Categories: Search

docJGenerator Copyright (c) 2016-2023 Herve Girod. All rights reserved.

Project Web Hosted by SourceForge.net Copyright 1999-2010 - Geeknet, Inc., All Rights Reserved About - Legal - Help