1
22
23 package com.liferay.portal.kernel.search;
24
25 import java.util.ArrayList;
26 import java.util.List;
27
28
34 public class HitsImpl implements Hits {
35
36 public HitsImpl() {
37 }
38
39 public long getStart() {
40 return _start;
41 }
42
43 public void setStart(long start) {
44 _start = start;
45 }
46
47 public float getSearchTime() {
48 return _searchTime;
49 }
50
51 public void setSearchTime(float time) {
52 _searchTime = time;
53 }
54
55 public String[] getQueryTerms() {
56 return _queryTerms;
57 }
58
59 public void setQueryTerms(String[] queryTerms) {
60 _queryTerms = queryTerms;
61 }
62
63 public Document[] getDocs() {
64 return _docs;
65 }
66
67 public void setDocs(Document[] docs) {
68 _docs = docs;
69 }
70
71 public int getLength() {
72 return _length;
73 }
74
75 public void setLength(int length) {
76 _length = length;
77 }
78
79 public String[] getSnippets() {
80 return _snippets;
81 }
82
83 public void setSnippets(String[] snippets) {
84 _snippets = snippets;
85 }
86
87 public float[] getScores() {
88 return _scores;
89 }
90
91 public void setScores(float[] scores) {
92 _scores = scores;
93 }
94
95 public void setScores(Float[] scores) {
96 float[] primScores = new float[scores.length];
97
98 for (int i = 0; i < scores.length; i++) {
99 primScores[i] = scores[i].floatValue();
100 }
101
102 setScores(primScores);
103 }
104
105 public Document doc(int n) {
106 return _docs[n];
107 }
108
109 public String snippet(int n) {
110 return _snippets[n];
111 }
112
113 public float score(int n) {
114 return _scores[n];
115 }
116
117 public List<Document> toList() {
118 List<Document> subset = new ArrayList<Document>(_docs.length);
119
120 for (int i = 0; i < _docs.length; i++) {
121 subset.add(_docs[i]);
122 }
123
124 return subset;
125 }
126
127 private long _start;
128 private float _searchTime;
129 private String[] _queryTerms;
130 private Document[] _docs;
131 private int _length;
132 private String[] _snippets;
133 private float[] _scores = new float[0];
134
135 }