M modules/FinScribe.pmod/Blog.pmod/module.pmod +2 -2
@@ 91,13 91,13 @@ string make_excerpt(string c, int|void l
int loc = search(c, " ", len-1);
// we don't have a space?
- if(loc == -1)
+ if(loc < 1)
{
c = c[0..len] + "...";
}
else
{
- c = c[..loc] + "...";
+ c = c[..(loc-1)] + "...";
}
return c;
M modules/FullText.pmod/UpdateClient.pike +2 -1
@@ 41,7 41,8 @@ int delete_by_uuid(string uuid)
//! contents should be native pike wide strings (not utf8 encoded) if mime type is "text/*" or binary data.
string add(string title, Calendar.Second date, string contents, string handle, string|void excerpt, string mimetype)
{
- if(has_prefix(mimetype, "text/")) contents = string_to_utf8(title);
+ if(has_prefix(mimetype, "text/")) contents = string_to_utf8(contents);
+werror("add content lenth=" + sizeof(contents) + "\n");
return index_call("add", string_to_utf8(title), date->unix_time(),
MIME.encode_base64((contents)), string_to_utf8(handle),
excerpt?string_to_utf8(excerpt):0, mimetype);
M plugins/fulltext/fulltext.pike +5 -1
@@ 220,12 220,16 @@ void doUpdateIndex(string event, object
get_preference("authcode")->get_value());
string t = app->render(obj["current_version"]["contents"], obj, id);
+ string excerpt = 0;
+ if(has_prefix(obj["datatype"]["mimetype"], "text/"))
+ excerpt = FinScribe.Blog.make_excerpt(t, 256);
+
logger->info("Adding content for %O (%d bytes) to full text index.", obj["title"], sizeof(t));
if(obj["path"] && strlen(obj["path"]))
c->delete_by_handle(obj["path"]);
c->add(obj["title"],
obj["current_version"]["created"],
- t, obj["path"], 0,
+ t, obj["path"], excerpt,
obj["datatype"]["mimetype"]);
}