Browse Source

Added GPLv3 license and CoC

master
Maxim Likhachev 6 years ago
parent
commit
04467412e5
  1. 7
      CoC.md
  2. 24
      README.md
  3. 13
      app/Main.hs
  4. 13
      src/Search.hs
  5. 13
      src/Server.hs
  6. 13
      src/Settings.hs

7
CoC.md

@ -0,0 +1,7 @@ @@ -0,0 +1,7 @@
# Go Fuck Yourself
Offended? Go away. We don't need people who are offended because of a stranger on the internet.
Not offended? You're welcome to contribute.
© Copyright 2015 [WTFCoC Consortium Committee](https://github.com/mniip/wtfcoc).

24
README.md

@ -2,22 +2,20 @@ @@ -2,22 +2,20 @@
**v0.1.0**
This application provides fuzzy search server for data stored in JSON format.
The purpose of the development of this application was to use it with the website written on [Jekyll](https://jekyllrb.com/).
The purpose of the development of this application was to use it with the
website written on [Jekyll](https://jekyllrb.com/).
---
## License
```
Copyright (C) 2019, Maxim Lihachev, <envrm@yandex.ru>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the Free
Software Foundation, version 3.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
@ -25,19 +23,17 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the @@ -25,19 +23,17 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
```
along with this program. If not, see <http://www.gnu.org/licenses/>.
# Algorithm
The logic of this application is pretty simple:
A logic of this application is pretty simple:
* All fields in the file are divided into separate words.
* Each unique word in the search string is compared to the words in the file.
* If the match is exact, the highest score is awarded.
* If there is an inaccurate coincidence, the [Levenshtein distance](https://en.wikipedia.org/wiki/Levenshtein_distance) is calculated and the word score is formed on its basis.
* Results are sorted in descending order of accuracy.
# How to use
## Build
@ -84,7 +80,6 @@ Common flags: @@ -84,7 +80,6 @@ Common flags:
$ make install
```
# Requests
## Get Server Settings
@ -146,7 +141,6 @@ $ curl -sq http://localhost:3000/search?query=article @@ -146,7 +141,6 @@ $ curl -sq http://localhost:3000/search?query=article
There are few formats for log messages. It is possible to disable logs completely passing argument `--log disable`.
### --log apache (default)
```bash
@ -212,7 +206,6 @@ Or pretty-printed: @@ -212,7 +206,6 @@ Or pretty-printed:
}
```
### --log full
```bash
@ -257,7 +250,6 @@ Request @@ -257,7 +250,6 @@ Request
It is possible to store all data in RAM and use it even if the file is not readable.
To do this, specify the argument `--cached`.
# NGINX
For using this service behind nginx web server might be used following configuration:

13
app/Main.hs

@ -4,17 +4,16 @@ @@ -4,17 +4,16 @@
-- -----------------------------------------------------------------------------
-- Copyright (C) 2019, Maxim Lihachev, <envrm@yandex.ru>
-- This program is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is free software: you can redistribute it and/or modify it
-- under the terms of the GNU General Public License as published by the Free
-- Software Foundation, version 3.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.

13
src/Search.hs

@ -9,17 +9,16 @@ @@ -9,17 +9,16 @@
-- -----------------------------------------------------------------------------
-- Copyright (C) 2019, Maxim Lihachev, <envrm@yandex.ru>
-- This program is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is free software: you can redistribute it and/or modify it
-- under the terms of the GNU General Public License as published by the Free
-- Software Foundation, version 3.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.

13
src/Server.hs

@ -9,17 +9,16 @@ @@ -9,17 +9,16 @@
-- -----------------------------------------------------------------------------
-- Copyright (C) 2019, Maxim Lihachev, <envrm@yandex.ru>
-- This program is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is free software: you can redistribute it and/or modify it
-- under the terms of the GNU General Public License as published by the Free
-- Software Foundation, version 3.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.

13
src/Settings.hs

@ -4,17 +4,16 @@ @@ -4,17 +4,16 @@
-- -----------------------------------------------------------------------------
-- Copyright (C) 2019, Maxim Lihachev, <envrm@yandex.ru>
-- This program is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is free software: you can redistribute it and/or modify it
-- under the terms of the GNU General Public License as published by the Free
-- Software Foundation, version 3.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.

Loading…
Cancel
Save