use of com.nixmash.blog.solr.model.PostDoc in project nixmash-blog by mintster.
the class PostDocServiceImpl method addToIndex.
@Transactional
@Override
public void addToIndex(Post post) {
logger.debug("Saving a Post Document with information: {}", post);
PostDoc document = SolrUtils.createPostDoc(post);
customPostDocRepository.save(document);
commit();
}
use of com.nixmash.blog.solr.model.PostDoc in project nixmash-blog by mintster.
the class SolrPostReindexTests method cleanAndReindexPostDocuments_AddIndividually.
@Test
@Ignore(value = "It works, no need to wait for it to run each time")
public void cleanAndReindexPostDocuments_AddIndividually() throws Exception {
posts = postService.getAllPublishedPosts();
postCount = posts.size();
for (Post post : posts) {
postDocService.addToIndex(post);
}
List<PostDoc> postDocs = postDocService.getAllPostDocuments();
assertEquals(postDocs.size(), postCount);
postDocs = postDocService.getPostsWithUserQuery("bootstrap");
assertEquals(BOOTSTRAP_POST_COUNT, postDocs.size());
Query query = new SimpleQuery(new SimpleStringCriteria("doctype:post"));
solrOperations.delete(query);
solrOperations.commit();
}
use of com.nixmash.blog.solr.model.PostDoc in project nixmash-blog by mintster.
the class SolrPostTests method addPostWithRepository.
@Test
public void addPostWithRepository() throws Exception {
// using postId 10 which is "Solr Rama"
Post post = postService.getPostById(10L);
PostDoc postDoc = SolrUtils.createPostDoc(post);
customPostDocRepository.save(postDoc);
PostDoc found = customPostDocRepository.findOne("10");
assertEquals(found.getPostName(), "solr-rama");
customPostDocRepository.delete("10");
}
use of com.nixmash.blog.solr.model.PostDoc in project nixmash-blog by mintster.
the class SolrPostTests method fullSearchWithPostType_POST_ReturnsAll.
@Test
public void fullSearchWithPostType_POST_ReturnsAll() throws Exception {
PostQueryDTO postQueryDTO = new PostQueryDTO("body:begins", PostType.POST);
List<PostDoc> postDocs = postDocService.doFullSearch(postQueryDTO);
assertEquals(postDocs.size(), 3);
}
use of com.nixmash.blog.solr.model.PostDoc in project nixmash-blog by mintster.
the class SolrPostTests method findPostDocByPostIdNotNullWithService.
@Test
public void findPostDocByPostIdNotNullWithService() throws Exception {
PostDoc postDoc = postDocService.getPostDocByPostId(1L);
assertNotNull(postDoc);
}
Aggregations