package io.github.vcuswimlab.stackintheflow.controller;

import io.github.vcuswimlab.stackintheflow.model.JerseyGet;
import io.github.vcuswimlab.stackintheflow.model.JerseyResponse;
import io.github.vcuswimlab.stackintheflow.model.Query;

/**
 * Created by Chase on 1/5/2017.
 */
public class QueryExecutor {

    private final static String filter = "!-MOiNm40F1U019gR)UUjNV-IQScciBJZ0";

    public static JerseyResponse executeQuery(String q) {
        return executeQuery(new Query("stackoverflow")
                .set(Query.Component.Q, q)
                .set(Query.Component.FILTER, filter)
                .set(Query.Component.SORT, JerseyGet.SortType.RELEVANCE.toString()));
    }

    public static JerseyResponse executeQuery(String q, JerseyGet.SortType sortType) {
        return executeQuery(new Query("stackoverflow")
                .set(Query.Component.Q, q)
                .set(Query.Component.FILTER, filter)
                .set(Query.Component.SORT, sortType.toString()));
    }

    public static JerseyResponse executeQuery(Query q) {
        return executeQuery(q, JerseyGet.SearchType.ADVANCED);
    }

    public static JerseyResponse executeQuery(Query q, JerseyGet.SearchType searchType) {
        return JerseyGet.getInstance().executeQuery(q, searchType);
    }
}

@@ -473,172 +473,9 @@
 ery(
-new Query(%22stackoverflow%22)%0A                .set(Query.Component.Q, q)%0A                .set(Query.Component.FILTER, filter)%0A                .set(Query.Component.SORT
+q
 , Je
@@ -500,28 +500,16 @@
 ELEVANCE
-.toString())
 );%0A    %7D

Clean up execute query methods.