spring-projects/spring-data-mongodb — pull request #212 by christophstrobl (2014-08-04 10:01:51+00:00)
Title: DATAMONGO-973 - Add support for deriving fulltext queries.

We’ve introduced text query specific methods for `MongoRepository` that allow direct usage of `TextCriteria`.

Retrieving document _score_ and sorting by _score_ is only possible if the entity holds a property annotated with `@TextScore`. If present, any _find_ execution will be enriched so that it asserts loading of the according `{ $meta : textScore }` field. The _sort_ object will only be mapped in case of an existing sort property for the _score_ holding property - in that case we replace the existing expression with its `$meta` representation.

This allows for example the following:

```java
TextCriteria crit = TextCriteria.forDefaultLanguage().matching("term");
List all = findAllBy(crit, new Sort("score"))
Page page = findBy(crit, new PageRequest(0, 10, Direction.DESC, "score"))
List byFoo = findByFooOrderByScoreDesc("foo", crit)
```
For more details and examples see the _Full text search queries_ section in the reference manual.