From 0b14e7755cf3a0d84124899f8a4ea55bafe003a2 Mon Sep 17 00:00:00 2001 From: 354798ggg <1074825718@qq.com> Date: 星期四, 18 五月 2023 11:15:00 +0800 Subject: [PATCH] 文档检索代码清理 --- /dev/null | 40 -------------------- src/main/java/com/product/lucene/service/LuceneService.java | 59 ----------------------------- 2 files changed, 0 insertions(+), 99 deletions(-) diff --git a/src/main/java/com/product/lucene/entity/PageQuery.java b/src/main/java/com/product/lucene/entity/PageQuery.java deleted file mode 100644 index cc8f923..0000000 --- a/src/main/java/com/product/lucene/entity/PageQuery.java +++ /dev/null @@ -1,63 +0,0 @@ -package com.product.lucene.entity;/** - * Created by Administrator on 2019/11/12/012. - */ - -import java.util.List; -import java.util.Map; - -import com.github.pagehelper.PageInfo; - - -public class PageQuery { - - private PageInfo pageInfo; - /** - * 鎺掑簭瀛楁 - */ - private Sort sort; - /** - * 鏌ヨ鍙傛暟绫� - */ - private Product params; - /** - * 杩斿洖缁撴灉闆� - */ - private List<Product> results; - /** - * 涓嶅湪T绫讳腑鐨勫弬鏁� - */ - private Map<String, String> queryParam; - public PageInfo getPageInfo() { - return pageInfo; - } - public void setPageInfo(PageInfo pageInfo) { - this.pageInfo = pageInfo; - } - public Sort getSort() { - return sort; - } - public void setSort(Sort sort) { - this.sort = sort; - } - public Product getParams() { - return params; - } - public void setParams(Product params) { - this.params = params; - } - public List<Product> getResults() { - return results; - } - public void setResults(List<Product> results) { - this.results = results; - } - public Map<String, String> getQueryParam() { - return queryParam; - } - public void setQueryParam(Map<String, String> queryParam) { - this.queryParam = queryParam; - } - - - -} diff --git a/src/main/java/com/product/lucene/entity/Product.java b/src/main/java/com/product/lucene/entity/Product.java deleted file mode 100644 index 3ce5475..0000000 --- a/src/main/java/com/product/lucene/entity/Product.java +++ /dev/null @@ -1,387 +0,0 @@ -package com.product.lucene.entity;/** - * Created by Administrator on 2019/11/14/014. - */ - -import java.util.Date; - -/** - * @ClassName Product - * @Description TODO - * @Author yb - * @Date 2019/11/14/0149:57 - * @Version 1.0 - **/ -public class Product { - private Integer id; - - private Long cid1; - - private String cid1Name; - - private Double commission; - - private Double commissionShare; - - private Integer bindType; - - private String brandCode; - - private String brandName; - - private Long comments; - - private Double discount; - - private Integer eliteId; - - private String eliteName; - - private Date getEndTime; - - private Date getStartTime; - - private String link; - - private String materialUrl; - - private String owner; - - private Double pingouPrice; - - private Long pingouTmCount; - - private String pingouUrl; - - private Double price; - - private Double quota; - - private Long shopId; - - private String shopName; - - private Long skuId; - - private String skuName; - - private Long spuid; - - private String url; - - private Date useEndTime; - - private Date useStartTime; - - private String clickurl; - - private Double discountRate; - - private Date updateTime; - - private Date createTime; - - private Integer page; - - private Integer limit; - - private String desc; - - - public Integer getId() { - return id; - } - - public void setId(Integer id) { - this.id = id; - } - - public Long getCid1() { - return cid1; - } - - public void setCid1(Long cid1) { - this.cid1 = cid1; - } - - public String getCid1Name() { - return cid1Name; - } - - public void setCid1Name(String cid1Name) { - this.cid1Name = cid1Name; - } - - public Double getCommission() { - return commission; - } - - public void setCommission(Double commission) { - this.commission = commission; - } - - public Double getCommissionShare() { - return commissionShare; - } - - public void setCommissionShare(Double commissionShare) { - this.commissionShare = commissionShare; - } - - public Integer getBindType() { - return bindType; - } - - public void setBindType(Integer bindType) { - this.bindType = bindType; - } - - public String getBrandCode() { - return brandCode; - } - - public void setBrandCode(String brandCode) { - this.brandCode = brandCode; - } - - public String getBrandName() { - return brandName; - } - - public void setBrandName(String brandName) { - this.brandName = brandName; - } - - public Long getComments() { - return comments; - } - - public void setComments(Long comments) { - this.comments = comments; - } - - public Double getDiscount() { - return discount; - } - - public void setDiscount(Double discount) { - this.discount = discount; - } - - public Integer getEliteId() { - return eliteId; - } - - public void setEliteId(Integer eliteId) { - this.eliteId = eliteId; - } - - public String getEliteName() { - return eliteName; - } - - public void setEliteName(String eliteName) { - this.eliteName = eliteName; - } - - public Date getGetEndTime() { - return getEndTime; - } - - public void setGetEndTime(Date getEndTime) { - this.getEndTime = getEndTime; - } - - public Date getGetStartTime() { - return getStartTime; - } - - public void setGetStartTime(Date getStartTime) { - this.getStartTime = getStartTime; - } - - public String getLink() { - return link; - } - - public void setLink(String link) { - this.link = link; - } - - public String getMaterialUrl() { - return materialUrl; - } - - public void setMaterialUrl(String materialUrl) { - this.materialUrl = materialUrl; - } - - public String getOwner() { - return owner; - } - - public void setOwner(String owner) { - this.owner = owner; - } - - public Double getPingouPrice() { - return pingouPrice; - } - - public void setPingouPrice(Double pingouPrice) { - this.pingouPrice = pingouPrice; - } - - public Long getPingouTmCount() { - return pingouTmCount; - } - - public void setPingouTmCount(Long pingouTmCount) { - this.pingouTmCount = pingouTmCount; - } - - public String getPingouUrl() { - return pingouUrl; - } - - public void setPingouUrl(String pingouUrl) { - this.pingouUrl = pingouUrl; - } - - public Double getPrice() { - return price; - } - - public void setPrice(Double price) { - this.price = price; - } - - public Double getQuota() { - return quota; - } - - public void setQuota(Double quota) { - this.quota = quota; - } - - public Long getShopId() { - return shopId; - } - - public void setShopId(Long shopId) { - this.shopId = shopId; - } - - public String getShopName() { - return shopName; - } - - public void setShopName(String shopName) { - this.shopName = shopName; - } - - public Long getSkuId() { - return skuId; - } - - public void setSkuId(Long skuId) { - this.skuId = skuId; - } - - public String getSkuName() { - return skuName; - } - - public void setSkuName(String skuName) { - this.skuName = skuName; - } - - public Long getSpuid() { - return spuid; - } - - public void setSpuid(Long spuid) { - this.spuid = spuid; - } - - public String getUrl() { - return url; - } - - public void setUrl(String url) { - this.url = url; - } - - public Date getUseEndTime() { - return useEndTime; - } - - public void setUseEndTime(Date useEndTime) { - this.useEndTime = useEndTime; - } - - public Date getUseStartTime() { - return useStartTime; - } - - public void setUseStartTime(Date useStartTime) { - this.useStartTime = useStartTime; - } - - public String getClickurl() { - return clickurl; - } - - public void setClickurl(String clickurl) { - this.clickurl = clickurl; - } - - public Double getDiscountRate() { - return discountRate; - } - - public void setDiscountRate(Double discountRate) { - this.discountRate = discountRate; - } - - public Date getUpdateTime() { - return updateTime; - } - - public void setUpdateTime(Date updateTime) { - this.updateTime = updateTime; - } - - public Date getCreateTime() { - return createTime; - } - - public void setCreateTime(Date createTime) { - this.createTime = createTime; - } - - public Integer getPage() { - return page; - } - - public void setPage(Integer page) { - this.page = page; - } - - public Integer getLimit() { - return limit; - } - - public void setLimit(Integer limit) { - this.limit = limit; - } - - public String getDesc() { - return desc; - } - - public void setDesc(String desc) { - this.desc = desc; - } - - -} diff --git a/src/main/java/com/product/lucene/entity/Sort.java b/src/main/java/com/product/lucene/entity/Sort.java deleted file mode 100644 index f9f724b..0000000 --- a/src/main/java/com/product/lucene/entity/Sort.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.product.lucene.entity; - -/** - * @ClassName Sort - * @Description TODO - * @Author yb - * @Date 2019/11/12/01219:29 - * @Version 1.0 - **/ -public class Sort { - private String order; - private String Field; - - public String getOrder() { - return order; - } - public void setOrder(String order) { - this.order = order; - } - public String getField() { - return Field; - } - public void setField(String field) { - Field = field; - } - - -} diff --git a/src/main/java/com/product/lucene/service/LuceneService.java b/src/main/java/com/product/lucene/service/LuceneService.java index 1c7017e..92465a5 100644 --- a/src/main/java/com/product/lucene/service/LuceneService.java +++ b/src/main/java/com/product/lucene/service/LuceneService.java @@ -95,7 +95,6 @@ indexWriter.addDocuments(docs); indexWriter.commit(); } catch (IOException e) { - // TODO Auto-generated catch block e.printStackTrace(); } } @@ -104,62 +103,6 @@ file.delete(); } - -/* - public void createdIndex(FieldSetEntity fse) throws IOException { - String function_uuid=fse.getString("function_uuid"); - String service_uuid=fse.getString("service_uuid"); - - //鑾峰彇鍏ㄦ枃妫�绱㈤厤缃� - FieldSetEntity fseConfig=baseDao.getFieldSetEntityByFilter("product_sys_document_search", "function_uuid=?", new Object[] {function_uuid}, false); - if (fseConfig!=null) { - String table_uuid=fseConfig.getString("table_name"); - String attachment_field=fseConfig.getString("attachment_file"); - - //鑾峰彇缂撳瓨琛ㄩ厤缃� - FieldSetEntity fseTable=baseDao.getFieldSetEntity("product_sys_datamodel_table", table_uuid, false); - if (fseTable!=null) { - - //鑾峰彇鍘熸暟鎹� - FieldSetEntity fseService=baseDao.getFieldSetEntityBySQL("SELECT * FROM "+fseTable.getString("table_name")+" WHERE uuid=?", new Object[] {service_uuid}, false); - if (fseService!=null) { - - //鑾峰彇闄勪欢uuids - String attachments=fseService.getString(attachment_field); - if (!StringUtils.isEmpty(attachments)) { - - //閬嶅巻鑾峰彇闄勪欢淇℃伅 - String [] attachment=attachments.split(","); - List<Document> docs=new ArrayList<>(); - for (int i = 0; i < attachment.length; i++) { - - //鑾峰彇闄勪欢淇℃伅 - FieldSetEntity fseAttachment=baseDao.getFieldSetEntity("product_sys_attachments", attachment[i], false); - if (fseAttachment!=null) { - //鑾峰彇闄勪欢 - File file=fileManagerService.getFile(attachment[i]); - if (file!=null) { - //鐢熸垚绱㈠紩淇℃伅 - Document doc=new Document(); - doc.add(new StringField("uuid", attachment[i], Field.Store.YES)); //闄勪欢UUID - doc.add(new TextField("service_uuid", service_uuid, Field.Store.YES)); //涓氬姟UUID - doc.add(new TextField("function_uuid", function_uuid, Field.Store.YES)); //鍏卞棷閭d釜UUID - doc.add(new TextField("file_name", fseAttachment.getString("file_name"), Field.Store.YES)); //鏂囦欢鍚� - doc.add(new TextField("file_content", FileUtils.FileToString(file), Field.Store.YES)); //鏂囦欢鍐呭唴瀹� - docs.add(doc); - } - file.delete(); - } - } - //鍐欏叆绱㈠紩 - indexWriter.addDocuments(docs); - indexWriter.commit(); - } - } - } - } - } -*/ /** * 鏂囨。妫�绱� @@ -192,8 +135,6 @@ //鍒嗛〉鏌ヨ鏂囨。 TopDocs topDocs = searchByPage(fse.getInteger("cpage"), fse.getInteger("pagesize"), indexSearcher, query); - - ScoreDoc[] hits = topDocs.scoreDocs; for (int i = 0; i < hits.length; i++) { diff --git a/src/main/java/com/product/lucene/service/idel/ILuceneService.java b/src/main/java/com/product/lucene/service/idel/ILuceneService.java deleted file mode 100644 index 1860e73..0000000 --- a/src/main/java/com/product/lucene/service/idel/ILuceneService.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.product.lucene.service.idel; - -import com.product.lucene.entity.Product; -import com.product.lucene.entity.PageQuery; - -import java.io.IOException; -import java.text.ParseException; -import java.util.List; - -/** - * @ClassName ILuceneService - * @Description TODO - * @Author yb - * @Date 2019/11/12/01218:00 - * @Version 1.0 - **/ -public interface ILuceneService { - /** - * 澧炲姞绱㈠紩 - * @param list - * @throws IOException - */ - public void createProductIndex(List<Product> list) throws IOException; - - /** - * 鏌ヨ - * @param pageQuery - * @return - * @throws Exception - * @throws ParseException - */ - public PageQuery searchProduct(PageQuery pageQuery) throws Exception, ParseException; - - /** - *鍒犻櫎 - * @param id - * @throws IOException - */ - public void deleteProductIndexById(String id) throws IOException; -} -- Gitblit v1.9.2