// Path: lucene/src/main/java/de/fhopf/lucenesolrtalk/Result.java
// public class Result {
// 
//     private final String title;
//     private final String excerpt;
//     private final List<String> categories;
//     private final List<String> speakers;
//     private final Date date;
// 
//     public Result(String title, String excerpt, List<String> categories, List<String> speakers, Date date) {
//         this.title = title;
//         this.excerpt = excerpt;
//         this.categories = categories;
//         this.speakers = speakers;
//         this.date = date;
//     }
// 
//     public String getTitle() {
//         return title;
//     }
// 
//     public String getExcerpt() {
//         return excerpt;
//     }
// 
//     public List<String> getCategories() {
//         return categories;
//     }
// 
//     public List<String> getSpeakers() {
//         return speakers;
//     }
// 
//     public Date getDate() {
//         return date;
//     }
// }
// 
// Path: web/src/main/java/de/fhopf/lucenesolrtalk/web/Faceting.java
// public class Faceting {
// 
//     private final List<Facet> categoryFacet;
//     private final List<Facet> speakerFacet;
//     private final List<Facet> dateFacet;
//     private final List<Facet> organizerFacet;
// 
//     public Faceting(List<Facet> categoryFacet, List<Facet> speakerFacet, List<Facet> dateFacet, List<Facet> organizerFacet) {
//         this.categoryFacet = categoryFacet;
//         this.speakerFacet = speakerFacet;
//         this.dateFacet = dateFacet;
//         this.organizerFacet = organizerFacet;
//     }
// 
//     public List<Facet> getCategoryFacet() {
//         return categoryFacet;
//     }
// 
//     public List<Facet> getSpeakerFacet() {
//         return speakerFacet;
//     }
//     
//     public List<Facet> getDateFacet() {
//         return dateFacet;
//     }
// 
//     public List<Facet> getOrganizerFacet() {
//         return organizerFacet;
//     }
// }
// 
// Path: web/src/main/java/de/fhopf/lucenesolrtalk/web/SearchResultView.java
// public class SearchResultView extends View {
// 
//     private final Categories categories;
//     private final String query;
//     private final List<Result> results;
//     private final Faceting faceting;
//     private final String path;
//     private String currentQuery;
// 
//     public SearchResultView(String path, String query, List<Result> results, Categories categories) {
//         this(path, query, results, categories, null, null);
//     }
// 
//     public SearchResultView(String path, String query, List<Result> results, Categories categories, Faceting faceting, String currentQuery) {
//         super("result.fmt");
//         this.query = query;
//         this.results = results;
//         this.categories = categories;
//         this.faceting = faceting;
//         this.currentQuery = currentQuery;
//         this.path = path;
//     }
// 
//     public Categories getCategories() {
//         return categories;
//     }
// 
//     public String getQuery() {
//         return query;
//     }
// 
//     public List<Result> getResults() {
//         return results;
//     }
// 
//     public Faceting getFaceting() {
//         return faceting;
//     }
// 
//     public String getPath() {
//         return path;
//     }
// 
//     public String getCurrentQuery() {
//         return currentQuery;
//     }
// }


import com.google.common.base.Optional;
import com.yammer.metrics.annotation.Timed;
import de.fhopf.lucenesolrtalk.Result;
import de.fhopf.lucenesolrtalk.web.Faceting;
import de.fhopf.lucenesolrtalk.web.SearchResultView;
import java.util.List;
import java.util.Set;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import org.apache.solr.client.solrj.SolrServerException;
import org.elasticsearch.action.search.SearchResponse;
package de.fhopf.lucenesolrtalk.web.elasticsearch;


/**
 *
 */
@Path("/elasticsearch")
@Produces("text/html; charset=utf-8")
public class ElasticsearchResource {

    private final ElasticsearchSearcher searcher;

    public ElasticsearchResource(ElasticsearchSearcher searcher) {
        this.searcher = searcher;
    }

