Skip to content

Commit 250e774

Browse files
authored
Code Cleanup (#51)
* update screenshots - update readme, update links * update readme * fix yaml warning * update styles - add html5 doctype
1 parent 6588d99 commit 250e774

File tree

8 files changed

+32
-29
lines changed

8 files changed

+32
-29
lines changed

README.md

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
1-
# Text Sherlock (or Sherlock or TS)
1+
# Text Sherlock (or Sherlock)
22

3-
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.
3+
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.
44

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

77
## Basic Setup
88

99
Instructions:
1010

11-
1. Download [sherlock](https://github.com/cbess/text-sherlock) source from [GitHub](https://github.com/cbess/text-sherlock).
12-
1. Extract/place the sherlock source code in the desired (install) directory. This will be where sherlock lives.
11+
1. Download [Sherlock](https://github.com/cbess/text-sherlock) source from [GitHub](https://github.com/cbess/text-sherlock).
12+
1. Extract/place the Sherlock source code in the desired (install) directory. This will be where Sherlock lives.
1313
1. Run `sh setup/virtualenv-setup.sh` to setup an isolated environment and download core packages.
1414
1. Configure settings. The defaults in [`settings.py`](settings.py) provide documentation for each setting.
1515
- Copy [`example.local_settings.yml`](example.local_settings.yml) to `local_settings.yml`.
1616
- 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.
1717
1. Run `source sherlock_env/bin/activate` to enter the virtual environment.
1818
1. Run `python main.py --index update` or `--index rebuild` to index the path specified in the settings. Watch indexing output.
1919
1. Run `python main.py --runserver` to start the web server.
20-
1. Go to `http://localhost:7777` to access the web interface. Uses the [twitter bootstrap](http://getbootstrap.com/) for its UI.
20+
1. Go to `http://localhost:7777` to access the web interface. Uses the [Bootstrap](https://getbootstrap.com/) toolkit for it's UI.
2121

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

@@ -36,12 +36,12 @@ Includes:
3636
- Main controller script
3737
- Run `main.py -h` for more information.
3838
- End-to-end interface
39-
- 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).
39+
- 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).
4040
- Easily extend indexing or searching via custom backends.
41-
- Front end web app served using [werkzeug](http://werkzeug.pocoo.org/) or [cheroot](https://cheroot.cherrypy.org).
41+
- Front end web app served using [werkzeug](https://palletsprojects.com/p/werkzeug/) or [cheroot](https://cheroot.cherrypy.org).
4242
- `werkzeug` is for development to small traffic.
4343
- `cheroot` is the high-performance, pure-Python HTTP server used by [CherryPy](https://www.cherrypy.org).
44-
- Settings and configuration using [Python](http://python.org).
44+
- Settings and configuration using [Python](https://python.org).
4545

4646
### Web Interface
4747

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

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

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

5959
## Using other backends
6060

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

6868
## Using other web servers
6969

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

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

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

8181
**Requires Python 3.5+**
8282

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

9191
## Other References
9292

93-
* http://twitter.github.com/bootstrap/examples/container-app.html
94-
* http://pygments.org/
93+
* https://pygments.org/
9594
* http://docs.peewee-orm.com/
9695
* https://cheroot.cherrypy.org/
97-
* http://xapian.org/
98-
* http://pyyaml.org/wiki/PyYAMLDocumentation
96+
* https://xapian.org/
97+
* https://pyyaml.org/wiki/PyYAMLDocumentation
98+
* https://zeptojs.com
9999

100100
## Project Goals
101101

102102
1. Provide an easy to setup, fast, and adequate text search engine solution.
103103
1. Be a respectable alternative to [OpenGrok](https://github.com/OpenGrok/OpenGrok).
104-
1. Influence the authors of [OpenGrok](https://github.com/OpenGrok/OpenGrok) to provide a simpler setup process.
105-
- 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).
104+
1. Influence the [OpenGrok](https://github.com/OpenGrok/OpenGrok) contributors to provide a simpler setup process.
105+
- 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).
106106

107107
## Contributors
108108

settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131

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

3636
if config:
3737
print('Loaded Sherlock config settings from %s' % yaml_path)

setup/web-example1.jpg

-545 KB
Binary file not shown.

setup/web-example1.png

163 KB
Loading

setup/web-example2.jpg

-587 KB
Binary file not shown.

setup/web-example2.png

323 KB
Loading

webapp/static/css/main.css

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
*/
44
#content {
55
max-width: 1020px;
6-
margin: 10 auto;
6+
margin: 0 auto;
7+
padding-top: 10px;
78
}
89
#content .search {
910
width: 500px;
@@ -68,6 +69,8 @@ td.linenos pre {
6869
color: #fff;
6970
border-right: none;
7071
padding: 0 10px;
72+
position: relative;
73+
top: -10px;
7174
}
7275
td.linenos pre a {
7376
color: white;

webapp/templates/base.tpl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1+
<!doctype html>
12
<html class="{{ html_css_class }}">
2-
33
<head>
44
<meta http-equiv="Content-type" content="text/html; charset=utf-8"/>
55
<title>{% block title %}{{ title }}{% endblock %} - {{ site_title }}</title>
@@ -42,8 +42,8 @@
4242
{% endblock %}
4343
</div>
4444
<!--
45-
For His glory (Hebrews 1, Colossians 1, Genesis 1).
46-
Copyright 2011 Christopher Bess
45+
Soli Deo gloria (Hebrews 1, Colossians 1, Genesis 1).
46+
Copyright 2020 Christopher Bess
4747
-->
4848
</body>
4949
</html>

0 commit comments

Comments
 (0)