ALT Linux Community general discussions
 help / color / mirror / Atom feed
From: Eugine Kosenko <eugine.kosenko@gmail.com>
To: ALT Linux Community general discussions <community@lists.altlinux.org>
Subject: Re: [Comm] Как объединить значения для стандартных полей Recoll?
Date: Sun, 2 Aug 2015 16:34:03 +0300
Message-ID: <CAB_XSX2bD3GQK1efm32B+wmNPgQ5_VkGXz9tOfSYkC-jB26BJQ@mail.gmail.com> (raw)
In-Reply-To: <20150728162936.GC4775@imap.altlinux.org>

[-- Attachment #1: Type: text/plain, Size: 2194 bytes --]

В самом деле, автор довольно подробно объяснил нынешнее поведение
Recoll и дал патч, который его исправляет. Прилагаю этот патч к
письму.

Если коротко, то проблема касается только поля автора. Если один
документ вложен в другой (например, pdf вложен в электронное письмо),
и во вложенном документе (pdf) нет автора, то автором вложенного
документа считается автор внешнего (письма). Если же у вложенного
документа автор есть, то он перекрывает внешние
атрибуты, чтобы не приписать ошибочно вложенный документ автору
письма. Сейчас получается, что это же поведение действует для всех
документов, даже если они не вложены. После патча для вложенных
документов поведение должно остаться тем же, а обычные документы будут
принимать автора, заданного внешними атрибутами.

Надеюсь, этот патч можно приложить в нынешнюю официальную сборку Recoll?


2015-07-28 19:29 GMT+03:00, Michael Shigorin <mike@altlinux.org>:
> On Tue, Jul 28, 2015 at 04:25:54PM +0300, Eugine Kosenko wrote:
>> Мне понадобилось добавить к стандартным полям Recoll значения,
>> не заданные в метаданных документа.
>
> Спроси автора, он хороший :)
>
> --
>  ---- WBR, Michael Shigorin / http://altlinux.org
>   ------ http://opennet.ru / http://anna-news.info
> _______________________________________________
> community mailing list
> community@lists.altlinux.org
> https://lists.altlinux.org/mailman/listinfo/community

[-- Attachment #2: keep-topmost-author.patch --]
[-- Type: text/x-patch, Size: 2047 bytes --]

diff -r 10d2775fb628 src/internfile/internfile.cpp
--- a/src/internfile/internfile.cpp	Fri Jul 31 13:01:02 2015 +0200
+++ b/src/internfile/internfile.cpp	Fri Jul 31 17:58:44 2015 +0200
@@ -551,6 +551,10 @@
 // also set the author and modification time from the last doc which
 // has them.
 //
+// The stack can contain objects with an ipath element (corresponding
+// to actual embedded documents), and, at the top, elements without an
+// ipath element, corresponding to format translations of the last doc.
+//
 // The docsize is fetched from the first element without an ipath
 // (first non container). If the last element directly returns
 // text/plain so that there is no ipath-less element, the value will
@@ -579,7 +583,8 @@
 	const map<string, string>& docdata = (*hit)->get_meta_data();
 	if (getKeyValue(docdata, cstr_dj_keyipath, ipathel)) {
 	    if (!ipathel.empty()) {
-		// We have a non-empty ipath
+		// Non-empty ipath. This stack element is for an
+		// actual embedded document, not a format translation.
 		hasipath = true;
 		getKeyValue(docdata, cstr_dj_keymt, doc.mimetype);
 		getKeyValue(docdata, cstr_dj_keyfn, doc.meta[Rcl::Doc::keyfn]);
@@ -593,9 +598,19 @@
 		getKeyValue(docdata, cstr_dj_keydocsize, doc.fbytes);
 	    doc.ipath += cstr_isep;
 	}
+        // We set the author field from the innermost doc which has
+        // one: allows finding, e.g. an image attachment having no
+        // metadata by a search on the sender name. Only do this for
+        // actually embedded documents (avoid replacing values from
+        // metacmds for the topmost one). For a topmost doc, author
+        // will be merged by dijontorcl() later on. About same for
+        // dmtime, but an external value will be replaced, not
+        // augmented if dijontorcl() finds an internal value.
+        if (hasipath) {
 	getKeyValue(docdata, cstr_dj_keyauthor, doc.meta[Rcl::Doc::keyau]);
 	getKeyValue(docdata, cstr_dj_keymd, doc.dmtime);
     }
+    }
 
     // Trim empty tail elements in ipath.
     if (hasipath) {

  reply	other threads:[~2015-08-02 13:34 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-28 13:25 Eugine Kosenko
2015-07-28 16:29 ` Michael Shigorin
2015-08-02 13:34   ` Eugine Kosenko [this message]
2015-08-02 21:07     ` Michael Shigorin
2015-08-03 13:29       ` Eugine Kosenko
2015-08-03 16:51         ` Michael Shigorin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAB_XSX2bD3GQK1efm32B+wmNPgQ5_VkGXz9tOfSYkC-jB26BJQ@mail.gmail.com \
    --to=eugine.kosenko@gmail.com \
    --cc=community@lists.altlinux.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

ALT Linux Community general discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://lore.altlinux.org/community/0 community/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 community community/ http://lore.altlinux.org/community \
		mandrake-russian@linuxteam.iplabs.ru community@lists.altlinux.org community@lists.altlinux.ru community@lists.altlinux.com
	public-inbox-index community

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://lore.altlinux.org/org.altlinux.lists.community


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git