    @GET
    @Timed
// Path: lucene/src/main/java/de/fhopf/lucenesolrtalk/Result.java
// public class Result {
// 
//     private final String title;
//     private final String excerpt;
//     private final List<String> categories;
//     private final List<String> speakers;
//     private final Date date;
// 
//     public Result(String title, String excerpt, List<String> categories, List<String> speakers, Date date) {
//         this.title = title;
//         this.excerpt = excerpt;
//         this.categories = categories;
//         this.speakers = speakers;
//         this.date = date;
//     }
// 
//     public String getTitle() {
//         return title;
//     }
// 
//     public String getExcerpt() {
//         return excerpt;
//     }
// 
//     public List<String> getCategories() {
//         return categories;
//     }
// 
//     public List<String> getSpeakers() {
//         return speakers;
//     }
// 
//     public Date getDate() {
//         return date;
//     }
// }
// 
// Path: web/src/main/java/de/fhopf/lucenesolrtalk/web/Faceting.java
// public class Faceting {
// 
//     private final List<Facet> categoryFacet;
//     private final List<Facet> speakerFacet;
//     private final List<Facet> dateFacet;
//     private final List<Facet> organizerFacet;
// 
//     public Faceting(List<Facet> categoryFacet, List<Facet> speakerFacet, List<Facet> dateFacet, List<Facet> organizerFacet) {
//         this.categoryFacet = categoryFacet;
//         this.speakerFacet = speakerFacet;
//         this.dateFacet = dateFacet;
//         this.organizerFacet = organizerFacet;
//     }
// 
//     public List<Facet> getCategoryFacet() {
//         return categoryFacet;
//     }
// 
//     public List<Facet> getSpeakerFacet() {
//         return speakerFacet;
//     }
//     
//     public List<Facet> getDateFacet() {
//         return dateFacet;
//     }
// 
//     public List<Facet> getOrganizerFacet() {
//         return organizerFacet;
//     }
// }
// 
// Path: web/src/main/java/de/fhopf/lucenesolrtalk/web/SearchResultView.java
// public class SearchResultView extends View {
// 
//     private final Categories categories;
//     private final String query;
//     private final List<Result> results;
//     private final Faceting faceting;
//     private final String path;
//     private String currentQuery;
// 
//     public SearchResultView(String path, String query, List<Result> results, Categories categories) {
//         this(path, query, results, categories, null, null);
//     }
// 
//     public SearchResultView(String path, String query, List<Result> results, Categories categories, Faceting faceting, String currentQuery) {
//         super("result.fmt");
//         this.query = query;
//         this.results = results;
//         this.categories = categories;
//         this.faceting = faceting;
//         this.currentQuery = currentQuery;
//         this.path = path;
//     }
// 
//     public Categories getCategories() {
//         return categories;
//     }
// 
//     public String getQuery() {
//         return query;
//     }
// 
//     public List<Result> getResults() {
//         return results;
//     }
// 
//     public Faceting getFaceting() {
//         return faceting;
//     }
// 
//     public String getPath() {
//         return path;
//     }
// 
//     public String getCurrentQuery() {
//         return currentQuery;
//     }
// }


// Path: web/src/main/java/de/fhopf/lucenesolrtalk/web/elasticsearch/ElasticsearchResource.java
import com.google.common.base.Optional;
import com.yammer.metrics.annotation.Timed;
import de.fhopf.lucenesolrtalk.Result;
import de.fhopf.lucenesolrtalk.web.Faceting;
import de.fhopf.lucenesolrtalk.web.SearchResultView;
import java.util.List;
import java.util.Set;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import org.apache.solr.client.solrj.SolrServerException;
import org.elasticsearch.action.search.SearchResponse;

package de.fhopf.lucenesolrtalk.web.elasticsearch;


/**
 *
 */
@Path("/elasticsearch")
@Produces("text/html; charset=utf-8")
public class ElasticsearchResource {

    private final ElasticsearchSearcher searcher;

    public ElasticsearchResource(ElasticsearchSearcher searcher) {
        this.searcher = searcher;
    }

    @GET
    @Timed
    public SearchResultView search(@QueryParam("query") Optional<String> query, @QueryParam("sort") Optional<String> sort,