<commit_before>package com.github.onsdigital.babbage.request.handler.list;

import com.github.onsdigital.babbage.api.util.SearchUtils;
import com.github.onsdigital.babbage.request.handler.base.ListRequestHandler;
import com.github.onsdigital.babbage.response.base.BabbageResponse;
import com.github.onsdigital.babbage.search.helpers.base.SearchQueries;
import com.github.onsdigital.babbage.search.model.ContentType;

import javax.servlet.http.HttpServletRequest;
import java.io.IOException;

import static com.github.onsdigital.babbage.api.util.SearchUtils.listPage;
import static com.github.onsdigital.babbage.api.util.SearchUtils.listJson;
import static com.github.onsdigital.babbage.search.builders.ONSQueryBuilders.toList;

public class StaticsRequestHandler implements ListRequestHandler {

    private final static String REQUEST_TYPE = "staticlist";

    @Override
    public BabbageResponse get(String uri, HttpServletRequest request) throws Exception {
        return listPage(REQUEST_TYPE, queries(request));
    }

    @Override
    public BabbageResponse getData(String uri, HttpServletRequest request) throws IOException {
        return listJson(REQUEST_TYPE, queries(request));
    }

    private SearchQueries queries(HttpServletRequest request) {
        return () -> toList(
                SearchUtils
                        .buildListQuery(request)
                        .types(ContentType.static_page)
        );
    }

    @Override
    public String getRequestType() {<commit_msg>Fixed: Static list page does not show content relative to url<commit_after>package com.github.onsdigital.babbage.request.handler.list;

import com.github.onsdigital.babbage.api.util.SearchUtils;
import com.github.onsdigital.babbage.request.handler.base.ListRequestHandler;
import com.github.onsdigital.babbage.response.base.BabbageResponse;
import com.github.onsdigital.babbage.search.builders.ONSFilterBuilders;
import com.github.onsdigital.babbage.search.helpers.base.SearchFilter;
import com.github.onsdigital.babbage.search.helpers.base.SearchQueries;
import com.github.onsdigital.babbage.search.model.ContentType;

import javax.servlet.http.HttpServletRequest;
import java.io.IOException;

import static com.github.onsdigital.babbage.api.util.SearchUtils.listJson;
import static com.github.onsdigital.babbage.api.util.SearchUtils.listPage;
import static com.github.onsdigital.babbage.search.builders.ONSQueryBuilders.toList;

public class StaticsRequestHandler implements ListRequestHandler {

    private final static String REQUEST_TYPE = "staticlist";

    @Override
    public BabbageResponse get(String uri, HttpServletRequest request) throws Exception {
        return listPage(REQUEST_TYPE, queries(uri,request));
    }

    @Override
    public BabbageResponse getData(String uri, HttpServletRequest request) throws IOException {
        return listJson(REQUEST_TYPE, queries(uri,request));
    }


    private SearchQueries queries(String uri, HttpServletRequest request) {
        return () -> toList(
                SearchUtils
                        .buildListQuery(request, filters(uri))
                        .types(ContentType.static_page)
        );
    }

    private SearchFilter filters(String uri) {
        return (listQuery) -> ONSFilterBuilders.filterUriPrefix(uri, listQuery);
    }

    @Override
    public String getRequestType() {
{'fraction_non_alphanumeric': 0.0868662911354877, 'fraction_numerical': 0.0, 'mean_word_length': 4.081325301204819, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7396399', 'n_tokens_mistral': 964, 'n_tokens_neox': 925, 'n_words': 171}