almost 7 years ago
For fetching a string for a specific value and length, here are 2 ways to do that. First using @Query and another using solr Criteria.
In the below code it first searches for the string match and then suing filters we have defined the length of that string
@Query(value = "sentence:*?0*",filters="sentence:/.{0,149}./") Page<Sentence> findBySentence(String str, Pageable pageable);
Using criteria we need to use expression to search for specified length. For sentence match we can either use contains or expression.
new Criteria(); Criteria conditions = ((Criteria.where("sentence").expression("*"+str+"*")).and(Criteria.where("sentence").expression("/.{0,149}./"))); // using expression for stirng search //Criteria conditions = ((Criteria.where("sentence").contains(str)).and(Criteria.where("sentence").expression("/.{0,149}./"))); // using contains for stirng search SimpleQuery search = new SimpleQuery(conditions); sentenceList = solrTemplate.queryForPage(search, Subtitle.class);
Starting with Chrome version 45, NPAPI is no longer supported for Google Chrome. For more information, see Chrome and NPAPI (blog.chromium.org).
Firefox and Microsoft Internet Explorer are recommended browsers for websites using java applets.
Chrome Version Support
Are you sure, you want to delete this comment?
Sign up using
0 Comment(s)