今天写错一个单词,忙会了,一下午,因为本人也是刚接触,所以对一对多,多对多,等关系建立solr索引也比较陌生,不知道哪儿错了,最后发现是单词写错了,真是郁闷啊。
data-config.xml代码如下:
<dataConfig>
<dataSourcetype="JdbcDataSource"
driver="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost:3306/cms?characterEncoding=gbk"
user="root"
password="lijian"/>
<documentname="products">
<entityname="item"
query="select*fromlsoba_productwherepro_prop_system_status='A'limit0,1000">
<fieldcolumn="pro_id"name="pro_id"/>
<fieldcolumn="pro_name"name="pro_name"/>
<fieldcolumn="pro_site_price"name="pro_site_price"/>
<fieldcolumn="pro_desc"name="pro_desc"/>
<fieldcolumn="pro_address"name="pro_address"/>
<fieldcolumn="pro_pic_url"name="pro_pic_url"/>
<fieldcolumn="pro_src_url"name="pro_src_url"/>
<fieldcolumn="pro_brand_id"name="pro_brand_id"/>
<field column="pro_mall_id" name="pro_mall_id" />
//这个单词写错了,写成了entiey 呵呵,浪费了老多时间。
<entityname="itemcat"query="selectitemCat_cid,itemCat_namefromlsoba_itemcatwhereitemCat_cid='${item.pro_id}'">
<fieldcolumn="itemCat_cid"name="pro_cid"/>
<fieldcolumn="itemCat_name"name="pro_cat_name"/>
</entity>
<entityquery="selectmall_namefromlsoba_mallwheremall_id='${item.pro_mall_id}'">
<fieldcolumn="mall_name"name="pro_mall_name"/>
</entity>
<entityquery="selectBRAND_NAMEfromlsoba_brandwhereBRAND_ID='${item.pro_brand_id}'">
<fieldcolumn="BRAND_NAME"name="pro_brand_name"/>
</entity>
</entity>
</document>
</dataConfig>
schema.xml 部分配置如下:
<fields>
<!--addproductinfomation-->
<fieldname="pro_id"type="text"indexed="true"stored="true"required="false"/>
<fieldname="pro_name"type="text"indexed="true"stored="true"/>
<fieldname="pro_site_price"type="float"indexed="true"stored="true"/>
<fieldname="pro_desc"type="text"indexed="true"stored="true"/>
<fieldname="pro_address"type="text"indexed="true"stored="true"/>
<fieldname="pro_pic_url"type="text"indexed="true"stored="true"/>
<field name="pro_src_url" type="text" indexed="true" stored="true"/>
<!-- add categoryName -->
<fieldname="pro_cid"type="text"indexed="true"stored="true"multiValued="true"/>
<fieldname="pro_cat_name"type="text"indexed="true"stored="true"/>
<!--addbrand-->
<fieldname="pro_brand_id"type="text"indexed="true"stored="true"/>
<fieldname="pro_brand_name"type="text"indexed="true"stored="true"multiValued="true"/>
<!--addmall-->
<fieldname="pro_mall_id"type="text"indexed="true"stored="true"/>
<fieldname="pro_mall_name"type="text"indexed="true"stored="true"multiValued="true"/>
</fields>
<!-- Field to use to determine and enforce document uniqueness.
Unlessthisfieldismarkedwithrequired="false",itwillbearequiredfield
-->
<uniqueKey>pro_id</uniqueKey>
<!-- field for the QueryParser to use when an explicit fieldname is absent --> <defaultSearchField>pro_name</defaultSearchField>
<!-- SolrQueryParser configuration: defaultOperator="AND|OR" --> <solrQueryParser defaultOperator="OR"/>
查询结果就ok了,
http://localhost:8080/solr/select/?q=*%3A*&version=2.2&start=0&rows=10&indent=on
<?xml version="1.0" encoding="UTF-8" ?>
- <response>
- <lst name="responseHeader">
<int name="status">0</int>
<int name="QTime">41</int>
- <lst name="params">
<str name="indent">on</str>
<str name="start">0</str>
<str name="rows">10</str>
<str name="version">2.2</str>
</lst>
</lst>
- <result name="response" numFound="1000" start="0">
- <doc>
<str name="pro_address">日本</str>
<str name="pro_brand_id">201049182911492922809004</str>
- <arr name="pro_brand_name">
<str name="pro_cat_name">彩装</str>
<str name="pro_desc"><div class="pro_intro"> <div class="title">商品详细说明:</div> <p style="word-break:break-all;">* 重整肌肤的柔软度。一下子就可以渗透进皮肤,没有粘糊的感觉。用后肌肤清新怡然。<BR>* 细细的泡沫能深入除去毛孔污垢,含有彻底清洁毛孔成分,且美白效果甚佳,能使肌肤具有透明美白感。清洁的同时更能祛除游离在皮肤表面的麦拉宁分泌物,丰富维他命E成分,保证肌肤润泽不干燥,有效抗衰老,防止幼纹的生成;<BR>* 使用方法:取适量于手心加水轻轻打起泡沫,用于清洁面部,洁毕用清水洗净即可。</p> </div></str>
<str name="pro_id">201049182911492922809004</str>
<str name="pro_mall_id">no5</str>
- <arr name="pro_mall_name">
<str name="pro_name">The body shop 美体小铺蔓越莓身体滋养霜-09圣诞限量版(67829)</str>
<str name="pro_pic_url">http://www.no5.com.cn/photo.html?size=b&photo=20100419145547448544122.jpg</str>
<float name="pro_site_price">205.0</float>
<str name="pro_src_url">http://www.no5.com.cn/goods/13598.html</str>
</doc>
- <doc>
<str name="pro_address">中国</str>
<str name="pro_brand_id">201049183211493231502300</str>
- <arr name="pro_brand_name">
<str name="pro_cat_name">个人护理</str>
<str name="pro_desc"><div class="pro_intro"> <div class="title">商品详细说明:</div> <p style="word-break:break-all;">乳状的化妆水能?底清洁却不刺激脆弱敏感的肌肤。同时能给予肌肤滋润,帮助后续保养品的吸收。<BR>适干性及脆弱敏感性肌肤使用。</p> </div></str>
<str name="pro_id">201049183211493231502300</str>
<str name="pro_mall_id">no5</str>
- <arr name="pro_mall_name">
<str name="pro_name">HR 赫莲娜光采重现铜光粉饼(01#21222) 本周特价!</str>
<str name="pro_pic_url">http://www.no5.com.cn/photo.html?size=b&photo=2007122611113640349034.jpg</str>
<float name="pro_site_price">205.0</float>
<str name="pro_src_url">http://www.no5.com.cn/goods/11591.html</str>
</doc>
- <doc>
<str name="pro_address">法国</str>
<str name="pro_brand_id">201049183311493311295211</str>
- <arr name="pro_brand_name">
<str name="pro_cat_name">彩装</str>
<str name="pro_desc"><div class="pro_intro"> <div class="title">商品详细说明:</div> <p style="word-break:break-all;">乳状的化妆水能?底清洁却不刺激脆弱敏感的肌肤。同时能给予肌肤滋润,帮助后续保养品的吸收。<BR>适干性及脆弱敏感性肌肤使用。</p> </div></str>
<str name="pro_id">201049183311493311295211</str>
<str name="pro_mall_id">no5</str>
- <arr name="pro_mall_name">
<str name="pro_name">HR 赫莲娜光采重现铜光粉饼(01#21222) 本周特价!</str>
<str name="pro_pic_url">http://www.no5.com.cn/photo.html?size=b&photo=200812041543031000793288.jpg</str>
<float name="pro_site_price">175.0</float>
<str name="pro_src_url">http://www.no5.com.cn/goods/1604.html</str>
</doc>
- <doc>
<str name="pro_address">美国</str>
<str name="pro_brand_id">201049183511493593780939</str>
- <arr name="pro_brand_name">
<str name="pro_cat_name">彩装</str>
<str name="pro_desc"><div class="pro_intro"> <div class="title">商品详细说明:</div> <p style="word-break:break-all;">兰蔻清新恒丽遮瑕笔含丰富保湿植物复合物,抗氧化及轻盈因子,遮盖瑕疵,黑眼圈及皱纹,同时保护肌肤免受环境侵害。细致顺滑乳液,遮盖瑕疵,使妆容丰满自然,经皮肤科专家测试。<BR>01# Clair dore </p> </div></str>
<str name="pro_id">201049183511493593780939</str>
<str name="pro_mall_id">no5</str>
- <arr name="pro_mall_name">