use of com.nixmash.blog.solr.model.PostDoc in project nixmash-blog by mintster.
the class CustomPostDocRepositoryImpl method fullSearch.
@Override
public List<PostDoc> fullSearch(PostQueryDTO postQueryDTO) {
Query query = new SimpleQuery(postQueryDTO.getQuery());
if (!postQueryDTO.getPostType().equals(PostType.UNDEFINED)) {
query.addFilterQuery(new SimpleQuery(new Criteria(IPostDoc.POST_TYPE).is(postQueryDTO.getPostType())));
}
query.addFilterQuery(new SimpleQuery(new Criteria(IPostDoc.DOCTYPE).is(SolrDocType.POST)));
query.setRows(1000);
Page<PostDoc> results = solrTemplate.queryForPage(query, PostDoc.class);
return results.getContent();
}
use of com.nixmash.blog.solr.model.PostDoc in project nixmash-blog by mintster.
the class CustomPostDocRepositoryImpl method pagedFullSearch.
@Override
public Page<PostDoc> pagedFullSearch(PostQueryDTO postQueryDTO, PageRequest pageRequest) {
Query query = new SimpleQuery(postQueryDTO.getQuery());
if (!postQueryDTO.getPostType().equals(PostType.UNDEFINED)) {
query.addFilterQuery(new SimpleQuery(new Criteria(IPostDoc.POST_TYPE).is(postQueryDTO.getPostType())));
}
query.addFilterQuery(new SimpleQuery(new Criteria(IPostDoc.DOCTYPE).is(SolrDocType.POST)));
query.setRows(1000);
query.setPageRequest(pageRequest);
Page<PostDoc> results = solrTemplate.queryForPage(query, PostDoc.class);
return results;
}
use of com.nixmash.blog.solr.model.PostDoc in project nixmash-blog by mintster.
the class SolrPostTests method notFoundPostDocByPostIdIsNull.
@Test
public void notFoundPostDocByPostIdIsNull() throws Exception {
PostDoc postDoc = postDocService.getPostDocByPostId(1000L);
assertNull(postDoc);
}
use of com.nixmash.blog.solr.model.PostDoc in project nixmash-blog by mintster.
the class SolrPostTests method findPostDocByPostIdNotNullWithRepository.
@Test
public void findPostDocByPostIdNotNullWithRepository() throws Exception {
PostDoc postDoc = customPostDocRepository.findPostDocByPostId(1L);
assertNotNull(postDoc);
}
use of com.nixmash.blog.solr.model.PostDoc in project nixmash-blog by mintster.
the class SolrPostTests method updatePostDocumentWithRepository.
@Test
public void updatePostDocumentWithRepository() throws Exception {
// using postId 10 which is "Solr Rama"
String postTitle = "updatePostDocumentWithRepository";
customPostDocRepository.update(updatedPost(postTitle));
PostDoc found = customPostDocRepository.findOne("10");
assertEquals(found.getPostTitle(), postTitle);
}
Aggregations