Восстановить текстовые файлы и структуру каталогов из базы данных, созданной Recoll?

Como cualquier proceso,makeno puede modificar el entorno de un proceso existente , solo puede controlar el entorno que se pasa a los procesos que inicia. A falta de llenar el búfer de entrada, no hay forma de hacer lo que está tratando de hacer.

Además, makeprocesa cada línea de comando en un shell diferente, por lo que sus líneas set -a, ../.envy set +ase ejecutan en shells separados. Los efectos de ../.envsolo se verán en el shell que ejecuta ese comando.

3
15.12.2012, 18:52
1 ответ

Во-первых, мои соболезнования в связи с потерей ваших данных. Этот ответ, вероятно, бесполезен для вас спустя почти 8 лет после факта, но я отвечу на него с надеждой, что он может быть полезен кому-то еще.

I wonder if I can recover the deleted text files from Recoll's database?

Да, восстановить реконструированный текст документа можно, но с некоторыми оговорками.

I wonder if I can recover the directory structure of my partition from Recoll's database?

Да, вы можете восстановить пути к файлам и восстановить оттуда структуру каталогов, опять же с некоторыми оговорками.

Это можно сделать с помощью команды xadump, которая поставляется с recoll:

.

The xadump command is a low-level access and diagnostic tool for a Xapian index as organized by the Recoll indexer. The index directory to be used is specified with option -d.

Options -D, -X, -T and -r take a single docid argument specified with option -i. -D displays the document data record.

[... ]

-r prints the document text as reconstructed from index data.

[... ]

With option -q, xadump performs a simple AND query on the index, using the given term arguments.

https://www.lesbonscomptes.com/recoll/manpages/xadump.1.html

Так, например, чтобы выполнить поиск по запросу "независимость",эта команда будет работать:

xadump -d ~/.recoll/xapiandb/ -q 'independence' | less

Первая часть результатов запроса у меня выглядит так:

DB: ndocs 100204 lastdocid 105155 avglength 7675.26
DB: terms are stripped
Performing query `Query(independence)'
Estimated results: 659

Один из результатов выглядит так:

Document ID 89464 98% [url=file:///home/nathaniel/Dropbox/archive/2020/personal/projects/public-domain-documents/declaration-of-independence-html/index.html

mtype=text/html

fmtime=01585682999

origcharset=utf-8

fbytes=9365

pcbytes=9365

dbytes=8124

sig=93651585683000

caption= The Declaration of Independence of the United States of America

abstract=?!#@ THE DECLARATION OF INDEPENDENCE OF THE UNITED STATES OF AMERICA When in the Course of human events, it becomes necessary for one people to dissolve the political bands which have connected them with another, and to assume, among the Powers of the

filename=index.html

]

Итак, вы можете увидеть file://URL с путем:

/home/nathaniel/Dropbox/archive/2020/personal/projects/public-domain-documents/declaration-of-independence-html/index.html

Конечно, чтобы воссоздать полную структуру каталогов, вам придется сделать это для каждого документа. Вероятно, это можно было бы автоматизировать, но это было бы сложно и потребовало -времени, чтобы сделать все правильно. Это также не помогло бы восстановить файлы, которые не были проиндексированы.

С помощью этой команды мы можем восстановить текст документа:

xadump -d ~/.recoll/xapiandb/ -i 89464 -r

Что дает это (Я обрезал третью строку для краткости):

DB: ndocs 100204 lastdocid 105155 avglength 7675.26

DB: terms are stripped

XP XPhome XPnathaniel XPDropbox XParchive XP2020 XPpersonal XPprojects XPpublic-domain-documents XPdeclaration-of-independence-html XCFNXXST XCFNindex.html XCFNhtml XCFNXXND SXXST the declaration of independence of the united states of america SXXND XSFNXXST index.html html XSFNXXND XXST the declaration of independence of the united states of america when in the course of human events it becomes necessary for one people to dissolve the political bands which have connected them with another and to assume among the powers of the earth the separate and equal station to which the laws of nature and of nature's s god entitle them a decent respect to the opinions of mankind requires that they should declare the causes which impel them to the separation[...]

Вот исходный HTML-файл:

<h1>
  THE DECLARATION OF INDEPENDENCE OF THE UNITED STATES OF AMERICA
</h1>
<p>
When in the Course of human events, it becomes necessary for one people to
dissolve the political bands which have connected them with another, and to
assume, among the Powers of the earth, the separate and equal station to
which the Laws of Nature and of Nature's God entitle them, a decent respect
to the opinions of mankind requires that they should declare the causes
which impel them to the separation.
</p>

Обратите внимание, что он содержит реконструированный текст, но есть некоторые проблемы.:

  1. Без заглавных букв. Все в нижнем регистре.

  2. Без знаков препинания.

  3. Нет разрывов строки -. Все в одной строке.

Это не только HTML; вот часть восстановленного текста простой -текстовой версии Project Gutenberg «Разум и чувства»:

sense and sensibility by jane austen 1811 chapter 1 the family of dashwood had long been settled in sussex their estate was large and their residence was at norland park in the centre of their property where for many generations they had lived in so respectable a manner as to engage the general good opinion of their surrounding acquaintance

А вот и исходный текст:

SENSE AND SENSIBILITY

by Jane Austen

(1811)




CHAPTER 1


The family of Dashwood had long been settled in Sussex.  Their estate
was large, and their residence was at Norland Park, in the centre of
their property, where, for many generations, they had lived in so
respectable a manner as to engage the general good opinion of their
surrounding acquaintance.

https://www.gutenberg.org/cache/epub/161/pg161.txt

Обратите внимание, что выходные данные включают lastdocid 105155. Имея это в виду, вот набросок того, как может выглядеть скрипт для вывода реконструированного текста:

#! /usr/bin/env bash

IMAX=105155
for ((i=1;i<=IMAX;i++))
do
    xadump -d ~/.recoll/xapiandb/ -i "$i" -r > "$i.txt"
done

Выполнение этого для первых 100 документов заняло на моем компьютере около 3 секунд, поэтому для полных 100 000 документов, вероятно, потребуется чуть меньше часа.

1
08.05.2020, 14:15

Теги

Похожие вопросы