|
1 |
| |
|
2 |
| |
|
3 |
| |
|
4 |
| |
|
5 |
| |
|
6 |
| |
|
7 |
| |
|
8 |
| |
|
9 |
| |
|
10 |
| |
|
11 |
| |
|
12 |
| |
|
13 |
| |
|
14 |
| |
|
15 |
| |
|
16 |
| |
|
17 |
| |
|
18 |
| |
|
19 |
| |
|
20 |
| package org.apache.xindice.core.query.ftsearch; |
|
21 |
| |
|
22 |
| import org.apache.lucene.index.TermPositions; |
|
23 |
| import org.apache.lucene.index.Term; |
|
24 |
| |
|
25 |
| import java.io.IOException; |
|
26 |
| |
|
27 |
| |
|
28 |
| |
|
29 |
| |
|
30 |
| |
|
31 |
| |
|
32 |
| public class NodeTermPositions extends NodeTermDocs implements TermPositions { |
|
33 |
| private int pos; |
|
34 |
| private String term; |
|
35 |
| |
|
36 |
4
| public NodeTermPositions(NodeReader reader) {
|
|
37 |
4
| super(reader);
|
|
38 |
| } |
|
39 |
| |
|
40 |
4
| public void seek(Term term) {
|
|
41 |
4
| this.term = term.text();
|
|
42 |
4
| super.seek(term);
|
|
43 |
| } |
|
44 |
| |
|
45 |
13
| public int nextPosition() throws IOException {
|
|
46 |
96
| while (pos < nodes[num].size()) {
|
|
47 |
96
| if ((nodes[num].get(pos)).equals(term)) {
|
|
48 |
13
| return pos;
|
|
49 |
| } |
|
50 |
83
| pos++;
|
|
51 |
| } |
|
52 |
| |
|
53 |
0
| return 0;
|
|
54 |
| } |
|
55 |
| |
|
56 |
8
| public boolean next() {
|
|
57 |
8
| if (super.next()) {
|
|
58 |
6
| pos = 0;
|
|
59 |
6
| return true;
|
|
60 |
| } |
|
61 |
| |
|
62 |
2
| return false;
|
|
63 |
| } |
|
64 |
| |
|
65 |
0
| public int getPayloadLength() {
|
|
66 |
0
| throw new UnsupportedOperationException();
|
|
67 |
| } |
|
68 |
| |
|
69 |
0
| public byte[] getPayload(byte[] data, int offset) throws IOException {
|
|
70 |
0
| throw new UnsupportedOperationException();
|
|
71 |
| } |
|
72 |
| |
|
73 |
0
| public boolean isPayloadAvailable() {
|
|
74 |
0
| return false;
|
|
75 |
| } |
|
76 |
| } |