diff --git a/CoC.md b/CoC.md new file mode 100644 index 0000000..55df6a7 --- /dev/null +++ b/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). + diff --git a/README.md b/README.md index 175895f..8dedfd1 100644 --- a/README.md +++ b/README.md @@ -2,42 +2,38 @@ **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, -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. + Copyright (C) 2019, Maxim Lihachev, -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. + 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. -You should have received a copy of the GNU General Public License -along with this program. If not, see . -``` + 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 . # 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: $ make install ``` - # Requests ## 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`. - ### --log apache (default) ```bash @@ -212,7 +206,6 @@ Or pretty-printed: } ``` - ### --log full ```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. To do this, specify the argument `--cached`. - # NGINX For using this service behind nginx web server might be used following configuration: @@ -287,7 +279,7 @@ server { } # This prevents intruders from obtaining information - # about the internal structure of the server. + # about the internal structure of the server. location /info { proxy_pass http://search_backend/health; } diff --git a/app/Main.hs b/app/Main.hs index 3009ce4..e32353d 100644 --- a/app/Main.hs +++ b/app/Main.hs @@ -4,17 +4,16 @@ -- ----------------------------------------------------------------------------- -- Copyright (C) 2019, Maxim Lihachev, - --- 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 . diff --git a/src/Search.hs b/src/Search.hs index 1f9b707..cb1cd03 100644 --- a/src/Search.hs +++ b/src/Search.hs @@ -9,17 +9,16 @@ -- ----------------------------------------------------------------------------- -- Copyright (C) 2019, Maxim Lihachev, - --- 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 . diff --git a/src/Server.hs b/src/Server.hs index d63592b..ddbbc13 100644 --- a/src/Server.hs +++ b/src/Server.hs @@ -9,17 +9,16 @@ -- ----------------------------------------------------------------------------- -- Copyright (C) 2019, Maxim Lihachev, - --- 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 . diff --git a/src/Settings.hs b/src/Settings.hs index 3e6fd53..fb3a84b 100644 --- a/src/Settings.hs +++ b/src/Settings.hs @@ -4,17 +4,16 @@ -- ----------------------------------------------------------------------------- -- Copyright (C) 2019, Maxim Lihachev, - --- 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 .