org.carrot2.source.SearchEngineResponse Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of carrot2-core Show documentation
Show all versions of carrot2-core Show documentation
Carrot2 Text Clustering Library
/*
* Carrot2 project.
*
* Copyright (C) 2002-2014, Dawid Weiss, Stanisław Osiński.
* All rights reserved.
*
* Refer to the full license file "carrot2.LICENSE"
* in the root folder of the repository checkout or at:
* http://www.carrot2.org/carrot2.LICENSE
*/
package org.carrot2.source;
import java.util.ArrayList;
import java.util.HashMap;
import org.carrot2.core.Document;
/**
* A single search engine response. This includes typical information returned by a search
* engine: documents, total number of results, time of processing the query, etc.
*/
public final class SearchEngineResponse
{
/**
* Total number of results available in the source (possibly an approximation).
*/
public static final String RESULTS_TOTAL_KEY = "resultsTotal";
/**
* Metadata key for the compression algorithm used to decompress the returned stream.
*/
public static final String COMPRESSION_KEY = "compression";
/**
* All meta data returned in the response.
*/
public final HashMap metadata = new HashMap(10);
/**
* All documents returned in the response.
*/
public final ArrayList results = new ArrayList(100);
/**
* @return Returns an estimate of the total number of results or -1 if not
* available.
*/
public long getResultsTotal()
{
if (metadata.containsKey(RESULTS_TOTAL_KEY))
{
return ((Number) metadata.get(RESULTS_TOTAL_KEY)).longValue();
}
else
{
return -1;
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy