All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.dspace.search.QueryResults Maven / Gradle / Ivy

/**
 * The contents of this file are subject to the license and copyright
 * detailed in the LICENSE and NOTICE files at the root of the source
 * tree and available online at
 *
 * http://www.dspace.org/license/
 */
package org.dspace.search;

import java.util.ArrayList;
import java.util.List;

import org.dspace.core.ConfigurationManager;

/**
 * Contains the results of a query. Use access methods to examine and retrieve
 * the results.
 */
public class QueryResults
{
    private int hitCount; // total hits returned by search engine

    private int start; // offset of query 'page'

    private int pageSize; // max number of hits returned

    private List hitHandles = new ArrayList(); // handles of content (items, collections, communities)

    private List hitTypes = new ArrayList(); // Resource type - from Constants
    private List hitIds   = new ArrayList(); // Resource ids

    private String errorMsg; //error string, if there is one

    /** number of metadata elements to display before truncating using "et al" */
    private int etAl = ConfigurationManager.getIntProperty("webui.itemlist.author-limit");

    /**
     * @return  the number of metadata fields at which to truncate with "et al"
     */
    public int getEtAl()
    {
        return etAl;
    }

    /**
     * set the number of metadata fields at which to truncate with "et al"
     *
     * @param etAl
     */
    public void setEtAl(int etAl)
    {
        this.etAl = etAl;
    }

    /** set total number of hits found by search engine, not number in hitHandles */
    public void setHitCount(int newCount)
    {
        hitCount = newCount;
    }

    /**
     * get total number of hits found by search engine, not just number of
     * returned results
     */
    public int getHitCount()
    {
        return hitCount;
    }

    /** set start of 'page' of results */
    public void setStart(int newStart)
    {
        start = newStart;
    }

    /** get start of 'page' of results */
    public int getStart()
    {
        return start;
    }

    /** set length of 'page' of results */
    public void setPageSize(int newSize)
    {
        pageSize = newSize;
    }

    /** get length of 'page' of results */
    public int getPageSize()
    {
        return pageSize;
    }

    /** set the List of handles corresponding to hits */
    public void setHitHandles(List myHits)
    {
        hitHandles = myHits != null ? myHits : new ArrayList();
    }

    /** get the List of handles corresponding to hits */
    public List getHitHandles()
    {
        return hitHandles;
    }

    /** set the List of ids corresponding to hits */
    public void setHitIds(List myHits)
    {
        hitIds = myHits != null ? myHits : new ArrayList();
    }

    /** get the List of handles corresponding to hits */
    public List getHitIds()
    {
        return hitIds;
    }

    /** set the List of types corresponding to handles */
    public void setHitTypes(List newTypes)
    {
        hitTypes = newTypes != null ? newTypes : new ArrayList();
    }

    /** get the List of types corresponding to handles */
    public List getHitTypes()
    {
        return hitTypes;
    }

    /** set error message */
    public void setErrorMsg(String msg)
    {
        errorMsg = msg;
    }

    /** get error message */
    public String getErrorMsg()
    {
        return errorMsg;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy