Guest User

Untitled

a guest
Apr 10th, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.37 KB | None | 0 0
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <!--
  3.  
  4. Put this below 'config' in solr/conf/solrconfig.xml
  5.  
  6. <requestHandler name="/dataimport" class="org.apache.solr.handler.dataimport.DataImportHandler">
  7. <lst name="defaults">
  8. <str name="config">/tmp/dataimport-wordpress.xml</str>
  9. </lst>
  10. </requestHandler>
  11.  
  12.  
  13. This file is dataimport-wordpress.xml
  14.  
  15. -->
  16.  
  17. <dataConfig>
  18. <dataSource type="JdbcDataSource" driver="com.mysql.jdbc.Driver" url="jdbc:mysql://localhost/wp" user="root" password="" readOnly="true" batchSize="-1" />
  19. <document name="wordpress">
  20.  
  21. <!-- Iterate over each Wordpress tablename prefix found in the information schema -->
  22. <entity
  23. name="blogtables"
  24. recursive="true"
  25. query="SELECT REPLACE(TABLE_NAME, '_posts', '') AS blog FROM information_schema.TABLES WHERE TABLE_SCHEMA=DATABASE() AND TABLE_NAME NOT LIKE 'wp_nwt_%' AND TABLE_NAME LIKE 'wp_%_posts'"
  26. rootEntity="false"
  27. >
  28.  
  29.  
  30. <!-- This is our root entity and each row returned will index one document -->
  31. <entity rootEntity="true"
  32. name="blog"
  33. pk="ID"
  34. query="SELECT * FROM ${blogtables.blog}_posts WHERE post_type='post' AND post_status='publish' AND post_password=''"
  35. transformer="HTMLStripTransformer,TemplateTransformer,NumberFormatTransformer">
  36.  
  37. <!-- XXX: This should be $home/$post_date/$post_name/ -->
  38. <field name="url" column="guid" />
  39.  
  40. <!-- XXX: Will always be 0 -->
  41. <entity query="SELECT IF(post_status='publish', 0, 1) AS deleted FROM ${blogtables.blog}_posts WHERE ID=${blog.ID}">
  42. <field column="deleted" />
  43. </entity>
  44.  
  45. <field column="source" template="${blogtables.blog}" />
  46. <field name="sourceID" column="ID" formatStyle="number"/>
  47.  
  48. <field name="pubdate" column="post_date_gmt" />
  49. <field name="moddate" column="post_modified_gmt" />
  50. <entity query="SELECT CONCAT(option_value, '/') AS section FROM ${blogtables.blog}_options WHERE option_name='home'">
  51. <field name="homesection" column="section" />
  52. <field name="sections" column="section" />
  53. </entity>
  54. <field name="headline" column="post_title" />
  55. <field name="body" column="post_content" stripHTML="true" />
  56.  
  57. <entity query="SELECT display_name FROM ${blogtables.blog}_users WHERE ID=${blog.post_author}">
  58. <field name="authors" column="display_name" />
  59. </entity>
  60.  
  61. </entity> <!-- /name: blog -->
  62.  
  63. </entity> <!-- /name: blogtables -->
  64.  
  65. </document> <!-- /name: wordpress -->
  66.  
  67. </dataConfig>
Add Comment
Please, Sign In to add comment