4.14. Using Functions
Solr supports several functional expressions within queries. Followig functions are supported out of the box. Custom functions can be added by implementing Function
Class | Solr Function |
---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SimpleQuery query = new SimpleQuery(new SimpleStringCriteria("text:ipod"));
query.addFilterQuery(new FilterQuery(Criteria.where(QueryFunction.query("name:sol*"))));
4.15. Realtime Get
The realtime get allows retrieval of the latest version of any document using the unique-key, without the need to reopen searchers.
realtime get relies on the update log feature. |
Optional<Product> product = solrTemplate.getById("collection-1", "123", Product.class);
Multiple documents can be retrieved by providing a collection of ids as follows:
Collection<String> ids = Arrays.asList("123", "134");
Collection<Product> products = solrTemplate.getByIds("collection-1", ids, Product.class);
4.16. Special Fields
4.16.1. @Score
In order to load score information of a query result, a field annotated with @Score
annotation could be added, indicating the property holding the documents score.
The score property needs to be numerical and can only appear once per document. |
public class MyEntity {
@Id
private String id;
@Score
private Float score;
// setters and getters ...
}