Comment 1 for bug 1531577

Revision history for this message
James Tait (jamestait) wrote :

The localised screenshot URLs are not in the Index:

```
$ curl -s 'https://search.apps.ubuntu.com/api/v1/search?q=name:uber-web.saviq&fields=translations' | jq .
{
  "_embedded": {
    "clickindex:package": [
      {
        "_links": {
          "self": {
            "href": "https://search.apps.ubuntu.com/api/v1/package/uber-web.saviq"
          }
        },
        "translations": {
          "pl": {
            "keywords": [
              "uber",
              "taxi",
              "taksówka",
              "taksowka",
              "transport"
            ],
            "description": "Mobilna aplikacja Uber.\r\n\r\nUWAGA:\r\nJeśli podczas zamawiania przejazdu aplikacja poinformuje, że używasz zbyt starej wersji, musisz zgłosić ten problem na <email address hidden>, oni aktywują dostęp do http://m.uber.com/ dla twojego konta.",
            "title": "Uber Mobile"
          }
        }
      }
    ]
  },
  "_links": {
    "curies": [
      {
        "href": "https://wiki.ubuntu.com/AppStore/Interfaces/ClickPackageIndex#reltype_{rel}",
        "name": "clickindex",
        "templated": true
      }
    ],
    "self": {
      "href": "https://search.apps.ubuntu.com/api/v1/search?q=name%3Auber-web.saviq&fields=translations&page=1"
    },
    "last": {
      "href": "https://search.apps.ubuntu.com/api/v1/search?q=name%3Auber-web.saviq&fields=translations&page=1"
    },
    "first": {
      "href": "https://search.apps.ubuntu.com/api/v1/search?q=name%3Auber-web.saviq&fields=translations&page=1"
    }
  }
}
```

However, local testing has shown that if localised screenshot URLs are provided in the translations dict when publishing to the index, then they are returned as expected:

```
$ curl 'http://cpi-trusty.lxc:8000/api/v1/search?q=name:ubuntu-hangups.timsueberkrueb&fields=screenshot_urls,translations' -H 'Accept-Language: en' -s | jq .
{
  "_embedded": {
    "clickindex:package": [
      {
        "_links": {
          "self": {
            "href": "http://localhost:8000/api/v1/package/ubuntu-hangups.timsueberkrueb"
          }
        },
        "translations": {
          "pl": {
            "screenshot_urls": [
              "http://localhost/dummy.png",
              "http://localhost/dummy2.png"
            ]
          }
        },
        "screenshot_urls": [
          "https://myapps.developer.ubuntu.com/site_media/appmedia/2015/08/screenshot-02.png",
          "https://myapps.developer.ubuntu.com/site_media/appmedia/2015/08/screenshot-03.png",
          "https://myapps.developer.ubuntu.com/site_media/appmedia/2015/09/screenshot20150906_142917143.png",
          "https://myapps.developer.ubuntu.com/site_media/appmedia/2015/09/screenshot20150906_143014836.png",
          "https://myapps.developer.ubuntu.com/site_media/appmedia/2015/09/screenshot20150906_143112530.png",
          "https://myapps.developer.ubuntu.com/site_media/appmedia/2015/09/screenshot20150906_143201841.png",
          "https://myapps.developer.ubuntu.com/site_media/appmedia/2015/09/screenshot20150906_143214054.png",
          "https://myapps.developer.ubuntu.com/site_media/appmedia/2015/09/screenshot20150906_143221620.png",
          "https://myapps.developer.ubuntu.com/site_media/appmedia/2015/09/screenshot20150906_143352523.png",
          "https://myapps.developer.ubuntu.com/site_media/appmedia/2015/09/screenshot20150906_143417862.png"
        ]
      }
    ]
  },
  "_links": {
    "curies": [
      {
        "href": "https://wiki.ubuntu.com/AppStore/Interfaces/ClickPackageIndex#reltype_{rel}",
        "name": "clickindex",
        "templated": true
      }
    ],
    "self": {
      "href": "http://localhost:8000/api/v1/search?q=name%3Aubuntu-hangups.timsueberkrueb&fields=screenshot_urls%2Ctranslations&page=1"
    },
    "last": {
      "href": "http://localhost:8000/api/v1/search?q=name%3Aubuntu-hangups.timsueberkrueb&fields=screenshot_urls%2Ctranslations&page=1"
    },
    "first": {
      "href": "http://localhost:8000/api/v1/search?q=name%3Aubuntu-hangups.timsueberkrueb&fields=screenshot_urls%2Ctranslations&page=1"
    }
  }
}

$ curl 'http://cpi-trusty.lxc:8000/api/v1/search?q=name:ubuntu-hangups.timsueberkrueb&fields=screenshot_urls,translations' -H 'Accept-Language: pl' -s | jq .
{
  "_embedded": {
    "clickindex:package": [
      {
        "_links": {
          "self": {
            "href": "http://localhost:8000/api/v1/package/ubuntu-hangups.timsueberkrueb"
          }
        },
        "translations": {
          "pl": {
            "screenshot_urls": [
              "http://localhost/dummy.png",
              "http://localhost/dummy2.png"
            ]
          }
        },
        "screenshot_urls": [
          "http://localhost/dummy.png",
          "http://localhost/dummy2.png"
        ]
      }
    ]
  },
  "_links": {
    "curies": [
      {
        "href": "https://wiki.ubuntu.com/AppStore/Interfaces/ClickPackageIndex#reltype_{rel}",
        "name": "clickindex",
        "templated": true
      }
    ],
    "self": {
      "href": "http://localhost:8000/api/v1/search?q=name%3Aubuntu-hangups.timsueberkrueb&fields=screenshot_urls%2Ctranslations&page=1"
    },
    "last": {
      "href": "http://localhost:8000/api/v1/search?q=name%3Aubuntu-hangups.timsueberkrueb&fields=screenshot_urls%2Ctranslations&page=1"
    },
    "first": {
      "href": "http://localhost:8000/api/v1/search?q=name%3Aubuntu-hangups.timsueberkrueb&fields=screenshot_urls%2Ctranslations&page=1"
    }
  }
}
```

Looking at the myapps code, it looks like the `ClickPackage` model only defines `name`, `description`, `keywords`, `terms_of_service`, `support_url`, and `website` as multilingual fields, so I'm re-assigning the bug there.