[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gzz-commits] storm/org/nongnu/storm pointers/TitleIndex.java...
From: |
Benja Fallenstein |
Subject: |
[Gzz-commits] storm/org/nongnu/storm pointers/TitleIndex.java... |
Date: |
Thu, 22 May 2003 18:54:42 -0400 |
CVSROOT: /cvsroot/storm
Module name: storm
Changes by: Benja Fallenstein <address@hidden> 03/05/22 18:54:42
Modified files:
org/nongnu/storm/pointers: TitleIndex.java
org/nongnu/storm/util: HTTPProxy.java
Added files:
org/nongnu/storm/util: Pair.java
Log message:
searching for pointer titles works
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/storm/storm/org/nongnu/storm/pointers/TitleIndex.java.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/storm/storm/org/nongnu/storm/util/Pair.java?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/storm/storm/org/nongnu/storm/util/HTTPProxy.java.diff?tr1=1.35&tr2=1.36&r1=text&r2=text
Patches:
Index: storm/org/nongnu/storm/pointers/TitleIndex.java
diff -u storm/org/nongnu/storm/pointers/TitleIndex.java:1.4
storm/org/nongnu/storm/pointers/TitleIndex.java:1.5
--- storm/org/nongnu/storm/pointers/TitleIndex.java:1.4 Thu May 22 18:41:05 2003
+++ storm/org/nongnu/storm/pointers/TitleIndex.java Thu May 22 18:54:42 2003
@@ -28,6 +28,7 @@
package org.nongnu.storm.pointers;
import org.nongnu.storm.*;
import org.nongnu.storm.impl.AsyncSetCollector;
+import org.nongnu.storm.util.Pair;
import java.util.*;
import com.bitzi.util.*;
import java.io.*;
@@ -51,17 +52,17 @@
public Set getPointers(String query) throws IOException {
Iterator i=splitWords(query).iterator();
if(!i.hasNext()) return new HashSet();
- Set refs = new HashSet(db.get((String)i.next()).block());
+ Set refs = new HashSet(getWordRefs((String)i.next()));
while(i.hasNext())
- refs.retainAll(db.get((String)i.next()).block());
+ refs.retainAll(getWordRefs((String)i.next()));
Set result = new HashSet();
for(i=refs.iterator(); i.hasNext();) {
- IndexedPool.Mapping m = (IndexedPool.Mapping)i.next();
+ Pair pair = (Pair)i.next();
try {
- PointerId id = new PointerId(m.value);
+ PointerId id = new PointerId((String)pair.second);
PointerBlock cur = pointerIndex().getPointerBlock(id);
- if(cur.getBlockId().equals(m.block))
+ if(cur.getBlockId().equals(pair.first))
result.add(cur);
} catch(Throwable _) {
// bad data, ignore
@@ -94,6 +95,16 @@
words.add(s.toLowerCase());
return words;
+ }
+
+ protected Set getWordRefs(String word) throws IOException {
+ Collection mappings = db.get(word).block();
+ Set result = new HashSet();
+ for(Iterator i=mappings.iterator(); i.hasNext();) {
+ IndexedPool.Mapping m = (IndexedPool.Mapping)i.next();
+ result.add(new Pair(m.block, m.value));
+ }
+ return result;
}
protected static class IndexType implements IndexedPool.IndexType {
Index: storm/org/nongnu/storm/util/HTTPProxy.java
diff -u storm/org/nongnu/storm/util/HTTPProxy.java:1.35
storm/org/nongnu/storm/util/HTTPProxy.java:1.36
--- storm/org/nongnu/storm/util/HTTPProxy.java:1.35 Thu May 22 18:41:05 2003
+++ storm/org/nongnu/storm/util/HTTPProxy.java Thu May 22 18:54:42 2003
@@ -343,7 +343,7 @@
Writer w = new OutputStreamWriter(resp.getOutputStream(),
"US-ASCII");
- w.write("<html><head><title>"+query+"</title></head><body>\n");
+ w.write("<html><head><title>"+query+" - Search
results</title></head><body>\n");
w.write("<h1>Results for '"+query+"'</h1>\n\n");
Set pBlocks = idx.getPointers(query);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gzz-commits] storm/org/nongnu/storm pointers/TitleIndex.java...,
Benja Fallenstein <=