From 1e4bdda2dd5f16dd9c371d56d4c56634494de9f3 Mon Sep 17 00:00:00 2001 From: pocketContributor Date: Sat, 14 May 2016 22:09:32 +0800 Subject: [PATCH] [nasuf]update sending email with mongo query result --- kindlepocket-cms/pom.xml | 49 ++++++++++++------- .../java/com/kindlepocket/cms/pojo/Item.java | 4 ++ .../cms/service/TextBookSearchService.java | 5 +- 3 files changed, 39 insertions(+), 19 deletions(-) diff --git a/kindlepocket-cms/pom.xml b/kindlepocket-cms/pom.xml index 9bd7a87..a44485c 100644 --- a/kindlepocket-cms/pom.xml +++ b/kindlepocket-cms/pom.xml @@ -1,10 +1,11 @@ - - 4.0.0 - com.kindlepocket.cms - kindlepocket-cms - 0.0.1-SNAPSHOT - - + + 4.0.0 + com.kindlepocket.cms + kindlepocket-cms + 0.0.1-SNAPSHOT + + org.springframework.boot spring-boot-starter-parent 1.3.3.RELEASE @@ -16,18 +17,15 @@ spring-boot-starter-web - + org.apache.solr solr-solrj 4.10.1 - + org.apache.commons commons-lang3 @@ -39,19 +37,36 @@ commons-io 1.3.2 - + com.fasterxml.jackson.core jackson-databind - + junit junit test + + org.springframework.boot + spring-boot-starter-data-mongodb + + + + javax.mail + mail + 1.4.1 + + + + javax.activation + activation + 1.1 + + - - + + \ No newline at end of file diff --git a/kindlepocket-cms/src/main/java/com/kindlepocket/cms/pojo/Item.java b/kindlepocket-cms/src/main/java/com/kindlepocket/cms/pojo/Item.java index cc689a1..3707d74 100644 --- a/kindlepocket-cms/src/main/java/com/kindlepocket/cms/pojo/Item.java +++ b/kindlepocket-cms/src/main/java/com/kindlepocket/cms/pojo/Item.java @@ -1,13 +1,17 @@ package com.kindlepocket.cms.pojo; import org.apache.solr.client.solrj.beans.Field; +import org.springframework.data.annotation.Id; +import org.springframework.data.mongodb.core.mapping.Document; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; // ignore unknown fields @JsonIgnoreProperties(ignoreUnknown = true) +@Document public class Item { + @Id @Field("id") private Long id; diff --git a/kindlepocket-cms/src/main/java/com/kindlepocket/cms/service/TextBookSearchService.java b/kindlepocket-cms/src/main/java/com/kindlepocket/cms/service/TextBookSearchService.java index 65c704b..9b07335 100644 --- a/kindlepocket-cms/src/main/java/com/kindlepocket/cms/service/TextBookSearchService.java +++ b/kindlepocket-cms/src/main/java/com/kindlepocket/cms/service/TextBookSearchService.java @@ -24,14 +24,14 @@ public class TextBookSearchService { public void testAddData() { HttpSolrServer solrServer = new HttpSolrServer("http://localhost:8983/kindlePocket"); List items = new ArrayList(); - for (int i = 1; i <= 200; i++) { + for (int i = 400; i <= 450; i++) { Item item = new Item(); item.setDownloadTimes(new Date().getTime()); item.setAuthor("nasuf_" + i); item.setId((long) i); item.setKindleMailTimes((long) i); item.setMailTimes((long) i); - item.setTitle("nasuf's No." + i); + item.setTitle("ephemeris_No." + i); item.setUploadDate(new Date().getTime()); item.setUploaderName("nasuf_" + i); items.add(item); @@ -81,6 +81,7 @@ public SearchResult search(String keyWords, Integer page, Integer rows) throws E // whether need highlight boolean isHighlighting = !StringUtils.equals("*", keyWords) && StringUtils.isNotEmpty(keyWords); + isHighlighting = false; if (isHighlighting) { // highlight config // enable highlight