@Override
    public com.yahoo.search.Result search(Query query, Execution execution) {
        Location location = query.getRanking().getLocation();
        if (location != null && (location.getAttribute() == null)) {
            IndexFacts facts = execution.context().getIndexFacts();
            List<String> search = facts.newSession(query.getModel().getSources(), query.getModel().getRestrict()).documentTypes();

            for (String sd : search) {
                String defaultPosition = facts.getDefaultPosition(sd);
                if (defaultPosition != null) {
                    location.setAttribute(defaultPosition);
                }
            }
            if (location.getAttribute() == null) {
                location.setAttribute(facts.getDefaultPosition(null));
            }
        }
        if (useV8GeoPositions && (location != null) && (location.getAttribute() != null)) {
            var geoLoc = new GeoLocationItem(location);
            if (location.isGeoCircle() && location.degRadius() < 0) {
                query.getModel().getQueryTree().withRank(geoLoc);
            } else {
                query.getModel().getQueryTree().and(geoLoc);
            }
            location = null;
            query.getRanking().setLocation(location);
        }
        return execution.search(query);
    }
If position attribute has not been set, it will be set here.

@author baldersheim
container-search/src/main/java/com/yahoo/search/querytransform/DefaultPositionSearcher.java