Skip to content

Commit

Permalink
Code Cleanup (#51)
Browse files Browse the repository at this point in the history
* update screenshots
- update readme, update links
* update readme
* fix yaml warning
* update styles
- add html5 doctype
  • Loading branch information
cbess authored Mar 22, 2020
1 parent 6588d99 commit 250e774
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 29 deletions.
48 changes: 24 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
# Text Sherlock (or Sherlock or TS)
# Text Sherlock (or Sherlock)

Provides a fast, easy to install and use search engine for text but, mostly for source code. [OpenGrok](https://github.com/OpenGrok/OpenGrok) requires too much time to install (though it may be worth it for some). Sherlock will give you a much easier setup, a text indexer, and a web app interface for searching.
Provides a fast, easy to install and simple to use search engine for text, but optimized for source code. An alternative, [OpenGrok](https://github.com/OpenGrok/OpenGrok), requires too much time to install (though it may be worth it for some), but is more feature rich. Text Sherlock will give you a much easier setup, a text indexer, and a web app interface for searching with _very little_ effort.

[Soli Deo Gloria](https://perfectGod.com)

## Basic Setup

Instructions:

1. Download [sherlock](https://github.com/cbess/text-sherlock) source from [GitHub](https://github.com/cbess/text-sherlock).
1. Extract/place the sherlock source code in the desired (install) directory. This will be where sherlock lives.
1. Download [Sherlock](https://github.com/cbess/text-sherlock) source from [GitHub](https://github.com/cbess/text-sherlock).
1. Extract/place the Sherlock source code in the desired (install) directory. This will be where Sherlock lives.
1. Run `sh setup/virtualenv-setup.sh` to setup an isolated environment and download core packages.
1. Configure settings. The defaults in [`settings.py`](settings.py) provide documentation for each setting.
- Copy [`example.local_settings.yml`](example.local_settings.yml) to `local_settings.yml`.
- Override/copy any setting from [`settings.py`](settings.py) to `local_settings.yml` (change the values as needed). All YAML keys/options **must** be lowercase.
1. Run `source sherlock_env/bin/activate` to enter the virtual environment.
1. Run `python main.py --index update` or `--index rebuild` to index the path specified in the settings. Watch indexing output.
1. Run `python main.py --runserver` to start the web server.
1. Go to `http://localhost:7777` to access the web interface. Uses the [twitter bootstrap](http://getbootstrap.com/) for its UI.
1. Go to `http://localhost:7777` to access the web interface. Uses the [Bootstrap](https://getbootstrap.com/) toolkit for it's UI.

You may need to install some packages before a *Ubuntu* installation will run without error.

Expand All @@ -36,12 +36,12 @@ Includes:
- Main controller script
- Run `main.py -h` for more information.
- End-to-end interface
- Indexing and searching text (source code). Built-in support for [whoosh](https://whoosh.readthedocs.io) (fast searching) or [xapian](http://xapian.org/) (much faster searching).
- Indexing and searching text (source code). Built-in support for [whoosh](https://whoosh.readthedocs.io/en/stable/index.html) (fast searching) or [xapian](https://xapian.org/) (much faster searching).
- Easily extend indexing or searching via custom backends.
- Front end web app served using [werkzeug](http://werkzeug.pocoo.org/) or [cheroot](https://cheroot.cherrypy.org).
- Front end web app served using [werkzeug](https://palletsprojects.com/p/werkzeug/) or [cheroot](https://cheroot.cherrypy.org).
- `werkzeug` is for development to small traffic.
- `cheroot` is the high-performance, pure-Python HTTP server used by [CherryPy](https://www.cherrypy.org).
- Settings and configuration using [Python](http://python.org).
- Settings and configuration using [Python](https://python.org).

### Web Interface

Expand All @@ -52,9 +52,9 @@ Append to document URL.
- To highlight lines, append to URL: `&hl=3,7,12-14,21`
- To jump to a line, append to end of URL: `#line-3`

![screenshot](https://github.com/cbess/text-sherlock/raw/master/setup/web-example1.jpg)
![screenshot](setup/web-example1.png)

![screenshot](https://github.com/cbess/text-sherlock/raw/master/setup/web-example2.jpg)
![screenshot](setup/web-example2.png)

## Using other backends

Expand All @@ -67,7 +67,7 @@ In [`settings.py`](settings.py):

## Using other web servers

Text Sherlock has built-in support for [werkzeug](http://werkzeug.pocoo.org/) and [cheroot](https://cheroot.cherrypy.org) WSGI compliant servers.
Text Sherlock has built-in support for [werkzeug](https://palletsprojects.com/p/werkzeug/) and [cheroot](https://cheroot.cherrypy.org) WSGI compliant servers.

In [`settings.py`](settings.py):

Expand All @@ -80,29 +80,29 @@ In [`settings.py`](settings.py):

**Requires Python 3.5+**

* Whoosh - [whoosh](https://whoosh.readthedocs.io/en/latest/quickstart.html#a-quick-introduction)
* Flask - [flask](http://flask.pocoo.org)
* Jinja2 - [jinja2](http://jinja.pocoo.org/docs)
* Pygments - [pygments](http://pygments.org/docs/quickstart)
* peewee - [peewee](https://github.com/coleifer/peewee)
* Twitter Bootstrap v2.x - [twitter bootstrap](http://getbootstrap.com/2.3.2/)
* PyYAML - [pyyaml](http://pyyaml.org)
* [Whoosh](https://whoosh.readthedocs.io/en/stable/quickstart.html)
* [Flask](https://palletsprojects.com/p/flask/)
* [Jinja2](https://jinja.palletsprojects.com/en/2.11.x/)
* [Pygments](https://pygments.org/docs/quickstart/)
* [peewee](https://github.com/coleifer/peewee)
* [Bootstrap v4.x](https://getbootstrap.com/docs/4.4/getting-started/introduction/)
* [PyYAML](https://pyyaml.org)

## Other References

* http://twitter.github.com/bootstrap/examples/container-app.html
* http://pygments.org/
* https://pygments.org/
* http://docs.peewee-orm.com/
* https://cheroot.cherrypy.org/
* http://xapian.org/
* http://pyyaml.org/wiki/PyYAMLDocumentation
* https://xapian.org/
* https://pyyaml.org/wiki/PyYAMLDocumentation
* https://zeptojs.com

## Project Goals

1. Provide an easy to setup, fast, and adequate text search engine solution.
1. Be a respectable alternative to [OpenGrok](https://github.com/OpenGrok/OpenGrok).
1. Influence the authors of [OpenGrok](https://github.com/OpenGrok/OpenGrok) to provide a simpler setup process.
- I successfully setup two installations on CentOS and Ubuntu 11.x and each time it took more than two hours. TS setup takes less than 10 minutes (excluding package download time).
1. Influence the [OpenGrok](https://github.com/OpenGrok/OpenGrok) contributors to provide a simpler setup process.
- I successfully setup two installations of OpenGrok on CentOS and Ubuntu 11.x. Each time it took more than **two hours**. Text Sherlock setup takes less than 5 minutes (excluding package download time).

## Contributors

Expand Down
2 changes: 1 addition & 1 deletion settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

# try to load the config
if yaml_path and os.path.isfile(yaml_path):
config = yaml.load(open(yaml_path, 'r'))
config = yaml.load(open(yaml_path, 'r'), Loader=yaml.SafeLoader)

if config:
print('Loaded Sherlock config settings from %s' % yaml_path)
Expand Down
Binary file removed setup/web-example1.jpg
Binary file not shown.
Binary file added setup/web-example1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed setup/web-example2.jpg
Binary file not shown.
Binary file added setup/web-example2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 4 additions & 1 deletion webapp/static/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
*/
#content {
max-width: 1020px;
margin: 10 auto;
margin: 0 auto;
padding-top: 10px;
}
#content .search {
width: 500px;
Expand Down Expand Up @@ -68,6 +69,8 @@ td.linenos pre {
color: #fff;
border-right: none;
padding: 0 10px;
position: relative;
top: -10px;
}
td.linenos pre a {
color: white;
Expand Down
6 changes: 3 additions & 3 deletions webapp/templates/base.tpl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!doctype html>
<html class="{{ html_css_class }}">

<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8"/>
<title>{% block title %}{{ title }}{% endblock %} - {{ site_title }}</title>
Expand Down Expand Up @@ -42,8 +42,8 @@
{% endblock %}
</div>
<!--
For His glory (Hebrews 1, Colossians 1, Genesis 1).
Copyright 2011 Christopher Bess
Soli Deo gloria (Hebrews 1, Colossians 1, Genesis 1).
Copyright 2020 Christopher Bess
-->
</body>
</html>

0 comments on commit 250e774

Please sign in to comment.