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

src.it.unimi.dsi.big.mg4j.tool.VirtualDocumentResolver Maven / Gradle / Ivy

Go to download

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.tool;

/*		 
 * MG4J: Managing Gigabytes for Java (big)
 *
 * Copyright (C) 2006-2011 Paolo Boldi and 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 FITNESS 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 .
 *
 */


import it.unimi.dsi.big.mg4j.document.Document;
import it.unimi.dsi.big.mg4j.tool.Scan.VirtualDocumentFragment;

import java.io.Serializable;


/** A resolver for virtual documents.
 * 
 * 

Fields of {@linkplain it.unimi.dsi.big.mg4j.document.DocumentFactory.FieldType#VIRTUAL virtual type} return * a list of {@linkplain VirtualDocumentFragment virtual document fragments} * containing a document specification (e.g., its URI) and the virtual text associated with the document. Since there are * many ways of defining the virtual document, {@link it.unimi.dsi.big.mg4j.tool.Scan} requires * a virtual-document resolver for each virtual field: the resolver takes in the string defining a document, * and returns a document number. See {@link it.unimi.dsi.big.mg4j.tool.URLMPHVirtualDocumentResolver} for a * natural example. * */ public interface VirtualDocumentResolver extends Serializable { /** Sets the context document. All successive calls to {@link #resolve(CharSequence)} will * assume the virtual-document specification was found in document. * * @param document the context document. */ public void context( Document document ); /** Resolves a virtual document specification. * *

Note that the resolution process is carried out in the context of the last document * passed to {@link #context(Document)} (e.g., for relative URI resolution). If {@link #context(Document)} * was never called, the behaviour is undefined. * * @param virtualDocumentSpec the virtual document specification. * @return the document virtualDocumentSpec refers to, or -1 if the specification could not be resolved. */ public long resolve( CharSequence virtualDocumentSpec ); /** Returns the number of documents handled by this resolver, if it is known. A call * to {@link #resolve(CharSequence)} will always return a number * smaller than the one returned by this method. * * @return the number of documents handled by this resolver. */ public long numberOfDocuments(); }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy