add log info for match
This commit is contained in:
parent
6b4c829653
commit
ffe06bf437
|
|
@ -75,10 +75,12 @@ public class Match {
|
|||
// 项目名匹配帖子标题
|
||||
matchMap = LuceneSearch.prjToMemoMatchByLucene(prjName,
|
||||
LuceneIndex.titleFieldName, titleWeight, matchMap, memoIndexReader);
|
||||
System.out.println("项目名匹配帖子标题"+matchMap.size());
|
||||
// 项目名匹配帖子标签
|
||||
matchMap = LuceneSearch.searchMemoTags(
|
||||
prjName, LuceneIndex.memoTagsFieldName, LuceneIndex.memoIdFieldName, memoTagsWeight,
|
||||
matchMap, memoIndexReader);
|
||||
System.out.println("项目名匹配帖子标签"+matchMap.size());
|
||||
}
|
||||
if (project.getSynonyms() != null) {
|
||||
synonyms = project.getSynonyms().toLowerCase();
|
||||
|
|
@ -89,12 +91,14 @@ public class Match {
|
|||
matchMap = LuceneSearch.prjToMemoMatchByLucene(synonym,
|
||||
LuceneIndex.titleFieldName, titleWeight, matchMap, memoIndexReader);
|
||||
}
|
||||
System.out.println("项目别名匹配帖子标题 "+matchMap.size());
|
||||
//项目别名匹配帖子标签 TODO
|
||||
for (String synonym : synonymsList) {
|
||||
matchMap = LuceneSearch.searchMemoTags(
|
||||
synonym, LuceneIndex.memoTagsFieldName, LuceneIndex.memoIdFieldName, memoTagsWeight,
|
||||
matchMap, memoIndexReader);
|
||||
}
|
||||
System.out.println("项目别名匹配帖子标签 "+matchMap.size());
|
||||
}
|
||||
}
|
||||
if (prjTags != null && prjTags.length() > 0 && matchMap.size() > 0) {
|
||||
|
|
@ -105,12 +109,14 @@ public class Match {
|
|||
prjTag, LuceneIndex.titleFieldName, LuceneIndex.memoIdFieldName, prjTagsToMemoTitleWeight,
|
||||
matchMap, memoIndexReader);
|
||||
}
|
||||
System.out.println("用项目标签搜索帖子标题 "+matchMap.size());
|
||||
// 用项目标签搜索帖子标签
|
||||
for (String prjTag : prjTagsList) {
|
||||
matchMap = LuceneSearch.searchByPrjTag(
|
||||
prjTag, LuceneIndex.memoTagsFieldName, LuceneIndex.memoIdFieldName, prjTagsToMemoTagsWeight,
|
||||
matchMap, memoIndexReader);
|
||||
}
|
||||
System.out.println("用项目标签搜索帖子标签 "+matchMap.size());
|
||||
}
|
||||
if (matchMap.size() > 0)
|
||||
insertPrjToMemoMatchResult(prjId, matchMap);
|
||||
|
|
@ -229,9 +235,9 @@ public class Match {
|
|||
memoTags = memo.getTags().toLowerCase();
|
||||
}
|
||||
memoTitle = memo.getTitle().toLowerCase();
|
||||
if (memoTitle.length() == 0) {
|
||||
continue;
|
||||
}
|
||||
// if (memoTitle.length() == 0) {
|
||||
// continue;
|
||||
// }
|
||||
if (Normalizer.isAllNumber(memoTitle)) {
|
||||
continue;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,56 +13,16 @@ public class MatchIncrement extends Thread implements Runnable {
|
|||
private Logger logger = LoggerFactory.getLogger(getClass());
|
||||
private int memoHistory; // the record of memo after matching last time
|
||||
private static File record; // record file "record.txt"
|
||||
private boolean newPrjComing; //新项目进入标识
|
||||
private boolean newMemoComing; //新帖子进入标识
|
||||
private boolean currentMatchDone = true; //当前批量匹配是否结束
|
||||
private boolean newPrjComing; // 新项目进入标识
|
||||
private boolean newMemoComing; // 新帖子进入标识
|
||||
private boolean currentMatchDone = true; // 当前批量匹配是否结束
|
||||
private int sleepTime = 0;
|
||||
|
||||
public boolean isNewPrjComing() {
|
||||
return newPrjComing;
|
||||
}
|
||||
|
||||
public void setNewPrjComing(boolean newPrjComing) {
|
||||
this.newPrjComing = newPrjComing;
|
||||
}
|
||||
|
||||
public boolean isNewMemoComing() {
|
||||
return newMemoComing;
|
||||
}
|
||||
|
||||
public void setNewMemoComing(boolean newMemoComing) {
|
||||
this.newMemoComing = newMemoComing;
|
||||
}
|
||||
|
||||
public int getSleepTime() {
|
||||
return sleepTime;
|
||||
}
|
||||
|
||||
public void setSleepTime(int sleepTime) {
|
||||
this.sleepTime = sleepTime;
|
||||
}
|
||||
|
||||
public MatchIncrement() {
|
||||
record = new File("record.txt");
|
||||
getMatchRecord();
|
||||
}
|
||||
|
||||
public int getMemoHistory() {
|
||||
return memoHistory;
|
||||
}
|
||||
|
||||
public synchronized void setMemoHistory(int memoHistory) {
|
||||
this.memoHistory = memoHistory;
|
||||
}
|
||||
|
||||
public boolean isCurrentMatchDone() {
|
||||
return currentMatchDone;
|
||||
}
|
||||
|
||||
public synchronized void setCurrentMatchDone(boolean currentMatchDone) {
|
||||
this.currentMatchDone = currentMatchDone;
|
||||
}
|
||||
|
||||
/**
|
||||
* read the record after matching last time from record file "record.txt",
|
||||
* the format of the record in the file: "project's record" "memo's record"
|
||||
|
|
@ -91,4 +51,45 @@ public class MatchIncrement extends Thread implements Runnable {
|
|||
logger.error("writeIntoRecord FileNotFoundException: " + e);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isNewPrjComing() {
|
||||
return newPrjComing;
|
||||
}
|
||||
|
||||
public void setNewPrjComing(boolean newPrjComing) {
|
||||
this.newPrjComing = newPrjComing;
|
||||
}
|
||||
|
||||
public boolean isNewMemoComing() {
|
||||
return newMemoComing;
|
||||
}
|
||||
|
||||
public void setNewMemoComing(boolean newMemoComing) {
|
||||
this.newMemoComing = newMemoComing;
|
||||
}
|
||||
|
||||
public int getSleepTime() {
|
||||
return sleepTime;
|
||||
}
|
||||
|
||||
public void setSleepTime(int sleepTime) {
|
||||
this.sleepTime = sleepTime;
|
||||
}
|
||||
|
||||
public int getMemoHistory() {
|
||||
return memoHistory;
|
||||
}
|
||||
|
||||
public synchronized void setMemoHistory(int memoHistory) {
|
||||
this.memoHistory = memoHistory;
|
||||
}
|
||||
|
||||
public boolean isCurrentMatchDone() {
|
||||
return currentMatchDone;
|
||||
}
|
||||
|
||||
public synchronized void setCurrentMatchDone(boolean currentMatchDone) {
|
||||
this.currentMatchDone = currentMatchDone;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -64,15 +64,17 @@ public class Normalizer {
|
|||
}
|
||||
|
||||
public static void main(String []args) {
|
||||
String content = "大声道Corvette123 *&%9&^&%&^%(*_asd's_12 L'Aur--ore, 1766-1775";
|
||||
int a = 1 + 11000/11000;
|
||||
String targetTableName = "relative_memo_to_open_source_projects_" + a;
|
||||
//System.out.println(StringFilter(content));
|
||||
String result = content.replaceAll("[^0-9a-zA-Z]"," ");
|
||||
System.out.println(result);
|
||||
System.out.println(normalize(content));
|
||||
System.out.println(content.lastIndexOf(" "));
|
||||
//System.out.println(StringFilter(content));
|
||||
// String content = "大声道Corvette123 *&%9&^&%&^%(*_asd's_12 L'Aur--ore, 1766-1775";
|
||||
// int a = 1 + 11000/11000;
|
||||
// String targetTableName = "relative_memo_to_open_source_projects_" + a;
|
||||
// //System.out.println(StringFilter(content));
|
||||
// String result = content.replaceAll("[^0-9a-zA-Z]"," ");
|
||||
// System.out.println(result);
|
||||
// System.out.println(normalize(content));
|
||||
// System.out.println(content.lastIndexOf(" "));
|
||||
// //System.out.println(StringFilter(content));
|
||||
String a = "'One' PHP cache";
|
||||
System.out.println(getList(a));
|
||||
}
|
||||
/**
|
||||
* if a string only contains digital
|
||||
|
|
|
|||
Loading…
Reference in New Issue