-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Linked crawler with database #83
Conversation
…atching algorithm was implemented
…y to database after matching with certain counter and status.
Есть вопрос по моей реализации. В задаче #81 я описал вопрос. В итоге я сделал несколько сервиcов, но из-за этого получились довольно перегруженными своими параметрами классы |
Проблема большого количества параметров решается вынесением этих параметров в отдельный класс, скажем |
Небольшое уточнение, |
Ну да, я уже объединял параметры краулера в класс |
<dependency> | ||
<groupId>edu.uci.ics</groupId> | ||
<artifactId>crawler4j</artifactId> | ||
<version>LATEST</version> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Не стоит использовать LATEST версию, особенно для сторонних зависимостей. Рлюс версию нужно вынести в properties.
public class DummyMemoMatchingImpl implements MemoMatching { | ||
@Override | ||
public boolean match(Memo candidate) { | ||
if (candidate.getCounter() > 5L) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Нужно вынести магические числа в константы
* Created by Anatoly on 26.10.2016. | ||
*/ | ||
public interface MemoParser { | ||
void parse(String text, Memo candidate); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
На мой взгялд, неудачный интерфейс. Его предназначение - загадка для меня. Что парсим и зачем? А как данные вернуть? Ниже в реализации интерфейса я вижу, что данные возвращаются через параметр candidate
, но это очень неявно.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ну название видимо неудачное. Он нужен для того, чтобы из текста вытаскивать упоминания о меме каким-либо образом.
|
||
@Override | ||
public void deleteMemo(Memo memo) { | ||
List memosByTitle = searchMemoService.findMemosByTitle(memo.getTitle()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
А давай сделаем так, чтобы SearchMemoService.findMemosByTitle
возвращал List?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
List<Memo>
я имел ввиду
private BasicMemoService basicMemoService; | ||
private SearchMemoService searchMemoService; | ||
|
||
@Autowired |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
А зачем здесь @Autowired
?
Краулер теперь добавляет в бд нашедший мем или обновляет, если он уже есть #82. Добавлен базовый сервис с операцией сохранения и удаления, чтобы не работать напрямую с дао #81. Все сервисы перемещены в в отдельный пакет api/memo/services.