added field/prefixes for author and title + command line query language
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
#ifndef lint
|
||||
static char rcsid[] = "@(#$Id: internfile.cpp,v 1.24 2007-01-15 13:06:38 dockes Exp $ (C) 2004 J.F.Dockes";
|
||||
static char rcsid[] = "@(#$Id: internfile.cpp,v 1.25 2007-01-17 13:53:40 dockes Exp $ (C) 2004 J.F.Dockes";
|
||||
#endif
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@@ -236,6 +236,7 @@ static inline bool getKeyValue(const map<string, string>& docdata,
|
||||
}
|
||||
|
||||
static const string keyab("abstract");
|
||||
static const string keyau("author");
|
||||
static const string keycs("charset");
|
||||
static const string keyct("content");
|
||||
static const string keyfn("filename");
|
||||
@@ -251,6 +252,7 @@ bool FileInterner::dijontorcl(Rcl::Doc& doc)
|
||||
Dijon::Filter *df = m_handlers.back();
|
||||
const std::map<std::string, std::string>& docdata = df->get_meta_data();
|
||||
|
||||
getKeyValue(docdata, keyau, doc.author);
|
||||
getKeyValue(docdata, keyoc, doc.origcharset);
|
||||
getKeyValue(docdata, keyct, doc.text);
|
||||
getKeyValue(docdata, keytt, doc.title);
|
||||
|
||||
@@ -122,6 +122,7 @@ bool MimeHandlerHtml::next_document()
|
||||
m_metaData["charset"] = "utf-8";
|
||||
m_metaData["title"] = result.title;
|
||||
m_metaData["keywords"] = result.keywords;
|
||||
m_metaData["author"] = result.author;
|
||||
m_metaData["modificationdate"] = result.dmtime;
|
||||
m_metaData["sample"] = result.sample;
|
||||
m_metaData["mimetype"] = "text/plain";
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#ifndef lint
|
||||
static char rcsid[] = "@(#$Id: mh_mail.cpp,v 1.28 2007-01-13 10:28:37 dockes Exp $ (C) 2005 J.F.Dockes";
|
||||
static char rcsid[] = "@(#$Id: mh_mail.cpp,v 1.29 2007-01-17 13:53:40 dockes Exp $ (C) 2005 J.F.Dockes";
|
||||
#endif
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@@ -217,6 +217,9 @@ bool MimeHandlerMail::processMsg(Binc::MimePart *doc, int depth)
|
||||
if (doc->h.getFirstHeader("From", hi)) {
|
||||
rfc2047_decode(hi.getValue(), transcoded);
|
||||
text += string("From: ") + transcoded + string("\n");
|
||||
if (depth == 1) {
|
||||
m_metaData["author"] = transcoded;
|
||||
}
|
||||
}
|
||||
if (doc->h.getFirstHeader("To", hi)) {
|
||||
rfc2047_decode(hi.getValue(), transcoded);
|
||||
@@ -245,7 +248,7 @@ bool MimeHandlerMail::processMsg(Binc::MimePart *doc, int depth)
|
||||
}
|
||||
text += '\n';
|
||||
|
||||
LOGDEB2(("MimeHandlerMail::rocessMsg:ismultipart %d mime subtype '%s'\n",
|
||||
LOGDEB2(("MimeHandlerMail::processMsg:ismultipart %d mime subtype '%s'\n",
|
||||
doc->isMultipart(), doc->getSubType().c_str()));
|
||||
walkmime(doc, depth);
|
||||
|
||||
|
||||
@@ -154,6 +154,11 @@ MyHtmlParser::opening_tag(const string &tag, const map<string,string> &p)
|
||||
string tmp = i->second;
|
||||
decode_entities(tmp);
|
||||
keywords += tmp;
|
||||
} else if (name == "author") {
|
||||
if (!author.empty()) author += ' ';
|
||||
string tmp = i->second;
|
||||
decode_entities(tmp);
|
||||
author += tmp;
|
||||
} else if (name == "date") {
|
||||
// Yes this doesnt exist. It's output by filters
|
||||
// And the format isn't even standard http/html
|
||||
@@ -168,19 +173,6 @@ MyHtmlParser::opening_tag(const string &tag, const map<string,string> &p)
|
||||
dmtime = ascuxtime;
|
||||
}
|
||||
}
|
||||
#if 0 // We're not a robot, so we don't care about robots metainfo
|
||||
else if (name == "robots") {
|
||||
string val = i->second;
|
||||
decode_entities(val);
|
||||
lowercase_term(val);
|
||||
if (val.find("none") != string::npos ||
|
||||
val.find("noindex") != string::npos) {
|
||||
indexing_allowed = false;
|
||||
LOGDEB1(("myhtmlparse: robots/noindex\n"));
|
||||
throw false;
|
||||
}
|
||||
}
|
||||
#endif // 0
|
||||
} else if ((j = p.find("http-equiv")) != p.end()) {
|
||||
string hequiv = j->second;
|
||||
lowercase_term(hequiv);
|
||||
|
||||
@@ -37,7 +37,7 @@ class MyHtmlParser : public HtmlParser {
|
||||
bool in_body_tag;
|
||||
bool in_pre_tag;
|
||||
bool pending_space;
|
||||
string title, sample, keywords, dump, dmtime;
|
||||
string title, sample, keywords, dump, dmtime, author;
|
||||
string ocharset; // This is the charset our user thinks the doc was
|
||||
string charset; // This is the charset it was supposedly converted to
|
||||
string doccharset; // Set this to value of charset parameter in header
|
||||
|
||||
Reference in New Issue
Block a user