// utility variable used for automatic binding -- it should not be serialized
private transient final SolrServer solrServer;
//.....
//.....
private void extractFacetInfo( NamedList info )
{
// Parse the queries
_facetQuery = new HashMap();
NamedList fq = (NamedList) info.get( "facet_queries" );
for( Map.Entry entry : fq ) {
_facetQuery.put( entry.getKey(), entry.getValue() );
}
// Parse the facet info into fields
// TODO?? The list could be or ? If always then we can switch to
NamedList ff = (NamedList) info.get( "facet_fields" );
if( ff != null ) {
_facetFields = new ArrayList( ff.size() );
_limitingFacets = new ArrayList( ff.size() );
long minsize = _results.getNumFound();
for( Map.Entry facet : ff ) {
FacetField f = new FacetField( facet.getKey() );
for( Map.Entry entry : facet.getValue() ) {
f.add( entry.getKey(), entry.getValue().longValue() );
}
// Debug Info
private Map _debugMap = null;
private Map _explainMap = null;
// utility variable used for automatic binding -- it should not be serialized
private transient final SolrServer solrServer;
//.....
//.....
private void extractFacetInfo( NamedList info )
{
// Parse the queries
_facetQuery = new HashMap();
NamedList fq = (NamedList) info.get( "facet_queries" );
for( Map.Entry entry : fq ) {
_facetQuery.put( entry.getKey(), entry.getValue() );
}
// Parse the facet info into fields
// TODO?? The list could be or ? If always then we can switch to
NamedList ff = (NamedList) info.get( "facet_fields" );
if( ff != null ) {
_facetFields = new ArrayList( ff.size() );
_limitingFacets = new ArrayList( ff.size() );
long minsize = _results.getNumFound();
for( Map.Entry facet : ff ) {
FacetField f = new FacetField( facet.getKey() );
for( Map.Entry entry : facet.getValue() ) {
f.add( entry.getKey(), entry.getValue().longValue() );
}
/**
* A utility class to hold the facet response. It could use the NamedList container,
* but for JSTL, it is nice to have something that implements List so it can be iterated
*
* @version $Id: FacetField.java 638357 2008-03-18 13:12:27Z gsingers $
* @since solr 1.3
*/
public class FacetField implements Serializable
{
public static class Count implements Serializable
{
private String _name = null;
private long _count = 0;
// hang onto the FacetField for breadcrumb creation convenience
private FacetField _ff = null;
public Count( FacetField ff, String n, long c )
{
_name = n;
_count = c;
_ff = ff;
}
public String getName() {
return _name;
}
public void setName( String n )
{
_name = n;
}
public long getCount() {
return _count;
}
public void setCount( long c )
{
_count = c;
}
public FacetField getFacetField() {
return _ff;
}
@Override
public String toString()
{
return _name+" ("+_count+")";
}
/**
* A utility class to hold the facet response. It could use the NamedList container,
* but for JSTL, it is nice to have something that implements List so it can be iterated
*
* @version $Id: FacetField.java 638357 2008-03-18 13:12:27Z gsingers $
* @since solr 1.3
*/
public class FacetField implements Serializable
{
public static class Count implements Serializable
{
private String _name = null;
private long _count = 0;
// hang onto the FacetField for breadcrumb creation convenience
private FacetField _ff = null;
public Count( FacetField ff, String n, long c )
{
_name = n;
_count = c;
_ff = ff;
}
public String getName() {
return _name;
}
public void setName( String n )
{
_name = n;
}
public long getCount() {
return _count;
}
public void setCount( long c )
{
_count = c;
}
public FacetField getFacetField() {
return _ff;
}
@Override
public String toString()
{
return _name+" ("+_count+")";
}