![JAR search and dependency download from the Maven repository](/logo.png)
src.it.unimi.dsi.big.mg4j.query.ResultItem Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of mg4j-big Show documentation
Show all versions of mg4j-big Show documentation
MG4J (Managing Gigabytes for Java) is a free full-text search engine for large document collections written in Java. The big version is a fork of the original MG4J that can handle more than 2^31 terms and documents.
The newest version!
package it.unimi.dsi.big.mg4j.query;
import java.util.Formatter;
/*
* MG4J: Managing Gigabytes for Java (big)
*
* Copyright (C) 2005-2011 Sebastiano Vigna
*
* This library is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 3 of the License, or (at your option)
* any later version.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITfNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, see .
*
*/
/** An instance of this class is used to pack the results gathered by {@link it.unimi.dsi.big.mg4j.query.QueryServlet}
* in such a way that they are easily accessible from the Velocity Template Language.
*
* @author Sebastiano Vigna
* @since 0.9.2
*/
public class ResultItem extends BrowseItem {
/** The document index of this result. */
public final long doc;
/** The score of this result. */
public final double score;
public ResultItem( final long doc, final double score ) {
this.doc = doc;
this.score = score;
}
public long doc() {
return doc;
}
public final double score() {
return score;
}
public final String score( int digits ) {
return new Formatter( new StringBuilder() ).format( "%." + digits + "f", Double.valueOf( score ) ).out().toString();
}
public String toString() {
return "[doc: " + doc + " title: " + title + " score: " + score + "]";
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy