Skip to content

Commit

Permalink
Merge branch 'develop' of rcbuilder.ch.internal:oss/spindle into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
nevali committed Aug 11, 2017
2 parents aad061b + 12ec52d commit f0104a5
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
4 changes: 4 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 9 additions & 1 deletion twine/common/db-schema.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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;
}
4 changes: 3 additions & 1 deletion twine/generate/index-about.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
*
* Author: Mo McRoberts <[email protected]>
*
* 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.
Expand Down Expand Up @@ -53,13 +53,15 @@ 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
*/
if(sql_executef(sql, "INSERT INTO \"about\" (\"id\", \"about\") VALUES (%Q, %Q)", id, id))
{
return -1;
}
#endif
if(!(query = librdf_new_statement(data->spindle->world)))
{
return -1;
Expand Down

0 comments on commit f0104a5

Please sign in to comment.