Java网络商城项目 SpringBoot+SpringCloud+Vue 网络商城(SSM前后端分离项目)十四(Spring Data Elasticsearch,将数据添加到索引库)
一、创建Elasticsearch相关内容
1、创建GoodsRepository
package com.leyou.search.repository;
import com.leyou.search.pojo.Goods;
import org.springframework.data.elasticsearch.repository.ElasticsearchRepository;
public interface GoodsRepository extends ElasticsearchRepository<Goods,Long> {
}
(1)创建GoodsRepository对应的测试类
package com.leyou.search.repostory;
import com.leyou.search.pojo.Goods;
import com.leyou.search.repository.GoodsRepository;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.data.elasticsearch.core.ElasticsearchTemplate;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest
public class GoodsRepositoryTest {
@Autowired
private GoodsRepository goodsRepository;
@Autowired
private ElasticsearchTemplate template;
@Test
public void testCreateIndex(){
template.createIndex(Goods.class);
template.putMapping(Goods.class);
}
}
运行测试
二、导入数据
1、创建SearchService,构建Goods对象
将数据库当中的SPU和SKU的信息封装为Goods对象,并导入Elasticsearch
package com.leyou.search.service;
import com.fasterxml.jackson.core.type.TypeReference;
import com.leyou.common.enums.ExceptionEnum;
import com.leyou.common.exception.LyException;
import com.leyou.common.utils.JsonUtils;
import com.leyou.item.pojo.*;
import com.leyou.search.client.BrandClient;
import com.leyou.search.client.CategoryClient;
import com.leyou.search.client.GoodsClient;
import com.leyou.search.client.SpecificationClient;
import com.leyou.search.pojo.Goods;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.math.NumberUtils;
import org.apache.lucene.util.CollectionUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.*;
import java.util.stream.Collectors;
@Service
public class SearchService {
@Autowired
private CategoryClient categoryClient;
@Autowired
private BrandClient brandClient;
@Autowired
private GoodsClient goodsClient;
@Autowired
private SpecificationClient specClient;
public Goods buildGoods(Spu spu){
//查询分类
List<Category> categories = categoryClient.queryCategoryByIds(
Arrays.asList(spu.getCid1(), spu.getCid2(), spu.getCid3()));
if(CollectionUtils.isEmpty(categories)){
throw new LyException(ExceptionEnum.CATEGORY_NOT_FOND);
}
//将categories集合当中所有的name取出来封装为一个字符串集合
List<String> names = categories.stream().map(Category::getName).collect(Collectors.toList());
//查询品牌
Brand brand = brandClient.queryBrandById(spu.getBrandId());
if(brand == null){
throw new LyException(ExceptionEnum.BRAND_NOT_FOUND);
}
//搜索字段 将字符串集合变成一个字符串以空格为分隔拼接到后面
String all = spu.getTitle() + StringUtils.join(names," ") + brand.getName();
//查询sku
List<Sku> skuList = goodsClient.querySkuBySpuId(spu.getId());
if(CollectionUtils.isEmpty(skuList)){
throw new LyException(ExceptionEnum.GOODS_SKU_NOT_FOND);
}
//对Sku进行处理
List<Map<String,Object>> skus = new ArrayList<>();
//价格集合
ArrayList<Long> priceList = new ArrayList<Long>();
for (Sku sku : skuList) {
Map<String,Object> map = new HashMap<>();
map.put("id",sku.getId());
map.put("title",sku.getTitle());
map.put("price",sku.getPrice());
//截取sku当中图片逗号之前的第一个
map.put("images",StringUtils.substringBefore(sku.getImages(),","));
skus.add(map);
//处理价格
priceList.add(sku.getPrice());
}
//查询规格参数
List<SpecParam> params = specClient.queryParamList(null, spu.getCid3(), true);
if(CollectionUtils.isEmpty(params)){
throw new LyException(ExceptionEnum.SPEC_GROUP_NOT_FOND);
}
//查询商品详情
SpuDetail spuDetail = goodsClient.queryDetailById(spu.getId());
//获取通用规格参数,获取到通用规格参数的JSON字符串,将其转换为Map集合
Map<Long, String> genericSpec = JsonUtils.toMap(spuDetail.getGenericSpec(), Long.class, String.class);
//获取特有规格参数,获取到特有规格参数的JSON字符串,将其转换为Map集合,而Map集合当中的值是String,键为List集合
Map<Long, List<String>> specailSpec =
JsonUtils.nativeRead(spuDetail.getSpecialSpec(),
new TypeReference<Map<Long, List<String>>>(){});
//处理规格参数,key是规格参数的名称,值是规格参数的值
Map<String,Object> specs = new HashMap<>();
for (SpecParam param : params) {
//规格名称
String key = param.getName();
Object value = "";
//判断是否是通过规格参数
if(param.getGeneric()){
value = genericSpec.get(param.getId());
//判断是否是数值类型
if(param.getNumeric()){
//处理成段
value = chooseSegment(value.toString(),param);
}
}else {
value = specailSpec.get(param.getId());
}
//存入map
specs.put(key,value);
}
//构建good对象
Goods goods = new Goods();
goods.setBrandId(spu.getBrandId());
goods.setCid1(spu.getCid1());
goods.setCid2(spu.getCid2());
goods.setCid3(spu.getCid3());
goods.setCreateTime(spu.getCreateTime());
goods.setId(spu.getId());
goods.setAll(all);//搜索字段,包含标题,分类,品牌,规格等信息
goods.setPrice(priceList);// 所有sku价格的集合
goods.setSkus(JsonUtils.toString(skus));// 所有sku的集合的JSON格式
goods.setSpecs(specs);// 所有可以搜索的规格参数
goods.setSubTitle(spu.getSubTitle());
return goods;
}
private String chooseSegment(String value, SpecParam p) {
double val = NumberUtils.toDouble(value);
String result = "其它";
// 保存数值段
for (String segment : p.getSegments().split(",")) {
String[] segs = segment.split("-");
// 获取数值范围
double begin = NumberUtils.toDouble(segs[0]);
double end = Double.MAX_VALUE;
if(segs.length == 2){
end = NumberUtils.toDouble(segs[1]);
}
// 判断是否在范围内
if(val >= begin && val < end){
if(segs.length == 1){
result = segs[0] + p.getUnit() + "以上";
}else if(begin == 0){
result = segs[1] + p.getUnit() + "以下";
}else{
result = segment + p.getUnit();
}
break;
}
}
return result;
}
}
2、然后编写一个测试类,循环查询Spu,然后调用IndexService中的方法,把SPU变为Goods,然后写入索引库:
package com.leyou.search.repostory;
import com.leyou.common.vo.PageResult;
import com.leyou.item.pojo.Spu;
import com.leyou.search.client.GoodsClient;
import com.leyou.search.pojo.Goods;
import com.leyou.search.repository.GoodsRepository;
import com.leyou.search.service.SearchService;
import org.apache.lucene.util.CollectionUtil;
import org.aspectj.weaver.ast.Var;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.data.elasticsearch.core.ElasticsearchTemplate;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.util.CollectionUtils;
import java.util.List;
import java.util.stream.Collectors;
@RunWith(SpringRunner.class)
@SpringBootTest
public class GoodsRepositoryTest {
@Autowired
private GoodsRepository goodsRepository;
@Autowired
private ElasticsearchTemplate template;
@Autowired
private GoodsClient goodsClient;
@Autowired
private SearchService searchService;
@Test
public void testCreateIndex(){
template.createIndex(Goods.class);
template.putMapping(Goods.class);
}
@Test
public void loadData(){
int page = 1;
int rows = 100;
int size = 0;
do {
//查询spu的信息
PageResult<Spu> result = goodsClient.querySpuByPage(page, rows, true, null);
List<Spu> spuList = result.getItems();//得到当前页
if(CollectionUtils.isEmpty(spuList)){
break;
}
//构建成Goods
List<Goods> goodsList = spuList.stream().map(searchService::buildGoods).collect(Collectors.toList());
//存入索引库
goodsRepository.saveAll(goodsList);
//翻页
page++;
size = spuList.size();
}while (size == 100);
}
}
运行测试类
查询虚拟机发送请求:
http://134.135.131.36:9200/goods/_search
返回结果
{
"took": 97,
"timed_out": false,
"_shards": {
"total": 1,
"successful": 1,
"skipped": 0,
"failed": 0
},
"hits": {
"total": 181,
"max_score": 1,
"hits": [
{
"_index": "goods",
"_type": "docs",
"_id": "129",
"_score": 1,
"_source": {
"id": 129,
"all": "小米(MI) 红米5 plus 手机 (更新)手机 手机通讯 手机小米(MI)",
"subTitle": "18:9全面屏,4000mAh大电池,骁龙八核处理器!<a href=\"https://item.jd.com/21685362089.html\" target=\"_blank\">32G金色限时8XX秒!</a>",
"brandId": 18374,
"cid1": 74,
"cid2": 75,
"cid3": 76,
"createTime": 1524297578000,
"price": [
105900,
109900,
109900,
109900
],
"skus": "[{\"images\":\"http://image.leyou.com/images/13/5/1524297576554.jpg\",\"price\":105900,\"id\":27359021725,\"title\":\"小米(MI) 红米5 plus 手机 (更新) 黑色 3GB 32GB\"},{\"images\":\"http://image.leyou.com/images/7/15/1524297577054.jpg\",\"price\":109900,\"id\":27359021726,\"title\":\"小米(MI) 红米5 plus 手机 (更新) 金色 3GB 32GB\"},{\"images\":\"http://image.leyou.com/images/0/10/1524297577503.jpg\",\"price\":109900,\"id\":27359021727,\"title\":\"小米(MI) 红米5 plus 手机 (更新) 玫瑰金 3GB 32GB\"},{\"images\":\"http://image.leyou.com/images/2/2/1524297577945.jpg\",\"price\":109900,\"id\":27359021728,\"title\":\"小米(MI) 红米5 plus 手机 (更新) 浅蓝色 3GB 32GB\"}]",
"specs": {
"CPU核数": "八核",
"后置摄像头": "1000-1500万",
"CPU品牌": "骁龙(Snapdragon)",
"CPU频率": "2.0-2.5GHz",
"操作系统": "Android",
"内存": [
"3GB"
],
"主屏幕尺寸(英寸)": "5.5-6.0英寸",
"前置摄像头": "500-1000万",
"电池容量(mAh)": "4000mAh以上",
"机身存储": [
"32GB"
]
}
}
},
{
"_index": "goods",
"_type": "docs",
"_id": "168",
"_score": 1,
"_source": {
"id": 168,
"all": "小米(MI) 小米5X 手机 (更新3)手机 手机通讯 手机小米(MI)",
"subTitle": "【爆款低价 移动/公开全网通不做混发,请放心购买!】5.5”屏幕,变焦双摄!<a href=\"https://item.jd.com/12068579160.html\" target=\"_blank\">戳戳小米6~</a>",
"brandId": 18374,
"cid1": 74,
"cid2": 75,
"cid3": 76,
"createTime": 1524297659000,
"price": [
124900,
124900,
124900,
108900
],
"skus": "[{\"images\":\"http://image.leyou.com/images/5/13/1524297657594.jpg\",\"price\":124900,\"id\":27359021721,\"title\":\"小米(MI) 小米5X 手机 (更新3) 玫瑰金 4GB 64GB\"},{\"images\":\"http://image.leyou.com/images/11/5/1524297658128.jpg\",\"price\":124900,\"id\":27359021722,\"title\":\"小米(MI) 小米5X 手机 (更新3) 红色 4GB 64GB\"},{\"images\":\"http://image.leyou.com/images/9/3/1524297658599.jpg\",\"price\":124900,\"id\":27359021723,\"title\":\"小米(MI) 小米5X 手机 (更新3) 黑色 4GB 64GB\"},{\"images\":\"http://image.leyou.com/images/5/11/1524297659002.jpg\",\"price\":108900,\"id\":27359021724,\"title\":\"小米(MI) 小米5X 手机 (更新3) 金色 4GB 64GB\"}]",
"specs": {
"CPU核数": "八核",
"后置摄像头": "1000-1500万",
"CPU品牌": "骁龙(Snapdragon)",
"CPU频率": "1.0-1.5GHz",
"操作系统": "Android",
"内存": [
"4GB"
],
"主屏幕尺寸(英寸)": "5.5-6.0英寸",
"前置摄像头": "500-1000万",
"电池容量(mAh)": "3000-4000mAh",
"机身存储": [
"64GB"
]
}
}
},
{
"_index": "goods",
"_type": "docs",
"_id": "118",
"_score": 1,
"_source": {
"id": 118,
"all": "小米 note3 手机 (更新3)手机 手机通讯 手机小米(MI)",
"subTitle": "全网通版不混发丨含原装壳丨人脸解锁丨美颜+后置1200万丨快充丨NFC→<a href=\"http://item.jd.com/21117453994.html\" target=\"_blank\">新品红米note5</a>",
"brandId": 18374,
"cid1": 74,
"cid2": 75,
"cid3": 76,
"createTime": 1524297552000,
"price": [
229900,
209900
],
"skus": "[{\"images\":\"http://image.leyou.com/images/6/5/1524297551060.jpg\",\"price\":229900,\"id\":27359021711,\"title\":\"小米 note3 手机 (更新3) 亮黑色 6GB 128GB\"},{\"images\":\"http://image.leyou.com/images/2/12/1524297551534.jpg\",\"price\":209900,\"id\":27359021712,\"title\":\"小米 note3 手机 (更新3) 蓝色 6GB 128GB\"}]",
"specs": {
"CPU核数": "八核",
"后置摄像头": "1000-1500万",
"CPU品牌": "骁龙(Snapdragon)",
"CPU频率": "2.0-2.5GHz",
"操作系统": "Android",
"内存": [
"6GB"
],
"主屏幕尺寸(英寸)": "5.5-6.0英寸",
"前置摄像头": "1500-2000万",
"电池容量(mAh)": "3000-4000mAh",
"机身存储": [
"128GB"
]
}
}
},
{
"_index": "goods",
"_type": "docs",
"_id": "141",
"_score": 1,
"_source": {
"id": 141,
"all": "小米 MI 6.1 手机 (更新)手机 手机通讯 手机小米(MI)",
"subTitle": "含原装壳丨变焦双摄丨骁龙处理器丨NFC丨<a href=\"https://item.jd.com/22320392453.html\" target=\"_blank\">小米note3骁龙八核处理器</a>",
"brandId": 18374,
"cid1": 74,
"cid2": 75,
"cid3": 76,
"createTime": 1524297600000,
"price": [
399900,
309900,
279900,
289900
],
"skus": "[{\"images\":\"http://image.leyou.com/images/10/7/1524297598540.jpg\",\"price\":399900,\"id\":27359021703,\"title\":\"小米 MI 6.1 手机 (更新) 陶瓷黑尊享版 6GB 128GB\"},{\"images\":\"http://image.leyou.com/images/15/5/1524297599029.jpg\",\"price\":309900,\"id\":27359021704,\"title\":\"小米 MI 6.1 手机 (更新) 亮蓝色 6GB 128GB\"},{\"images\":\"http://image.leyou.com/images/12/13/1524297599389.jpg\",\"price\":279900,\"id\":27359021705,\"title\":\"小米 MI 6.1 手机 (更新) 亮黑色 6GB 128GB\"},{\"images\":\"http://image.leyou.com/images/13/3/1524297599775.jpg\",\"price\":289900,\"id\":27359021706,\"title\":\"小米 MI 6.1 手机 (更新) 亮白色 6GB 128GB\"}]",
"specs": {
"CPU核数": "八核",
"后置摄像头": "1000-1500万",
"CPU品牌": "骁龙(Snapdragon)",
"CPU频率": "2.0-2.5GHz",
"操作系统": "Android",
"内存": [
"6GB"
],
"主屏幕尺寸(英寸)": "5.0-5.5英寸",
"前置摄像头": "500-1000万",
"电池容量(mAh)": "3000-4000mAh",
"机身存储": [
"128GB"
]
}
}
},
{
"_index": "goods",
"_type": "docs",
"_id": "6",
"_score": 1,
"_source": {
"id": 6,
"all": "魅族 PRO手机 手机通讯 手机魅族(MEIZU)",
"subTitle": "5.2英寸!500万+1200万像素!<a href='https://sale.jd.com/act/InqRKmz0tg.html' target='_blank'>魅蓝6秒杀大促,直降至599抢购!</a>",
"brandId": 12669,
"cid1": 74,
"cid2": 75,
"cid3": 76,
"createTime": 1524297322000,
"price": [
129900,
169900,
149900
],
"skus": "[{\"images\":\"http://image.leyou.com/images/7/8/1524297320968.jpg\",\"price\":129900,\"id\":27359021545,\"title\":\"魅族 PRO 香槟金 4GB 64GB\"},{\"images\":\"http://image.leyou.com/images/1/0/1524297321578.jpg\",\"price\":169900,\"id\":27359021546,\"title\":\"魅族 PRO 深空灰 4GB 64GB\"},{\"images\":\"http://image.leyou.com/images/1/0/1524297321974.jpg\",\"price\":149900,\"id\":27359021547,\"title\":\"魅族 PRO 玫瑰金 4GB 64GB\"}]",
"specs": {
"CPU核数": "十核",
"后置摄像头": "1000-1500万",
"CPU品牌": "联发科(MTK)",
"CPU频率": "2.5GHz以上",
"操作系统": "Android",
"内存": [
"4GB"
],
"主屏幕尺寸(英寸)": "5.0-5.5英寸",
"前置摄像头": "500-1000万",
"电池容量(mAh)": "3000-4000mAh",
"机身存储": [
"64GB"
]
}
}
},
{
"_index": "goods",
"_type": "docs",
"_id": "2",
"_score": 1,
"_source": {
"id": 2,
"all": "华为 G9 青春版 手机 手机通讯 手机华为(HUAWEI)",
"subTitle": "骁龙芯片!3GB运行内存!索尼1300万摄像头!<a href='https://sale.jd.com/act/DhKrOjXnFcGL.html' target='_blank'>华为新品全面上线,更多优惠猛戳》》</a>",
"brandId": 8557,
"cid1": 74,
"cid2": 75,
"cid3": 76,
"createTime": 1524297315000,
"price": [
84900,
84900,
84900
],
"skus": "[{\"images\":\"http://image.leyou.com/images/9/15/1524297313793.jpg\",\"price\":84900,\"id\":2600242,\"title\":\"华为 G9 青春版 白色 移动联通电信4G手机 双卡双待\"},{\"images\":\"http://image.leyou.com/images/9/5/1524297314398.jpg\",\"price\":84900,\"id\":2600248,\"title\":\"华为 G9 青春版 金色 移动联通电信4G手机 双卡双待\"},{\"images\":\"http://image.leyou.com/images/15/15/1524297314800.jpg\",\"price\":84900,\"id\":3385376,\"title\":\"华为 G9 青春版 玫瑰金 移动联通电信4G手机 双卡双待\"}]",
"specs": {
"CPU核数": "八核",
"后置摄像头": "1000-1500万",
"CPU品牌": "骁龙(Snapdragon)",
"CPU频率": "1.5-2.0GHz",
"操作系统": "Android",
"内存": [
"3GB"
],
"主屏幕尺寸(英寸)": "5.0-5.5英寸",
"前置摄像头": "500-1000万",
"电池容量(mAh)": "3000-4000mAh",
"机身存储": [
"16GB"
]
}
}
},
{
"_index": "goods",
"_type": "docs",
"_id": "145",
"_score": 1,
"_source": {
"id": 145,
"all": "锤子(smartisan) 坚果32 手机 手机 手机通讯 手机锤子(smartisan)",
"subTitle": "【新品开售享壕礼】下单即送智能手环、蓝牙耳机、自拍杆~ <a href=\"https://item.jd.com/19566307882.html\" target=\"_blank\">点击购买坚果 Pro2 !</a>",
"brandId": 91515,
"cid1": 74,
"cid2": 75,
"cid3": 76,
"createTime": 1524297609000,
"price": [
169900,
169900,
199900,
179900
],
"skus": "[{\"images\":\"http://image.leyou.com/images/9/11/1524297607702.jpg\",\"price\":169900,\"id\":27359021522,\"title\":\"锤子(smartisan) 坚果38 手机 碳黑色 4GB 64GB\"},{\"images\":\"http://image.leyou.com/images/8/14/1524297608290.jpg\",\"price\":169900,\"id\":27359021523,\"title\":\"锤子(smartisan) 坚果38 手机 酒红色 4GB 64GB\"},{\"images\":\"http://image.leyou.com/images/1/5/1524297608684.jpg\",\"price\":199900,\"id\":27359021524,\"title\":\"锤子(smartisan) 坚果38 手机 炫黑色特别版 4GB 64GB\"},{\"images\":\"http://image.leyou.com/images/5/11/1524297608996.jpg\",\"price\":179900,\"id\":27359021525,\"title\":\"锤子(smartisan) 坚果38 手机 炫红色特别版 4GB 64GB\"}]",
"specs": {
"CPU核数": "八核",
"后置摄像头": "1000-1500万",
"CPU品牌": "骁龙(Snapdragon)",
"CPU频率": "2.0-2.5GHz",
"操作系统": "",
"内存": [
"4GB"
],
"主屏幕尺寸(英寸)": "5.5-6.0英寸",
"前置摄像头": "500-1000万",
"电池容量(mAh)": "4000mAh以上",
"机身存储": [
"64GB"
]
}
}
},
{
"_index": "goods",
"_type": "docs",
"_id": "182",
"_score": 1,
"_source": {
"id": 182,
"all": "小米(MI) 小米5X 全网通4G智能手机 手机 手机通讯 手机小米(MI)",
"subTitle": "骁龙 八核CPU处理器 5.5英寸屏幕<a href=\"https://item.jd.com/26438399057.html\" target=\"_blank\">【小米新品】~红米note5 AI智能双摄</a>",
"brandId": 18374,
"cid1": 74,
"cid2": 75,
"cid3": 76,
"createTime": 1524297687000,
"price": [
127900,
128900,
127900,
114900,
114900,
119900,
122900,
129500
],
"skus": "[{\"images\":\"http://image.leyou.com/images/5/15/1524297684291.jpg\",\"price\":127900,\"id\":14542067586,\"title\":\"小米(MI) 小米5X 全网通4G智能手机 黑色 4+64GB\"},{\"images\":\"http://image.leyou.com/images/11/9/1524297685078.jpg\",\"price\":128900,\"id\":14542067587,\"title\":\"小米(MI) 小米5X 全网通4G智能手机 玫瑰金 4+64GB\"},{\"images\":\"http://image.leyou.com/images/11/3/1524297685441.jpg\",\"price\":127900,\"id\":14542067588,\"title\":\"小米(MI) 小米5X 全网通4G智能手机 金色 4+64GB\"},{\"images\":\"http://image.leyou.com/images/11/11/1524297686211.jpg\",\"price\":114900,\"id\":15381011179,\"title\":\"小米(MI) 小米5X 全网通4G智能手机 黑色 4+32GB\"},{\"images\":\"http://image.leyou.com/images/11/15/1524297686596.jpg\",\"price\":114900,\"id\":15389829596,\"title\":\"小米(MI) 小米5X 全网通4G智能手机 金色 4+32GB\"},{\"images\":\"http://image.leyou.com/images/2/10/1524297685833.jpg\",\"price\":119900,\"id\":15969394800,\"title\":\"小米(MI) 小米5X 全网通4G智能手机 金色 4+64GB 移动全网通版\"},{\"images\":\"http://image.leyou.com/images/1/10/1524297684666.jpg\",\"price\":122900,\"id\":17156951445,\"title\":\"小米(MI) 小米5X 全网通4G智能手机 黑色 4+64GB 移动全网通版\"},{\"images\":\"http://image.leyou.com/images/14/9/1524297683772.jpg\",\"price\":129500,\"id\":19094839248,\"title\":\"小米(MI) 小米5X 全网通4G智能手机 红色限量版 4+64GB\"}]",
"specs": {
"CPU核数": "八核",
"后置摄像头": "1000-1500万",
"CPU品牌": "骁龙(Snapdragon)",
"CPU频率": "1.0-1.5GHz",
"操作系统": "Android",
"内存": [
"4GB"
],
"主屏幕尺寸(英寸)": "5.5-6.0英寸",
"前置摄像头": "500-1000万",
"电池容量(mAh)": "3000-4000mAh",
"机身存储": [
"64GB"
]
}
}
},
{
"_index": "goods",
"_type": "docs",
"_id": "181",
"_score": 1,
"_source": {
"id": 181,
"all": "vivo Y75 全面屏手机 4GB+32GB 移动联通电信4G手机 双卡双待 手机 手机通讯 手机vivo",
"subTitle": "<a href=\"https://sale.jd.com/act/vGWKogOy2nbPpQ.html\" target=\"_blank\">vivo X21新一代全面屏·6+128G大内存·AI智慧拍照·照亮你的美·现货抢购中</a>",
"brandId": 25591,
"cid1": 74,
"cid2": 75,
"cid3": 76,
"createTime": 1524297684000,
"price": [
149800,
149800,
149800,
149800
],
"skus": "[{\"images\":\"http://image.leyou.com/images/1/0/1524297682312.jpg\",\"price\":149800,\"id\":21877287604,\"title\":\"vivo Y75 全面屏手机 4GB+32GB 移动联通电信4G手机 双卡双待 金色 标准版\"},{\"images\":\"http://image.leyou.com/images/13/9/1524297683298.jpg\",\"price\":149800,\"id\":21877287605,\"title\":\"vivo Y75 全面屏手机 4GB+32GB 移动联通电信4G手机 双卡双待 玫瑰金 标准版\"},{\"images\":\"http://image.leyou.com/images/11/14/1524297682707.jpg\",\"price\":149800,\"id\":21877287606,\"title\":\"vivo Y75 全面屏手机 4GB+32GB 移动联通电信4G手机 双卡双待 磨砂黑 标准版\"},{\"images\":\"http://image.leyou.com/images/10/0/1524297681705.jpg\",\"price\":149800,\"id\":24615967892,\"title\":\"vivo Y75 全面屏手机 4GB+32GB 移动联通电信4G手机 双卡双待 红色 标准版\"}]",
"specs": {
"CPU核数": "八核",
"后置摄像头": "1000-1500万",
"CPU品牌": "联发科(MTK)",
"CPU频率": "2.0-2.5GHz",
"操作系统": "Android",
"内存": [
"4GB"
],
"主屏幕尺寸(英寸)": "5.5-6.0英寸",
"前置摄像头": "1500-2000万",
"电池容量(mAh)": "3000-4000mAh",
"机身存储": [
"32GB"
]
}
}
},
{
"_index": "goods",
"_type": "docs",
"_id": "180",
"_score": 1,
"_source": {
"id": 180,
"all": "魅族(MEIZU) pro 6 plus手机 移动联通版 手机 手机通讯 手机魅族(MEIZU)",
"subTitle": "【现货 劲爆价促销】<a href=\"https://item.jd.com/25109782095.html\" target=\"_blank\">魅蓝6 低至649元 评价更有好礼送</a>",
"brandId": 12669,
"cid1": 74,
"cid2": 75,
"cid3": 76,
"createTime": 1524297681000,
"price": [
159900,
159900
],
"skus": "[{\"images\":\"http://image.leyou.com/images/1/0/1524297680255.jpg\",\"price\":159900,\"id\":26115750090,\"title\":\"魅族(MEIZU) pro 6 plus手机 移动联通版 香槟金 官方标配 4+64G\"},{\"images\":\"http://image.leyou.com/images/13/7/1524297679745.jpg\",\"price\":159900,\"id\":26116566269,\"title\":\"魅族(MEIZU) pro 6 plus手机 移动联通版 深空灰 官方标配 4+64G\"}]",
"specs": {
"CPU核数": "八核",
"后置摄像头": "1000-1500万",
"CPU品牌": "三星(Exynos)",
"CPU频率": "1.0-1.5GHz",
"操作系统": "Android",
"内存": [
"4GB"
],
"主屏幕尺寸(英寸)": "5.5-6.0英寸",
"前置摄像头": "500-1000万",
"电池容量(mAh)": "3000-4000mAh",
"机身存储": [
"64GB"
]
}
}
}
]
}
}