01: /*
02: * Copyright 2004-2006 the original author or authors.
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */
16:
17: package org.compass.core.lucene.engine;
18:
19: import org.compass.core.Resource;
20: import org.compass.core.engine.SearchEngineException;
21: import org.compass.core.engine.SearchEngineHighlighter;
22: import org.apache.lucene.search.Hits;
23: import org.apache.lucene.search.Explanation;
24:
25: /**
26: * @author kimchy
27: */
28: public class EmptyLuceneSearchEngineHits implements
29: LuceneSearchEngineHits {
30:
31: public Resource getResource(int n) throws SearchEngineException {
32: throw new IndexOutOfBoundsException("No resource for hit [" + n
33: + "], length is [0]");
34: }
35:
36: public int getLength() {
37: return 0;
38: }
39:
40: public SearchEngineHighlighter getHighlighter()
41: throws SearchEngineException {
42: throw new IndexOutOfBoundsException(
43: "No highlighter for empty hits");
44: }
45:
46: public void close() throws SearchEngineException {
47: // do nothing
48: }
49:
50: public float score(int i) throws SearchEngineException {
51: throw new IndexOutOfBoundsException("No score for hit [" + i
52: + "], length is [0]");
53: }
54:
55: public Hits getHits() {
56: throw new IndexOutOfBoundsException(
57: "No Lucenen hits for empty hits");
58: }
59:
60: public Explanation explain(int i) throws SearchEngineException {
61: throw new IndexOutOfBoundsException("No explanation for hit ["
62: + i + "], length is [0]");
63: }
64: }
|