Skip to content

thomaspeklak/offlinesearch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

==OfflineSearch
OfflineSearch is a semantic offline search generator. It scans a directory of html files and generates a javascript search data file, that can be used to power a search on a html page. This was primarly written for an offline html documentation and this is also the main target group. Of course it can be be useful on small websites, too.

A frequency file of words can be outputted. This may help to find typos and gives statistical information, that can be used to tweak the stop word list. Maintaining the stop words is crucual to keep the index small. E.g. the index of 11MB of HTML files is about 1.2MB (including double metaphone data and if using a tweaked stop word list)

The double metaphone algorithm can be used to find simlar terms if the search did not find any matches. This performs not to well, but an other (better) algorithm was not found that performed well on a large index.

Default config files, stop word lists and search templates can be generated. Please see the section Usage for details.

The search does not include any boolean logic (OR, NOT, XOR, ...). It always tries to find all specified terms.

A max semantic depth value can be set in the config file, that determines how many parent nodes shoud add their semantic value to the current node. E.g. h1 > b can have more semantic weight than a single b or h1

REMARK: Currently the search index is always written in UTF-8. Future releases will support other encodings.

===Executable:
 OfflineSearch

===Usage:
  OfflineSearch [options]
    -c, --config=CONFIG_FILE         configuration file for the offline search
  
  Generators
    -g, --generate-default-config    creates a default config file in the current directory
    -w, --generate-default-stopwords creates a default stopword list in the current directory. Language flag is required.
    -t, --generate-template          creates search template files in the current directory
    -o, --generate-search-data       crawler the documents in the given docpath and generates the search data file
  
  Optional arguments
  can also be specified in the config file
  command line arguments will overwrite any given value in the config file
    -d, --docpath=DOCPATH            path of the documents
    -f=SEARCH_DATA_FILE              path and name of the search data file
        --search-data-file
    -s=STOPWORD_LIST                 stopword list, if none is specified the default stop word list is used
        --stopword-list
    -l, --language=LANGUAGE          required if you want to generate a default stopword list
  
    -h, --help                       Show this message

===Config-File example:

	language: english
	storage: memory
	crawler:
	  docpath: ../docs
	  docs: [html, htm]
	  exceptions: 
	  stopwords: 
	  tags:
      title: 150
      h1: 50
      h2: 25
      h3: 18
      h4: 13
      h5: 11
      h6: 9
      strong: 7
      b: 7
      em: 5
      i: 5
      dt: 9
      u: 4
      a: 3
    max_semantic_depth: 3
	logger:
	  file: STDOUT
	  level: info
	search_generator:
	  search_data_file: search_data.js
	  output_encoding: uft-8
	  template: base
	  relative_path_to_files: ../docs/
	  output_frequency_to: frequency.txt
    use_double_metaphone: true
		
===Templates

The shipped templates are very basic, as it is assumed that you integrate the search in your site. The only provide a guidance to how to implement the search on your site.


___________________________________________________________________________
==The MIT License

Copyright (c) 2008 Thomas Peklak

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

About

A semantic offline search in ruby for html files

Resources

Stars

Watchers

Forks

Packages

No packages published