diff --git a/configure.ac b/configure.ac index 70f4df4..771c4bf 100644 --- a/configure.ac +++ b/configure.ac @@ -70,6 +70,10 @@ AC_SUBST([spindlehtdocdir]) BT_DEFINE_PREFIX +# Build options + +AC_DEFINE_UNQUOTED([SPINDLE_ENABLE_ABOUT_SELF], [0], [Whether to enable 'items are about themselves' in the index]) + AC_CONFIG_FILES([Makefile m4/Makefile twine/Makefile diff --git a/twine/common/db-schema.c b/twine/common/db-schema.c index 22040b0..9ad5333 100644 --- a/twine/common/db-schema.c +++ b/twine/common/db-schema.c @@ -27,7 +27,7 @@ * 1..DB_SCHEMA_VERSION must be handled individually in spindle_db_migrate_ * below. */ -#define DB_SCHEMA_VERSION 25 +#define DB_SCHEMA_VERSION 26 static int spindle_db_migrate_(SQL *restrict, const char *identifier, int newversion, void *restrict userdata); @@ -506,6 +506,14 @@ spindle_db_migrate_(SQL *restrict sql, const char *identifier, int newversion, v } return 0; } + if(newversion == 26) + { + if(sql_execute(sql, "DELETE FROM \"about\" WHERE \"id\" = \"about\"")) + { + return -1; + } + return 0; + } twine_logf(LOG_NOTICE, PLUGIN_NAME ": unsupported database schema version %d\n", newversion); return -1; } diff --git a/twine/generate/index-about.c b/twine/generate/index-about.c index 5cd2184..2c5040d 100644 --- a/twine/generate/index-about.c +++ b/twine/generate/index-about.c @@ -2,7 +2,7 @@ * * Author: Mo McRoberts * - * Copyright (c) 2014-2015 BBC + * Copyright (c) 2014-2017 BBC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -53,6 +53,7 @@ spindle_index_about(SQL *sql, const char *id, SPINDLEENTRY *data) NULL }; +#if SPINDLE_ENABLE_ABOUT_SELF /* Force an entity to always 'about' itself, so that queries match both * topics and the things about those topics */ @@ -60,6 +61,7 @@ spindle_index_about(SQL *sql, const char *id, SPINDLEENTRY *data) { return -1; } +#endif if(!(query = librdf_new_statement(data->spindle->world))) { return -1;