Skip to content

Search engine for words in files (analogue of web search)

Notifications You must be signed in to change notification settings

OldScripter/Search-in-files

Repository files navigation

# Search-in-files
GitHub author GitHub repo size GitHub author
Search for words in files | Поиск слов в файлах.

Description | Описание

GitHub author
Application for searching of request words (JSON file requests.json) in resources text files (path to resources files are specified in config.json). Search result is putting into answers.json.

GitHub author
Приложение для поиска запрашиваемых слов (JSON файл requests.json) в текстовых файлах ресурсов (путь к ресурсам указан в config.json). Результат поиска помещается в answers.json.

Technologies

GitHub author

GitHub author
https://cmake.org/

GitHub author
https://github.com/nlohmann/json

GitHub author
https://github.com/google/googletest

Building & Running

  • Step 1: Build the project.

    • If you use Visual Studio compiler you can build x64 or x32 version respectively:

      • For x64 version:
        cmake -A x64 -S . -B "build64"
        cmake --build build64 --config Release
      • For x32 version:
        cmake -A Win32 -S . -B "build32"
        cmake --build build32 --config Release
    • In other cases use default build:
      cmake -S . -B "build"
      cmake --build build --config Release

  • Step 2: copy files:
    .\bin\requests.json, .\bin\config.json, .\bin\answers.json and .\bin\resources folder
    from .\bin folder
    to the .\bin\Release folder.

  • Step 3: run the application:
    .\bin\Release\Search_in_files

Files specification

  • config.json
    File where specified name and version of application.
    Here you can also change the maximal quantity of relevant pages that will be put into answers.json (max_respones).
    Default content:
{
    "config": 
    {
        "name": "FileSearchEngine",
        "version": "0.1",
        "max_responses": 5
    },
    "files": 
    [
        "resources/file001.txt",
        "resources/file002.txt"
    ]
}
  • requests.json
    File where specified requests for search.
    Each separate request sholud be entered after ',' on new line. Example below.
    Example content:
{
    "requests":
    [
        "tiger fox",
        "wolf bird",
        "monkey"
    ]
}
  • answers.json
    File where search result will be written in JSON format.
    Example content:
{
  "answers": {
    "request0": {
      "relevance": [
        {
          "docid": 1,
          "rank": 1.0
        },
        {
          "docid": 0,
          "rank": 0.6700000166893005
        }
      ],
      "result": true
    },
    "request1": {
      "relevance": [
        {
          "docid": 0,
          "rank": 1.0
        },
        {
          "docid": 1,
          "rank": 1.0
        }
      ],
      "result": true
    },
    "request2": {
      "docid": 1,
      "rank": 1.0,
      "result": true
    }
  }
}

NOTE:
docid - identificator of a relevant document,
rank - relative index,
result - true (if relevance is found), or false (if document absolutely not relevant for certain request).

About

Search engine for words in files (analogue of web search)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published