3 * Copyright (C) 2012 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
7 * The contents of this file are subject to the Mozilla Public License Version 1.1
8 * See LICENSE.TXT at the top of this package for the full license terms.
10 package eu
.etaxonomy
.cdm
.api
.service
.search
;
12 import java
.util
.Collection
;
13 import java
.util
.HashMap
;
16 import org
.apache
.lucene
.document
.Document
;
17 import org
.hibernate
.search
.ProjectionConstants
;
19 import eu
.etaxonomy
.cdm
.model
.common
.CdmBase
;
22 * TODO class description
24 * @author Andreas Kohlbecker
28 public class DocumentSearchResult
{
30 private float score
= 0;
32 private float maxScore
= 0;
35 public DocumentSearchResult() {
39 * key will be a combination of DocumentBuilder.CLASS_FIELDNAME and id field: ID_FIELD
41 private Map
<String
, Document
> docs
= new HashMap
<String
, Document
>();
42 private Map
<String
,String
[]> fieldHighlightMap
;
45 public double getScore() {
50 public void setScore(float score
) {
55 public Map
<String
,String
[]> getFieldHighlightMap() {
56 return fieldHighlightMap
;
59 public void setFieldHighlightMap(Map
<String
,String
[]> fieldHighlightMap
) {
60 this.fieldHighlightMap
= fieldHighlightMap
;
65 public float getMaxScore() {
70 public void setMaxScore(float maxScore
) {
71 this.maxScore
= maxScore
;
75 public Collection
<Document
> getDocs() {
80 public void addDoc(Document doc
) {
81 String key
= doc
.getValues(ProjectionConstants
.OBJECT_CLASS
)[0] + "." + doc
.getValues(LuceneSearch
.ID_FIELD
)[0];
82 this.docs
.put(key
, doc
);