Search in sources :

Example 11 with SimpleQuery

use of org.springframework.data.solr.core.query.SimpleQuery in project nixmash-blog by mintster.

the class SolrLocationTests method tearDown.

@After
public void tearDown() {
    Query query = new SimpleQuery(new SimpleStringCriteria("cat:test"));
    solrOperations.delete(query);
    solrOperations.commit();
}
Also used : SimpleQuery(org.springframework.data.solr.core.query.SimpleQuery) Query(org.springframework.data.solr.core.query.Query) SimpleQuery(org.springframework.data.solr.core.query.SimpleQuery) SimpleStringCriteria(org.springframework.data.solr.core.query.SimpleStringCriteria) After(org.junit.After)

Example 12 with SimpleQuery

use of org.springframework.data.solr.core.query.SimpleQuery in project nixmash-blog by mintster.

the class CustomPostDocRepositoryImpl method quickSearch.

@Override
public List<PostDoc> quickSearch(String searchTerms) {
    logger.debug("Searching Title and Body with Multiple Terms : {}", searchTerms);
    Query query = new SimpleQuery(titleAndBodyCriteria(searchTerms));
    query.setRows(1000);
    Page<PostDoc> results = solrTemplate.queryForPage(query, PostDoc.class);
    return results.getContent();
}
Also used : SimpleQuery(org.springframework.data.solr.core.query.SimpleQuery) Query(org.springframework.data.solr.core.query.Query) SimpleQuery(org.springframework.data.solr.core.query.SimpleQuery) IPostDoc(com.nixmash.blog.solr.model.IPostDoc) PostDoc(com.nixmash.blog.solr.model.PostDoc)

Example 13 with SimpleQuery

use of org.springframework.data.solr.core.query.SimpleQuery in project nixmash-blog by mintster.

the class CustomPostDocRepositoryImpl method pagedQuickSearch.

@Override
public Page<PostDoc> pagedQuickSearch(String searchTerms, PageRequest pageRequest) {
    logger.debug("Paged Title and Body Quick Search with : {}", searchTerms);
    Query query = new SimpleQuery(titleAndBodyCriteria(searchTerms));
    query.setRows(1000);
    query.setPageRequest(pageRequest);
    Page<PostDoc> results = solrTemplate.queryForPage(query, PostDoc.class);
    return results;
}
Also used : SimpleQuery(org.springframework.data.solr.core.query.SimpleQuery) Query(org.springframework.data.solr.core.query.Query) SimpleQuery(org.springframework.data.solr.core.query.SimpleQuery) IPostDoc(com.nixmash.blog.solr.model.IPostDoc) PostDoc(com.nixmash.blog.solr.model.PostDoc)

Example 14 with SimpleQuery

use of org.springframework.data.solr.core.query.SimpleQuery 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();
}
Also used : SimpleQuery(org.springframework.data.solr.core.query.SimpleQuery) Query(org.springframework.data.solr.core.query.Query) SimpleQuery(org.springframework.data.solr.core.query.SimpleQuery) Criteria(org.springframework.data.solr.core.query.Criteria) IPostDoc(com.nixmash.blog.solr.model.IPostDoc) PostDoc(com.nixmash.blog.solr.model.PostDoc)

Example 15 with SimpleQuery

use of org.springframework.data.solr.core.query.SimpleQuery 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;
}
Also used : SimpleQuery(org.springframework.data.solr.core.query.SimpleQuery) Query(org.springframework.data.solr.core.query.Query) SimpleQuery(org.springframework.data.solr.core.query.SimpleQuery) Criteria(org.springframework.data.solr.core.query.Criteria) IPostDoc(com.nixmash.blog.solr.model.IPostDoc) PostDoc(com.nixmash.blog.solr.model.PostDoc)

Aggregations

SimpleQuery (org.springframework.data.solr.core.query.SimpleQuery)16 Query (org.springframework.data.solr.core.query.Query)14 SimpleStringCriteria (org.springframework.data.solr.core.query.SimpleStringCriteria)10 PostDoc (com.nixmash.blog.solr.model.PostDoc)8 IPostDoc (com.nixmash.blog.solr.model.IPostDoc)5 Post (com.nixmash.blog.jpa.model.Post)4 Criteria (org.springframework.data.solr.core.query.Criteria)4 Before (org.junit.Before)3 Test (org.junit.Test)3 Product (com.nixmash.blog.solr.model.Product)2 After (org.junit.After)2 Transactional (org.springframework.transaction.annotation.Transactional)2 GeoLocationException (com.nixmash.blog.solr.exceptions.GeoLocationException)1 ArrayList (java.util.ArrayList)1 Ignore (org.junit.Ignore)1 PageRequest (org.springframework.data.domain.PageRequest)1 Distance (org.springframework.data.geo.Distance)1 Point (org.springframework.data.geo.Point)1 FacetFieldEntry (org.springframework.data.solr.core.query.result.FacetFieldEntry)1