0

我遇到的问题是 Solr 没有建立索引,并且我在日志文件中没有得到任何异常。我正在使用 Tomcat 7 服务器并连接到 MS 服务器。我的 data-config.xml 如下。

<?xml version="1.0" encoding="UTF-8" ?>
<dataConfig>
  <dataSource type="JdbcDataSource"
       driver="com.microsoft.sqlserver.jdbc.SQLServerDriver"
       url="jdbc:sqlserver://testserver:2120;databaseName=testdb"
       user="test"
       password="test1" />
  <document name="parts">
    <entity name="id"
       query="select distinct pa.part_id, pa.part_number, pa.part_description, pa.usage_text, pa.quantity, d.make, d.model, d.model_qualifier_id, @category, @subcategory from testdb..part_application_v pa inner join testdb..equipment_detailed_v d on pa.make = d.make and pa.model inner join testdb..page_part_application ppa on ppa.application_id = pa.application_id where ppa.page_id in (select p.page_id from testdb..page p inner join testdb..nav_lang nl on nl.nav_desc_id = p.nav_desc_id inner join testdb..page_chapter_xref pcx on p.pageId = pcx.page_id and chapter_id in (select deistinct chapter_id from testdb.dbo.chapter_v where parent_id in (select distinct chapter_id from testdb.dbo.chapters_v where catalog_id in (select ed.catalog_id from testdb.models_v m inner join testdb..equipment_detailed_v ed on ed.make_id = (select distinct make_id from testdb..equipment_detailed_v where make = @make) and ed.model_qualifier_id = @year and m.model_id = ed.model_id where m.model_id = (select distinct model_id from testdb..equipment_detailed_v where model = @model)) and parent_id is null and name = @category) and name = @subcategory) inner join testdb..chapters_v c on pcx.chapter_id = c.chapter_id and p.image_id is not null and testdb.dbo.utility_fn_filtermatch(null,p.filter_equation) = 1) and testdb.dbo.utility_fn_filtermatch(null,pa.filter-equation) = 1 and d.model_qualifier_id = @year order by ppa.page_id, pa.part_description />
    <field column="pa.part_id" name="partId" />
    <field column="pa.part_number" name="partNumber" />
    <field column="pa.part_description" name="desc" />
    <field column="pa.usage_text" name="usage" />
    <field column="pa.quantity" name="qty" />
    <field column="d.make" name="make" />
    <field column="d.model" name="model" />
    <field column="d.model_qualifier_id" name="year" />
    <field column="@category" name="category" />
    <field column="@subcategory" name="subcategory" />
  </document>
</dataConfig> 

如果没有抛出某种错误,我什至不确定从哪里开始调试它。我将非常感谢任何帮助。

4

1 回答 1

0

两件事情。

首先,您的实体元素是一个空标签,里面没有字段元素。不要用“/>”关闭它,而是用“>”关闭它,并在所有字段元素之后添加“”。是的,当字段元素不在实体元素内时,DataImportHandler 可能应该给出错误。

其次,换行符在属性内是合法的,因此您不必将该查询全部放在一行上。哇,这很难读。你可以这样做:

<entity name="id"
        query="select
               table.name as name,
               table.id as id
               from table">
  <field column="name"/>
  <field column="id"/>
</entity>
于 2012-04-04T18:10:13.507 回答