try out modification to use container file name for display, but not search, purposes when the subdocument file name is not set
This commit is contained in:
parent
3d3f917f59
commit
088f1f9a9f
@ -1 +1 @@
|
|||||||
1.20.0
|
1.20.0p1
|
||||||
|
|||||||
@ -724,9 +724,13 @@ FsIndexer::processonefile(RclConfig *config,
|
|||||||
if (doc.url.empty())
|
if (doc.url.empty())
|
||||||
doc.url = cstr_fileu + fn;
|
doc.url = cstr_fileu + fn;
|
||||||
const string *fnp = 0;
|
const string *fnp = 0;
|
||||||
if (doc.ipath.empty() &&
|
if (doc.ipath.empty()) {
|
||||||
(!doc.peekmeta(Rcl::Doc::keyfn, &fnp) || fnp->empty()))
|
if (!doc.peekmeta(Rcl::Doc::keyfn, &fnp) || fnp->empty())
|
||||||
doc.meta[Rcl::Doc::keyfn] = utf8fn;
|
doc.meta[Rcl::Doc::keyfn] = utf8fn;
|
||||||
|
} else {
|
||||||
|
// subdoc: set container file name
|
||||||
|
doc.meta[Rcl::Doc::keytcfn] = utf8fn;
|
||||||
|
}
|
||||||
|
|
||||||
char cbuf[100];
|
char cbuf[100];
|
||||||
sprintf(cbuf, "%lld", (long long)stp->st_size);
|
sprintf(cbuf, "%lld", (long long)stp->st_size);
|
||||||
|
|||||||
@ -1539,6 +1539,21 @@ bool Db::addOrUpdate(const string &udi, const string &parent_udi, Doc &doc)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// At this point, if the document "filename" field was empty,
|
||||||
|
// try to store the "container file name" value. This is done
|
||||||
|
// after indexing because we don't want search matches on
|
||||||
|
// this, but the filename is often useful for display
|
||||||
|
// purposes.
|
||||||
|
const string *fnp = 0;
|
||||||
|
if (!doc.peekmeta(Rcl::Doc::keyfn, &fnp) || fnp->empty()) {
|
||||||
|
if (doc.peekmeta(Rcl::Doc::keytcfn, &fnp) && !fnp->empty()) {
|
||||||
|
string value =
|
||||||
|
neutchars(truncate_to_word(*fnp,
|
||||||
|
m_idxMetaStoredLen), cstr_nc);
|
||||||
|
RECORD_APPEND(record, Rcl::Doc::keyfn, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// If empty pages (multiple break at same pos) were recorded, save
|
// If empty pages (multiple break at same pos) were recorded, save
|
||||||
// them (this is because we have no way to record them in the
|
// them (this is because we have no way to record them in the
|
||||||
// Xapian list
|
// Xapian list
|
||||||
|
|||||||
@ -30,6 +30,7 @@ namespace Rcl {
|
|||||||
const string Doc::keyds("dbytes");
|
const string Doc::keyds("dbytes");
|
||||||
const string Doc::keyfmt("fmtime");
|
const string Doc::keyfmt("fmtime");
|
||||||
const string Doc::keyfn("filename");
|
const string Doc::keyfn("filename");
|
||||||
|
const string Doc::keytcfn("topcontainerfn");
|
||||||
const string Doc::keyfs("fbytes");
|
const string Doc::keyfs("fbytes");
|
||||||
const string Doc::keyipt("ipath");
|
const string Doc::keyipt("ipath");
|
||||||
const string Doc::keykw("keywords");
|
const string Doc::keykw("keywords");
|
||||||
|
|||||||
@ -246,7 +246,19 @@ class Doc {
|
|||||||
// childurl. This is set when working with the parent of the result, to hold
|
// childurl. This is set when working with the parent of the result, to hold
|
||||||
// the child of interest url, typically to highlight a directory entry
|
// the child of interest url, typically to highlight a directory entry
|
||||||
static const string keychildurl;
|
static const string keychildurl;
|
||||||
static const string keyfn; // file name
|
// file name. This is set for filesystem-level containers or
|
||||||
|
// documents, and not inherited by subdocuments (which can get a
|
||||||
|
// keyfn anyway from, e.g, an attachment filename value). Subdocs
|
||||||
|
// used to inherit the file name, but this was undesirable (you
|
||||||
|
// usually don't want to see all subdocs when searching for the
|
||||||
|
// file name). Instead the container file name is now set in the
|
||||||
|
// document record but not indexed (see next entry).
|
||||||
|
static const string keyfn;
|
||||||
|
// Container file name. This is set for all subdocuments of a
|
||||||
|
// given top level container. It is not indexed by default but
|
||||||
|
// stored in the document record keyfn field if this is still
|
||||||
|
// empty when we create it, for display purposes.
|
||||||
|
static const string keytcfn;
|
||||||
static const string keyipt; // ipath
|
static const string keyipt; // ipath
|
||||||
static const string keytp; // mime type
|
static const string keytp; // mime type
|
||||||
static const string keyfmt; // file mtime
|
static const string keyfmt; // file mtime
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user