<commit_before>package com.scaleset.search;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.vividsolutions.jts.geom.Envelope;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@JsonPropertyOrder({"query", "totalItems", "aggs", "bbox", "items"})
@JsonInclude(JsonInclude.Include.NON_EMPTY)
public class Results<T> {

    private Map<String, AggregationResults> aggs = new HashMap<>();
    private List<T> items = new ArrayList<>();
    private Query query;
    private Integer totalItems = 0;
    private Envelope bbox;
    private Map<String, Object> headers = new HashMap<String, Object>();

    /* For Jackson */
    protected Results() {
    }

    public Results(Query query, Map<String, AggregationResults> aggs, List<T> items, Integer totalItems) {
        this(query, aggs, items, totalItems, null, null);
    }

    public Results(Query query, Map<String, AggregationResults> aggs, List<T> items, Integer totalItems, Envelope bbox, Map<String, Object> headers) {
        this.query = query;
        if (aggs != null) {
            this.aggs.putAll(aggs);
        }
        this.items.addAll(items);<commit_msg>Move headers to top of object<commit_after>package com.scaleset.search;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.vividsolutions.jts.geom.Envelope;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@JsonPropertyOrder({"headers", "query", "totalItems", "aggs", "bbox", "items"})
@JsonInclude(JsonInclude.Include.NON_EMPTY)
public class Results<T> {

    private Map<String, AggregationResults> aggs = new HashMap<>();
    private List<T> items = new ArrayList<>();
    private Query query;
    private Integer totalItems = 0;
    private Envelope bbox;
    private Map<String, Object> headers = new HashMap<String, Object>();

    /* For Jackson */
    protected Results() {
    }

    public Results(Query query, Map<String, AggregationResults> aggs, List<T> items, Integer totalItems) {
        this(query, aggs, items, totalItems, null, null);
    }

    public Results(Query query, Map<String, AggregationResults> aggs, List<T> items, Integer totalItems, Envelope bbox, Map<String, Object> headers) {
        this.query = query;
        if (aggs != null) {
            this.aggs.putAll(aggs);
        }
        this.items.addAll(items);
{'fraction_non_alphanumeric': 0.12355979340484705, 'fraction_numerical': 0.0007945967421533572, 'mean_word_length': 4.00596421471173, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, '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': '4432921', 'n_tokens_mistral': 771, 'n_tokens_neox': 744, 'n_words': 195}