// Add a filter to ensure that Solr never returns partial documents
private SolrQuery createQuery(String queryString, int startPage, int pageSize, boolean useDismax) {
    SolrQuery query = new SolrQuery(queryString);
    query.setTimeAllowed(queryTimeout);
    query.setIncludeScore(true); // The relevance (of each results element) to the search terms.
    query.setHighlight(false);
    if (useDismax) {
      query.set("defType", "dismax");
    }
    //TODO: Put The "options" from the "queryField" picklist into a config file.
    //This list matches the "options" from the "queryField" picklist on unformattedSearch.ftl,
    //without the "date" fields.
    query.setStart(startPage * pageSize); // Which results element to return first in this batch.
    query.setRows(pageSize); // The number of results elements to return.
    // request only fields that we need to display
    query.setFields("id", "score", "title_display", "publication_date", "eissn", "journal", "article_type",
        "author_display", "abstract", "abstract_primary_display", "striking_image", "figure_table_caption",
        "subject", "expression_of_concern", "retraction");
    query.addFacetField("subject_facet");
    query.addFacetField("author_facet");
    query.addFacetField("editor_facet");
    query.addFacetField("article_type_facet");
    query.addFacetField("affiliate_facet");
    query.set("facet.method", "fc");
    query.setFacetLimit(MAX_FACET_SIZE);
    query.setFacetMinCount(MIN_FACET_COUNT);
    // Add a filter to ensure that Solr never returns partial documents
    query.addFilterQuery(createFilterFullDocuments());
    return query;
  }
query.setFacetLimit(MAX_FACET_SIZE);
query.setFacetMinCount(MIN_FACET_COUNT);
// Add a filter to ensure that Solr never returns partial documents
query.addFilterQuery(createFilterFullDocuments());
return query;
"author_display", "abstract", "abstract_primary_display", "striking_image", "figure_table_caption",
"subject", "expression_of_concern", "retraction");
query.addFacetField("subject_facet");
query.addFacetField("author_facet");
query.addFacetField("editor_facet");
query.addFacetField("article_type_facet");
query.addFacetField("affiliate_facet");
query.set("facet.method", "fc");
query.setFacetLimit(MAX_FACET_SIZE);
query.setFacetMinCount(MIN_FACET_COUNT);
// Add a filter to ensure that Solr never returns partial documents
query.addFilterQuery(createFilterFullDocuments());
return query;
}
if (useDismax) {
query.set("defType", "dismax");
}
//TODO: Put The "options" from the "queryField" picklist into a config file.
//This list matches the "options" from the "queryField" picklist on unformattedSearch.ftl,
//without the "date" fields.
query.setStart(startPage * pageSize); // Which results element to return first in this batch.
query.setRows(pageSize); // The number of results elements to return.
// request only fields that we need to display
query.setFields("id", "score", "title_display", "publication_date", "eissn", "journal", "article_type",
"author_display", "abstract", "abstract_primary_display", "striking_image", "figure_table_caption",
"subject", "expression_of_concern", "retraction");
query.addFacetField("subject_facet");
query.addFacetField("author_facet");
query.addFacetField("editor_facet");
query.addFacetField("article_type_facet");
query.addFacetField("affiliate_facet");
query.set("facet.method", "fc");
query.setFacetLimit(MAX_FACET_SIZE);
query.setFacetMinCount(MIN_FACET_COUNT);
// Add a filter to ensure that Solr never returns partial documents
query.addFilterQuery(createFilterFullDocuments());
return query;
}