I have a WordPress MU (WPMU) install that I am trying to index in Solr (1.4). The way the database is set up in WPMU is that there is a master blogs table that contains some information about each blog and the primary blog ID. This blog ID is then used to create/access the necessary database tables.
ex:
Blog ID = 3 -> wp_3_posts
Blog ID = 4 -> wp_4_posts
Blog ID = N -> wp_N_posts
By using the rootEntity option in the Solr config I am able to build queries that properly index posts from all of the defined blogs. The problem arises when I try to do a deltaImport. Solr throws an exception:
org.apache.solr.handler.dataimport.DataImportHandlerException: Unable to execute query: SELECT
p.
IDFROM wp__posts p WHERE
p.
post_modified> '2010-01-19 11:32:44'
It's clear that it is not getting the blog ID from the first query. Is there anything wrong with the way I have my configuration? If there is nothing wrong with how I have my configuration, how can I implement the deltaImport while requiring the blog IDs to build the table names?
<entity
name="blogs"
pk="blog_id"
dataSource="blogs"
rootEntity="false"
onError="skip" <!-- this doesn't seem to work at all -->
query="SELECT b.blog_id, b.domain FROM wp_blogs b WHERE b.public = 1"
deltaQuery="SELECT b.blog_id, b.domain FROM wp_blogs b WHERE b.public = 1" <!-- i added this for testing purposes -->
>
<entity
name="blogs_post"
pk="ID"
dataSource="blogs"
onError="skip" <!-- this doesn't seem to work at all -->
query="SELECT p.ID, p.post_content, p.post_title FROM wp_${blogs.blog_id}_posts p WHERE p.post_status = 'publish'"
deltaQuery="SELECT p.ID FROM wp_${blogs.blog_id}_posts p WHERE p.post_modified > '${dataimporter.last_index_time}'"
deltaImportQuery="SELECT p.ID, p.post_content, p.post_title FROM wp_${blogs.blog_id}_posts p WHERE p.ID = ${dataimporter.delta.ID}"
>
<!-- snip fields -->
</entity>
</entity>