blob: aa3a04d670f9fa93d3e9a027e69f8da6d612c7b6 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.prelude.query;
import java.nio.ByteBuffer;
/**
* A place holder for null queries to make searchers easier to write.
*
* @author <a href="mailto:steinar@yahoo-inc.com">Steinar Knutsen</a>
*/
public class NullItem extends Item {
public NullItem() {}
/** Does nothing */
public void setIndexName(String index) {}
public int encode(ByteBuffer buffer) {
throw new RuntimeException(
"A NullItem was attempted encoded. "
+ "This is probably a misbehaving " + "searcher.");
}
public ItemType getItemType() {
throw new RuntimeException(
"Packet code access attempted. "
+ "A NullItem has no packet code. "
+ "This is probably a misbehaving " + "searcher.");
}
public void appendBodyString(StringBuilder buffer) {
// No body for this Item
return;
}
public void appendHeadingString(StringBuilder buffer) {
buffer.append(getName());
}
public String getName() {
return "NULL";
}
@Override
public int getTermCount() { return 0; }
}
|