Librarian
1.0.0

나는 당신의 마음 속에 있었지만 거기에 없었던 것을 찾을 것입니다.
간단한 CLI는 텍스트 파일을 명령하여 번거로운 소프트웨어없이 전체 텍스트 검색 기술을 적용하는 현명한 방식으로 검색하려는 것입니다.
CLI 명령으로 노출 된 수입 추상화는 필요에 따라 재사용되도록 설계되었습니다. 서비스에 연결할 수 있습니다.
단일 파일 유틸리티 . 파이썬과 Sqlite 만.
Python$ ./configure --enable-loadable-sqlite-extensions Python은 fts5 로드 할 수있는 확장을 활성화 한 SQLITE BINARIE를 준수했습니다. 코드에서 더 이상 설정이 필요하지 않습니다.fts5stemmer.so 선호하는 언어로 대상 파일을 색인화하기위한 공유 라이브러리를 컴파일했습니다. $ python librarian.py -h
usage: librarian.py [-h] [--db DB] [--table TABLE] [--debug] [--sql-trace] {index,match,update} ...
optional arguments:
-h, --help show this help message and exit
--db DB DB file path. (default: librarian.db)
--table TABLE Table name to store files content. (default: documents)
--debug Flag of print additional events. (default: False)
--sql-trace Flag of print sqlite statements. (default: False)
available commands:
Use -h with each of them to get help.
{index,match,update}
index Command to build a db and index. Have to be run once.
match Command to run query on indexed files.
update Command to check if content is changed and update in the database.$ python librarian.py index -h
usage: librarian.py index [-h] [--file-extensions string] [--language LANGUAGE] target
positional arguments:
target Directory or a file to build an index on.
optional arguments:
-h, --help show this help message and exit
--file-extensions string
List of file extensions separated by space which to scan only. (default: frozenset({ ' .md ' }))
--language LANGUAGE list of available languages https://snowballstem.org/algorithms/ (default: russian)
$ python librarian.py match -h
usage: librarian.py match [-h] [--limit LIMIT] [--fields field,...] [--format {raw,csv}] [--snippet 1, ' ' , ' ' , ' ' , ' ' ,10] query
positional arguments:
query Sqlite query term executed by " MATCH " statement. Syntax can be found on https://sqlite.org/fts5.html#full_text_query_syntax.
optional arguments:
-h, --help show this help message and exit
--limit LIMIT Max count of results. (default: 5)
--fields field,... List of document fields to retrieve separated by comma, order is preserved. Choices: ( ' path ' , ' extension ' , ' size ' , ' created ' , ' modified ' , ' hash ' , ' rank ' , ' snippet ' , ' rowid ' ). (default:
( ' path ' , ' snippet ' ))
--format {raw,csv} Choose a results output format. (default: csv)
--snippet 1, ' ' , ' ' , ' ' , ' ' ,10
Snippet properties settings https://sqlite.org/fts5.html#the_snippet_function (default: None)$ python librarian.py update -h
usage: librarian.py update [-h] [--clean]
optional arguments:
-h, --help show this help message and exit
--clean Delete missing file records (default: False)DB를 구축합시다.
$ python librarian.py --debug --sql-trace index ~ /Text-files-documents
SELECT fts5(NULL)
CREATE REAL TABLE IF NOT EXISTS documents
USING FTS5(path, content, extension, sizee, created, modified, tokenize= ' snowball russian ' ) ;
Excluded: /home/user/Text-files-documents/Today
Excluded: /home/user/Text-files-documents/Yesterday
Indexed: /home/user/Text-files-documents/Project/README.md
...그리고 그것을 시도하십시오.
$ python librarian.py match --fields created,path тесты
[(1620583081.3579128,
' /home/user/Text-files-documents/Project/README.md ' ,
' Для запуска тестов нужно поднимать докер-сервисыn nn### Описание запуска ' ),
...