sorl--spring  data solr 配置 && 增刪改查

 

目录

spring  data solr maven工程搭建

对sorl操作的方法:

  • 官方类库 solrJ (原理:http请求和响应)
  • spring  data solr  (原理: 对官方类库的封装)
  • 手动请求solr 手动处理响应 httpClie

spring  data solr maven工程搭建

目录结构

sorl--spring  data solr 配置 && 增刪改查_第1张图片

pom.xml



    4.0.0

    cn.bufanli
    spring-data-solr-deme
    1.0-SNAPSHOT
    

    
        
            org.springframework.data
            spring-data-solr
            1.5.5.RELEASE
        
        
            org.springframework
            spring-test
            4.2.4.RELEASE
        
        
            junit
            junit
            4.12
            test
        
    

applicationContext-solr.xml

 



	
	
	
   
	
	
		
	

TbItem.java

package cn.bufanli.pojo;

import org.apache.solr.client.solrj.beans.Field;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

public class TbItem implements Serializable {
	@Field("id")
    private Long id;
	@Field("item_title")
    private String title;

    private String sellPoint;
	@Field("item_price")
    private BigDecimal price;

    private Integer stockCount;

    private Integer num;

    private String barcode;
	@Field("item_image")
    private String image;
	@Field("item_categoryid")
    private Long categoryid;

    private String status;

    private Date createTime;

    private Date updateTime;

    private String itemSn;

    private BigDecimal costPirce;

    private BigDecimal marketPrice;

    private String isDefault;
	@Field("item_goodsid")
    private Long goodsId;

    private String sellerId;

    private String cartThumbnail;
	@Field("item_category")
    private String category;
	@Field("item_brand")
    private String brand;

    private String spec;
	@Field("item_seller")
    private String seller;

    public Long getId() {
        return id;
    }

    get&&set&&toString
}

solr  schema.xml配置

   
        
        
        
        
        
         
         
        
        
        
        
        

 

你可能感兴趣的:(solr)