// Path: web/src/main/java/de/fhopf/lucenesolrtalk/web/Facet.java
// public class Facet {
//     
//     private final String term;
//     private final long count;
// 
//     private final String fq;
// 
//     private Facet(String displayTerm, long count, String fq) {
//         this.term = displayTerm;
//         this.count = count;
//         this.fq = fq;
//     }
// 
//     public static Facet termFacet(String term, long count, String fieldname) {
//         return new Facet(term, count, fieldname.concat(":").concat(ClientUtils.escapeQueryChars(term)));
//     }
//     
//     public static Facet withFilterQuery(String term, long count, String fq) {
//         return new Facet(term, count, fq);
//     }
//     
//     public String getTerm() {
//         return term;
//     }
// 
//     public long getCount() {
//         return count;
//     }
// 
//     public String getFq() {
//         return fq;
//     }
// }
// 
// 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.web.Facet;
import de.fhopf.lucenesolrtalk.web.Faceting;
import de.fhopf.lucenesolrtalk.web.SearchResultView;
import java.util.ArrayList;
import java.util.List;
import org.apache.solr.client.solrj.SolrServerException;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import java.util.Set;
import org.apache.solr.client.solrj.response.FacetField;
import org.apache.solr.client.solrj.response.FacetField.Count;
package de.fhopf.lucenesolrtalk.web.solr;



@Path("/solr")
@Produces("text/html; charset=utf-8")
public class SolrSearchResource {

    private final SolrSearcher searcher;

    public SolrSearchResource(SolrSearcher searcher) {
        this.searcher = searcher;
    }

    @GET
    @Timed
// Path: web/src/main/java/de/fhopf/lucenesolrtalk/web/Facet.java
// public class Facet {
//     
//     private final String term;
//     private final long count;
// 
//     private final String fq;
// 
//     private Facet(String displayTerm, long count, String fq) {
//         this.term = displayTerm;
//         this.count = count;
//         this.fq = fq;
//     }
// 
//     public static Facet termFacet(String term, long count, String fieldname) {
//         return new Facet(term, count, fieldname.concat(":").concat(ClientUtils.escapeQueryChars(term)));
//     }
//     
//     public static Facet withFilterQuery(String term, long count, String fq) {
//         return new Facet(term, count, fq);
//     }
//     
//     public String getTerm() {
//         return term;
//     }
// 
//     public long getCount() {
//         return count;
//     }
// 
//     public String getFq() {
//         return fq;
//     }
// }
// 
// 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/solr/SolrSearchResource.java
import com.google.common.base.Optional;
import com.yammer.metrics.annotation.Timed;
import de.fhopf.lucenesolrtalk.web.Facet;
import de.fhopf.lucenesolrtalk.web.Faceting;
import de.fhopf.lucenesolrtalk.web.SearchResultView;
import java.util.ArrayList;
import java.util.List;
import org.apache.solr.client.solrj.SolrServerException;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import java.util.Set;
import org.apache.solr.client.solrj.response.FacetField;
import org.apache.solr.client.solrj.response.FacetField.Count;

package de.fhopf.lucenesolrtalk.web.solr;



@Path("/solr")
@Produces("text/html; charset=utf-8")
public class SolrSearchResource {

    private final SolrSearcher searcher;

    public SolrSearchResource(SolrSearcher searcher) {
        this.searcher = searcher;
    }

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