2012-04-04 59 views
0

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

<?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> 

无法抛出某种错误,我甚至不知道从哪里开始调试。我会非常感谢任何帮助。

回答

0

两件事。

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

其次,换行符在属性中是合法的,所以你不必把这个查询全部放在一行上。哇,这很难读。你可以这样做:

<entity name="id" 
     query="select 
       table.name as name, 
       table.id as id 
       from table"> 
    <field column="name"/> 
    <field column="id"/> 
</entity> 
+0

谢谢,我会做出这些变化,并发回它如何去。 – stirling 2012-04-04 19:07:33