我是solr的新手.我有几个关于solr索引和搜索的问题:
如果是,请让我知道步骤.
我想我们可以使用两个不同的data-config.xml文件.但需要知道如何在schema.xml中配置和相应的更改.
请帮帮我,让我们知道是否有参考文件.
小智 6
2个不同的表没有关系
数据-config.xml文件:
<document>
<entity name="topic" transformer="TemplateTransformer" pk="topic_id" query="select topic_id,topic_title,creation_date,updation_date,vote_count,.....">
<field column=" doc_id " template="TOPIC_${topic.topic_id} " />
<field column="doc_type " template="TOPIC " />
</entity>
<entity name="product " transformer="TemplateTransformer " pk="product_id " query="SELECT product_id,..... ">
<field column="doc_id " template="PRODUCT_${product.product_id} " />
<field column="doc_type " template="PRODUCT " />
<field column="product_supplier_id " name="product_supplier_id " />
<field column="supplier_product_code " name="supplier_product_code " />
<field column="product_display_name " name="product_display_name " />
</entity>
</document>
Run Code Online (Sandbox Code Playgroud)
schema.xml中:
<schema>
. . .
<fields>
<field name="doc_id" type="string" />
<field name="doc_type" type="string" />
<field name="catchall" type="string" stored="false" omitNorms="true" multiValued="true" />
<field name="topic_title" type="text_general" />. . . .
</fields>
<uniqueKey>doc_id</uniqueKey>
<copyField source="*" dest="catchall" />
<!-- field for the QueryParser to use when an explicit fieldname is absent -->
<defaultSearchField>catchall</defaultSearchField>
</schema>
Run Code Online (Sandbox Code Playgroud)
更多信息 - http://www.lucidimagination.com/blog/2011/02/12/solr-powered-isfdb-part-4/
不需要上面的字段,也可能在索引时产生问题
你可以在浏览器上查询 http://localhost:8080/solr/select/?q=*:*&fq=doc_type:PRODUCT