Score null when sorting results

Hello, when using a sort field, I'm getting every _meta.score = null value

I'm sorting products by price. When ordering by price asc, I'm getting cheap products that have nothing to do with the query field.


	"query": "zapatillas",
	"page": {
	    "size": 1000,
	    "current": 1
	"search_fields": {
    		"nombre": { "weight":3 },
    		"descripcion": { "weight":1 },
    		"localnombre": { "weight":1 }
	"result_fields": {
		"id": { "raw": {} },
	    	"nombre": {"raw": {} },
	    	"idgaleria": {"raw": {} },
	    	"precio": {	"raw": {} },
	    	"foto": {	"raw": {} },
	    	"localdireccion": {	"raw": {} },
	    	"random": {	"raw": {} }
	"sort": {"precio": "asc"}


   "meta":    {
      "alerts": [],
      "warnings": [],
      "page":       {
         "current": 1,
         "total_pages": 1,
         "total_results": 989,
         "size": 1000
      "engine":       {
         "name": "productos",
         "type": "default"
      "request_id": "ac65c458-4861-47f8-b84e-657d560d990e"
   "results":    [
         "foto": {"raw": "1_thumb.jpg"},
         "precio": {"raw": 63},
         "_meta":          {
            "engine": "productos",
            "id": "7118",
            "score": null
         "idgaleria": {"raw": 0},
         "id": {"raw": "7118"},
         "nombre": {"raw": "plantines para zapatilla de dama"},
         "localdireccion": {"raw": "CARACAS 666"},
         "random": {"raw": 7118}

App Search does some very aggressive matching, which means you'll tend to have very large sets of results, some of which appear are false positives.

If I had to guess, you're most likely getting hits on your description field. Those types of fields tend to have very long text and more possibilities for words to match.

Having large sets of results like this works well as long as relevance is tuned well so that the most relevant results score high.

This can be problematic when you apply a sort, as you've found, as relevance ranking is no longer considered and you now have totally unrelated results appearing first in your result set.

Another option you could explore is instead of applying a sort, you could try boosting results with lower prices via the search_fields parameter.

1 Like

Thank you @JasonStoltz
Tried removing the description from the search fields, however I'm still getting many wrong matches just with the title.
Probably those matches wouldn't appear sorting by score since they match by similarity (for example when searching "parka" I get many matches with "para", a very common spanish preposition)

I'm not sure how to apply the boost, since having a low price isn't always a bad thing. Analyzing just the price, without taking in consideration how similar is the query and the search fields, may produce unexpected results

See Options for increasing precision

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.