Indexing and Search indexes

Standard indexes can be defined in definition json so that Symfony can generated the DB schema and speed up your application. Be aware about limitations:

MongoDb Indexes

Since MongoDB 3 you can define Text Indexes and weighting, if done with care the search results can be fast a very accurate. Better than using complex RQL’s. Min word length is 3 chars.

MongoDB Text Indexes

This works like having one big sentence with the words of the selected fields and the more words matching the search the higher score.

Request search sample

Search user John. If more words are entered in the search brackets query will perform an “and” between them.


Response may contain the following body, all people named john.


    "usernmae": "john.doe",
    "firstName": "John",
    "lastName": "Doe"
}, .... ]


Standard indexes and TextIndexes are located inside the Target block of the definition file. Text Indexes needs to be as object. The higher the weight is the more important, and sorting will be done by weighted sum of coincidences, score.

     "indexes": [
    "textIndexes": [
        "field": "username",
        "weight": 20
        "field": "firstName",
        "weight": 20
        "field": "lastName",
        "weight": 50
        "field": "",
        "weight": 20