| 1 |
|
package org.apache.lucene.search; |
| 2 |
|
|
| 3 |
|
|
| 4 |
|
|
| 5 |
|
|
| 6 |
|
|
| 7 |
|
|
| 8 |
|
|
| 9 |
|
|
| 10 |
|
|
| 11 |
|
|
| 12 |
|
|
| 13 |
|
|
| 14 |
|
|
| 15 |
|
|
| 16 |
|
|
| 17 |
|
|
| 18 |
|
|
| 19 |
|
import org.apache.lucene.document.Document; |
| 20 |
|
import org.apache.lucene.index.Term; |
| 21 |
|
|
| 22 |
|
import java.io.IOException; |
| 23 |
|
import java.rmi.Naming; |
| 24 |
|
import java.rmi.RMISecurityManager; |
| 25 |
|
import java.rmi.RemoteException; |
| 26 |
|
import java.rmi.server.UnicastRemoteObject; |
| 27 |
|
|
| 28 |
|
|
| 29 |
|
|
| 30 |
|
|
| 31 |
|
@version |
| 32 |
|
|
|
|
|
| 36.6% |
Uncovered Elements: 26 (41) |
Complexity: 16 |
Complexity Density: 0.7 |
|
| 33 |
|
public class RemoteSearchable |
| 34 |
|
extends UnicastRemoteObject |
| 35 |
|
implements Searchable { |
| 36 |
|
|
| 37 |
|
private Searchable local; |
| 38 |
|
|
| 39 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
| 40 |
2
|
public RemoteSearchable(Searchable local) throws RemoteException {... |
| 41 |
2
|
super(); |
| 42 |
2
|
this.local = local; |
| 43 |
|
} |
| 44 |
|
|
| 45 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 46 |
0
|
public void search(Weight weight, Filter filter, HitCollector results)... |
| 47 |
|
throws IOException { |
| 48 |
0
|
local.search(weight, filter, results); |
| 49 |
|
} |
| 50 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 51 |
0
|
public void close() throws IOException {... |
| 52 |
0
|
local.close(); |
| 53 |
|
} |
| 54 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 55 |
53
|
public int docFreq(Term term) throws IOException {... |
| 56 |
53
|
return local.docFreq(term); |
| 57 |
|
} |
| 58 |
|
|
| 59 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 60 |
0
|
public int[] docFreqs(Term[] terms) throws IOException {... |
| 61 |
0
|
return local.docFreqs(terms); |
| 62 |
|
} |
| 63 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 64 |
8
|
public int maxDoc() throws IOException {... |
| 65 |
8
|
return local.maxDoc(); |
| 66 |
|
} |
| 67 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 68 |
6
|
public TopDocs search(Weight weight, Filter filter, int n) throws IOException {... |
| 69 |
6
|
return local.search(weight, filter, n); |
| 70 |
|
} |
| 71 |
|
|
| 72 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 73 |
47
|
public TopFieldDocs search (Weight weight, Filter filter, int n, Sort sort)... |
| 74 |
|
throws IOException { |
| 75 |
47
|
return local.search (weight, filter, n, sort); |
| 76 |
|
} |
| 77 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 78 |
338
|
public Document doc(int i) throws IOException {... |
| 79 |
338
|
return local.doc(i); |
| 80 |
|
} |
| 81 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 82 |
53
|
public Query rewrite(Query original) throws IOException {... |
| 83 |
53
|
return local.rewrite(original); |
| 84 |
|
} |
| 85 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 86 |
0
|
public Explanation explain(Weight weight, int doc) throws IOException {... |
| 87 |
0
|
return local.explain(weight, doc); |
| 88 |
|
} |
| 89 |
|
|
| 90 |
|
|
| 91 |
|
|
|
|
|
| 0% |
Uncovered Elements: 17 (17) |
Complexity: 5 |
Complexity Density: 0.45 |
|
| 92 |
0
|
public static void main(String args[]) throws Exception {... |
| 93 |
0
|
String indexName = null; |
| 94 |
|
|
| 95 |
0
|
if (args != null && args.length == 1) |
| 96 |
0
|
indexName = args[0]; |
| 97 |
|
|
| 98 |
0
|
if (indexName == null) { |
| 99 |
0
|
System.out.println("Usage: org.apache.lucene.search.RemoteSearchable <index>"); |
| 100 |
0
|
return; |
| 101 |
|
} |
| 102 |
|
|
| 103 |
|
|
| 104 |
0
|
if (System.getSecurityManager() == null) { |
| 105 |
0
|
System.setSecurityManager(new RMISecurityManager()); |
| 106 |
|
} |
| 107 |
|
|
| 108 |
0
|
Searchable local = new IndexSearcher(indexName); |
| 109 |
0
|
RemoteSearchable impl = new RemoteSearchable(local); |
| 110 |
|
|
| 111 |
|
|
| 112 |
0
|
Naming.rebind("//localhost/Searchable", impl); |
| 113 |
|
} |
| 114 |
|
|
| 115 |
|
} |