001: /**
002: * LibreSource
003: * Copyright (C) 2004-2008 Artenum SARL / INRIA
004: * http://www.libresource.org - contact@artenum.com
005: *
006: * This file is part of the LibreSource software,
007: * which can be used and distributed under license conditions.
008: * The license conditions are provided in the LICENSE.TXT file
009: * at the root path of the packaging that enclose this file.
010: * More information can be found at
011: * - http://dev.libresource.org/home/license
012: *
013: * Initial authors :
014: *
015: * Guillaume Bort / INRIA
016: * Francois Charoy / Universite Nancy 2
017: * Julien Forest / Artenum
018: * Claude Godart / Universite Henry Poincare
019: * Florent Jouille / INRIA
020: * Sebastien Jourdain / INRIA / Artenum
021: * Yves Lerumeur / Artenum
022: * Pascal Molli / Universite Henry Poincare
023: * Gerald Oster / INRIA
024: * Mariarosa Penzi / Artenum
025: * Gerard Sookahet / Artenum
026: * Raphael Tani / INRIA
027: *
028: * Contributors :
029: *
030: * Stephane Bagnier / Artenum
031: * Amadou Dia / Artenum-IUP Blois
032: * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
033: */package org.libresource.search;
034:
035: import org.libresource.LibresourceResourceIdentifier;
036:
037: import java.io.Serializable;
038:
039: import java.net.URI;
040:
041: /**
042: * LibreSource
043: *
044: * @author <a href="mailto:bort@loria.fr">Guillaume Bort</a> - <a
045: * href="http://www.inria.fr">INRIA Lorraine</a>
046: */
047: public class LibresourceSearchResult implements Serializable {
048: private URI uri;
049: private float score;
050: private String explain;
051: private String name;
052: private String type;
053: private LibresourceResourceIdentifier resourceIdentifier;
054:
055: public LibresourceSearchResult(URI uri, float score, String name,
056: String explain, String type) {
057: this .uri = uri;
058: this .score = score;
059: this .explain = explain;
060: this .name = name;
061: this .type = type;
062: }
063:
064: public String getHighlightedFragment(String prefix, String suffix) {
065: return explain.replaceAll("<highlighted>", prefix).replaceAll(
066: "</highlighted>", suffix);
067: }
068:
069: public float getScore() {
070: return score;
071: }
072:
073: public String getName() {
074: return name;
075: }
076:
077: public String getType() {
078: return type;
079: }
080:
081: public URI getUri() {
082: return uri;
083: }
084:
085: public LibresourceResourceIdentifier getLibresourceResourceIdentifier() {
086: return resourceIdentifier;
087: }
088:
089: public void setResourceIdentifier(
090: LibresourceResourceIdentifier identifier) {
091: resourceIdentifier = identifier;
092: }
093:
094: public void setScore(float f) {
095: score = f;
096: }
097:
098: public void setUri(URI uri) {
099: this.uri = uri;
100: }
101: }
|