
org.apache.solr.analytics.request.AnalyticsRequest Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of solr-analytics Show documentation
Show all versions of solr-analytics Show documentation
Apache Solr Content Analytics Package
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.solr.analytics.request;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
/**
* Contains the specifications of an Analytics Request, specifically a name,
* a list of Expressions, a list of field facets, a list of range facets, a list of query facets
* and the list of expressions and their results calculated in previous AnalyticsRequests.
*/
public class AnalyticsRequest {
private String name;
private List expressions;
private Set hiddenExpressions;
private List fieldFacets;
private List rangeFacets;
private List queryFacets;
public AnalyticsRequest(String name) {
this.name = name;
expressions = new ArrayList<>();
hiddenExpressions = new HashSet<>();
fieldFacets = new ArrayList<>();
rangeFacets = new ArrayList<>();
queryFacets = new ArrayList<>();
}
public String getName() {
return name;
}
public void setExpressions(List expressions) {
this.expressions = expressions;
}
public void addExpression(ExpressionRequest expressionRequest) {
expressions.add(expressionRequest);
}
public List getExpressions() {
return expressions;
}
public void addHiddenExpression(ExpressionRequest expressionRequest) {
expressions.add(expressionRequest);
hiddenExpressions.add(expressionRequest.getName());
}
public Set getHiddenExpressions() {
return hiddenExpressions;
}
public void setFieldFacets(List fieldFacets) {
this.fieldFacets = fieldFacets;
}
public List getFieldFacets() {
return fieldFacets;
}
public void setRangeFacets(List rangeFacets) {
this.rangeFacets = rangeFacets;
}
public List getRangeFacets() {
return rangeFacets;
}
public void setQueryFacets(List queryFacets) {
this.queryFacets = queryFacets;
}
public List getQueryFacets() {
return queryFacets;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder("");
for (ExpressionRequest exp : expressions) {
builder.append(exp.toString());
}
for (FieldFacetRequest facet : fieldFacets) {
builder.append(facet.toString());
}
for (RangeFacetRequest facet : rangeFacets) {
builder.append(facet.toString());
}
for (QueryFacetRequest facet : queryFacets) {
builder.append(facet.toString());
}
builder.append(" ");
return builder.toString();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy