Index: src/main/java/sgf/gateway/search/provider/solr/query/PassFreeTextQueryStrategy.java
===================================================================
--- src/main/java/sgf/gateway/search/provider/solr/query/PassFreeTextQueryStrategy.java (revision 0)
+++ src/main/java/sgf/gateway/search/provider/solr/query/PassFreeTextQueryStrategy.java (working copy)
@@ -0,0 +1,11 @@
+package sgf.gateway.search.provider.solr.query;
+
+/**
+ * Created by jcunning on 5/1/14.
+ */
+public class PassFreeTextQueryStrategy implements FreeTextQueryStrategy {
+ @Override
+ public String getFreeTextQuery(String string) {
+ return string;
+ }
+}
Index: src/main/java/sgf/gateway/web/controllers/metrics/LinkMetricsController.java
===================================================================
--- src/main/java/sgf/gateway/web/controllers/metrics/LinkMetricsController.java (revision 0)
+++ src/main/java/sgf/gateway/web/controllers/metrics/LinkMetricsController.java (working copy)
@@ -0,0 +1,27 @@
+package sgf.gateway.web.controllers.metrics;
+
+
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.servlet.ModelAndView;
+import org.springframework.web.servlet.view.RedirectView;
+
+
+@Controller
+public class LinkMetricsController {
+
+ // Redirect so request goes thru Clickstream to collect metrics
+ @RequestMapping(value = "/redirect.html", method=RequestMethod.GET)
+ public ModelAndView redirect (@RequestParam(value="link", required=true) String link) {
+
+ ModelAndView result = null;
+
+ RedirectView redirectView = new RedirectView(link);
+ result = new ModelAndView(redirectView);
+
+ return result;
+ }
+
+}
Index: src/main/java/sgf/gateway/web/controllers/metrics/OffsiteLinkMetricsController.java
===================================================================
--- src/main/java/sgf/gateway/web/controllers/metrics/OffsiteLinkMetricsController.java (revision 18675)
+++ src/main/java/sgf/gateway/web/controllers/metrics/OffsiteLinkMetricsController.java (working copy)
@@ -1,27 +0,0 @@
-package sgf.gateway.web.controllers.metrics;
-
-
-import org.springframework.stereotype.Controller;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.servlet.ModelAndView;
-import org.springframework.web.servlet.view.RedirectView;
-
-
-@Controller
-public class OffsiteLinkMetricsController {
-
- // Redirect so request goes thru Clickstream to collect metrics
- @RequestMapping(value = "/redirect.html", method=RequestMethod.GET)
- public ModelAndView redirect (@RequestParam(value="link", required=true) String link) {
-
- ModelAndView result = null;
-
- RedirectView redirectView = new RedirectView(link);
- result = new ModelAndView(redirectView);
-
- return result;
- }
-
-}
Index: src/main/java/sgf/gateway/web/controllers/search/AnalyticalSearchCommand.java
===================================================================
--- src/main/java/sgf/gateway/web/controllers/search/AnalyticalSearchCommand.java (revision 0)
+++ src/main/java/sgf/gateway/web/controllers/search/AnalyticalSearchCommand.java (working copy)
@@ -0,0 +1,23 @@
+package sgf.gateway.web.controllers.search;
+
+import org.hibernate.validator.constraints.NotBlank;
+import org.springframework.util.StringUtils;
+
+public class AnalyticalSearchCommand {
+
+ @NotBlank(message="A query is required.")
+ String queryText;
+
+ public void setQueryText(String queryText) {
+
+ if (StringUtils.hasText(queryText)) {
+ this.queryText = queryText.trim();
+ }
+
+ this.queryText = queryText;
+ }
+
+ public String getQueryText() {
+ return queryText;
+ }
+}
Index: src/main/java/sgf/gateway/web/controllers/search/AnalyticalSearchController.java
===================================================================
--- src/main/java/sgf/gateway/web/controllers/search/AnalyticalSearchController.java (revision 0)
+++ src/main/java/sgf/gateway/web/controllers/search/AnalyticalSearchController.java (working copy)
@@ -0,0 +1,76 @@
+package sgf.gateway.web.controllers.search;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.validation.Valid;
+
+import org.apache.solr.client.solrj.SolrServerException;
+import org.springframework.stereotype.Controller;
+import org.springframework.validation.BindingResult;
+import org.springframework.web.bind.annotation.ModelAttribute;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.servlet.ModelAndView;
+
+import sgf.gateway.search.api.Criteria;
+import sgf.gateway.search.api.SearchQuery;
+import sgf.gateway.search.api.SearchResult;
+import sgf.gateway.search.core.CriteriaImpl;
+import sgf.gateway.search.core.SortTargetsImpl;
+
+@Controller
+public class AnalyticalSearchController {
+
+ private final SearchQuery searchQuery;
+
+ public AnalyticalSearchController(SearchQuery searchQuery) {
+ this.searchQuery = searchQuery;
+ }
+
+ @RequestMapping(value = "/root/search/analytic.html", method = RequestMethod.GET)
+ public ModelAndView search() throws SolrServerException {
+
+ ModelAndView modelAndView = new ModelAndView("/search/search-analytical");
+
+ return modelAndView;
+ }
+
+ @RequestMapping(value = "/root/search/analytic.html", method = RequestMethod.POST)
+ public ModelAndView submit(@ModelAttribute("analyticalSearchForm") @Valid AnalyticalSearchCommand searchCommand, BindingResult result) throws SolrServerException {
+
+ ModelAndView modelAndView = new ModelAndView("/search/search-analytical");
+
+ if (!result.hasErrors()) {
+ SearchResult searchResult = this.executeSearchQuery(searchCommand);
+ modelAndView.addObject("searchResult", searchResult);
+ }
+
+ return modelAndView;
+ }
+
+ @ModelAttribute("analyticalSearchForm")
+ public AnalyticalSearchCommand setupAnalyticalSearchCommand() {
+ return new AnalyticalSearchCommand();
+ }
+
+ private SearchResult executeSearchQuery(AnalyticalSearchCommand searchCommand) {
+
+ Criteria criteria = this.createSearchCriteria(searchCommand);
+ SearchResult searchResult = this.searchQuery.execute(criteria);
+
+ return searchResult;
+ }
+
+ private Criteria createSearchCriteria(AnalyticalSearchCommand searchCommand) {
+
+ CriteriaImpl criteria = new CriteriaImpl();
+
+ criteria.setFreeText(searchCommand.getQueryText());
+
+ Integer bigEnoughToReturnAll = 20000;
+ criteria.setResultSize(bigEnoughToReturnAll);
+
+ return criteria;
+ }
+}
Index: src/main/resources/spring/sgf/gateway/web/controllers/metrics/metrics-controllers.xml
===================================================================
--- src/main/resources/spring/sgf/gateway/web/controllers/metrics/metrics-controllers.xml (revision 18675)
+++ src/main/resources/spring/sgf/gateway/web/controllers/metrics/metrics-controllers.xml (working copy)
@@ -11,6 +11,6 @@
+