Browse Source

Added GPLv3 license and CoC

master
Maxim Likhachev 6 years ago
parent
commit
04467412e5
  1. 7
      CoC.md
  2. 36
      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 @@
# 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).

36
README.md

@ -2,42 +2,38 @@
**v0.1.0** **v0.1.0**
This application provides fuzzy search server for data stored in JSON format. 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
The purpose of the development of this application was to use it with the website written on [Jekyll](https://jekyllrb.com/). website written on [Jekyll](https://jekyllrb.com/).
--- ---
## License ## License
```
Copyright (C) 2019, Maxim Lihachev, <envrm@yandex.ru>
This program is free software: you can redistribute it and/or modify Copyright (C) 2019, Maxim Lihachev, <envrm@yandex.ru>
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 distributed in the hope that it will be useful, This program is free software: you can redistribute it and/or modify it
but WITHOUT ANY WARRANTY; without even the implied warranty of under the terms of the GNU General Public License as published by the Free
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Software Foundation, version 3.
GNU General Public License for more details.
You should have received a copy of the GNU General Public License This program is distributed in the hope that it will be useful,
along with this program. If not, see <https://www.gnu.org/licenses/>. 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/>.
# Algorithm # 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. * 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. * 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 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. * 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. * Results are sorted in descending order of accuracy.
# How to use # How to use
## Build ## Build
@ -84,7 +80,6 @@ Common flags:
$ make install $ make install
``` ```
# Requests # Requests
## Get Server Settings ## Get Server Settings
@ -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`. There are few formats for log messages. It is possible to disable logs completely passing argument `--log disable`.
### --log apache (default) ### --log apache (default)
```bash ```bash
@ -212,7 +206,6 @@ Or pretty-printed:
} }
``` ```
### --log full ### --log full
```bash ```bash
@ -257,7 +250,6 @@ Request
It is possible to store all data in RAM and use it even if the file is not readable. 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`. To do this, specify the argument `--cached`.
# NGINX # NGINX
For using this service behind nginx web server might be used following configuration: For using this service behind nginx web server might be used following configuration:

13
app/Main.hs

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

13
src/Search.hs

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

13
src/Server.hs

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

13
src/Settings.hs

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

Loading…
Cancel
Save