Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit2122dbd

Browse files
committed
RUM weights patch - combined prev. changes
1 parentbc917c9 commit2122dbd

File tree

5 files changed

+856
-51
lines changed

5 files changed

+856
-51
lines changed

‎Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ REGRESS = rum rum_validate rum_hash ruminv timestamp orderby orderby_hash \
3030
int2 int4 int8 float4 float8 money oid\
3131
time timetz date interval\
3232
macaddr inet cidr text varchar char bytea bit varbit\
33-
numeric
33+
numeric rum_weight
3434

3535
ifdefUSE_PGXS
3636
PG_CONFIG = pg_config

‎data/rum_weight.data

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
As a reward for your reformation I write to you on this precious sheet.|write
2+
You see I have come to be wonderfully attached to Heidelberg, the|attached come see
3+
beautiful, the quaint, the historically poetic, learned and picturesque|
4+
old town on the Neckar. It seems like another home. So I could not show|seems show could
5+
my appreciation of you in a more complimentary way than by sending this|sending
6+
little series of pictures. Have you ever been here, I wonder? You did|did have been wonder
7+
not say, but you wrote as if you knew it by sight as well as by heart.|wrote say knew
8+
As I cannot know, I will venture an explanation. The panorama speaks for|know will speaks
9+
itself. Put on your "specs" and look at the castle, half way up the|put look
10+
_berg_, "the Jettenhuhl, a wooded spur of the Konigestuhl." Look at it|Look
11+
from the "Terrasse." Thus you'll get something of an idea of it. The|get
12+
Gesprente Thurm is the one that was blown up by the French. The|is blown was
13+
thickness of the walls, twenty-one feet, and the solid masonry, held it|held
14+
so well that only a fragment, as it were, gave way. It still hangs as if|were gave hangs
15+
ready to be replaced. "Das Grosse Fass Gebaude," too, you will have no|be replaced will have
16+
difficulty in making out. If you only had it with its 49,000 gallons of|making had
17+
wine, but wouldn't you divide with your neighbors! The columns in the|wouldn't divide
18+
portico that shows in the Schlosshof are the four brought from|shows are brought
19+
Charlemagne's palace at Ingelheim by the Count Palatine Ludwig, some|
20+
time between 1508-44. The Zum Ritter has nothing to do with the castle,|has do
21+
but is an ancient structure (1592) in the Renaissance style, and one of|is
22+
the few that escaped destruction in 1693. It is a beautiful, highly|escaped is
23+
ornamental building, and I wish you could see it, if you have not seen|wish could see have seen
24+
it.|
25+
|
26+
All the above information, I beg you to believe, I do not intend you|beg believe do intend
27+
to think was evolved from my inner consciousness, but gathered from|think was evolved gathered
28+
the--nearest guide-book!|
29+
|
30+
I am so much obliged to you for mapping out Switzerland to me. I have|am obliged have
31+
been trying my best to get all those "passes" into my brain. Now, thanks|been trying get
32+
to your letter, I have them all in the handiest kind of a bunch. Ariel|have
33+
like, "I'll do my bidding gently," and as surely, if I get there. But|do bidding get
34+
there are dreadful reports of floods and roads caved in and bridges|are caved
35+
swept away and snows and--enough of such exciting items as sets one|swept sets
36+
thinking--"to go or not to go?" We are this far on the way. Reached|thinking go go are Reached
37+
here this afternoon. Have spent the evening sauntering in the gardens,|Have spent sauntering
38+
the Conversationhaus, the bazaar, mingling with the throng, listening to|mingling listening
39+
the band, and comparing what it is with what it was. It was a gay and|comparing was was
40+
curious spectacle, but on the whole had "the banquet-hall deserted"|had deserted
41+
look. The situation is most beautiful. It lies, you know, at the|is lies know
42+
entrance of the Black Forest, among picturesque, thickly-wooded hills,|
43+
in the valley of the Oos, and extends up the slope of some of the hills.|extends
44+
The Oos is a most turbid, turbulent stream; dashes through part of the|is
45+
town with angry, headlong speed. There is an avenue along its bank of|is
46+
oaks, limes and maples, bordered with flower-beds and shrubberies, and|
47+
adorned with fountains and handsome villas. We shall devote to-morrow to|
48+
seeing all there is to be seen, and go to Strassburg to-morrow evening|seeing is be seen go
49+
for two or three days. From there to Constance, and then hold _our_|
50+
"Council" as to further movements.|
51+
def fgr|
52+
def xxx fgr|

‎expected/rum_weight.out

Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
CREATE TABLE testweight_rum( t text, a tsvector, r text );
2+
CREATE FUNCTION fill_weight_trigger() RETURNS trigger AS $$
3+
begin
4+
new.a :=
5+
setweight(to_tsvector('pg_catalog.english', coalesce(new.r,'')), 'A') ||
6+
setweight(to_tsvector('pg_catalog.english', coalesce(new.t,'')), 'D');
7+
return new;
8+
end
9+
$$ LANGUAGE plpgsql;
10+
CREATE TRIGGER tsvectorweightupdate
11+
BEFORE INSERT OR UPDATE ON testweight_rum
12+
FOR EACH ROW EXECUTE PROCEDURE fill_weight_trigger();
13+
CREATE INDEX rumidx_weight ON testweight_rum USING rum (a rum_tsvector_ops);
14+
\copy testweight_rum(t,r) from 'data/rum_weight.data' DELIMITER '|' ;
15+
SET enable_seqscan=off;
16+
SET enable_indexscan=off;
17+
SELECT count(*) FROM testweight_rum WHERE a @@ to_tsquery('pg_catalog.english', 'ever:A|wrote');
18+
count
19+
-------
20+
1
21+
(1 row)
22+
23+
SELECT count(*) FROM testweight_rum WHERE a @@ to_tsquery('pg_catalog.english', 'have:A&wish:DAC');
24+
count
25+
-------
26+
1
27+
(1 row)
28+
29+
SELECT count(*) FROM testweight_rum WHERE a @@ to_tsquery('pg_catalog.english', 'have:A&wish:DAC');
30+
count
31+
-------
32+
1
33+
(1 row)
34+
35+
SELECT count(*) FROM testweight_rum WHERE a @@ to_tsquery('pg_catalog.english', 'among:ABC');
36+
count
37+
-------
38+
0
39+
(1 row)
40+
41+
SELECT count(*) FROM testweight_rum WHERE a @@ to_tsquery('pg_catalog.english', 'structure:D&ancient:BCD');
42+
count
43+
-------
44+
1
45+
(1 row)
46+
47+
SELECT count(*) FROM testweight_rum WHERE a @@ to_tsquery('pg_catalog.english', '(complimentary:DC|sight)&(sending:ABC|heart)');
48+
count
49+
-------
50+
2
51+
(1 row)
52+
53+
SELECT count(*) FROM testweight_rum WHERE a @@ to_tsquery('pg_catalog.english', '!gave:D & way');
54+
count
55+
-------
56+
3
57+
(1 row)
58+
59+
SELECT count(*) FROM testweight_rum WHERE a @@ to_tsquery('pg_catalog.english', '(go<->go:a)&(think:d<->go)');
60+
count
61+
-------
62+
0
63+
(1 row)
64+
65+
SELECT count(*) FROM testweight_rum WHERE a @@ to_tsquery('pg_catalog.english', '(go<->go:a)&(think:d<2>go)');
66+
count
67+
-------
68+
1
69+
(1 row)
70+
71+
SELECT count(*) FROM testweight_rum WHERE a @@ to_tsquery('pg_catalog.english', 'go & (!reach:a | way<->reach)');
72+
count
73+
-------
74+
2
75+
(1 row)
76+
77+
SELECT count(*) FROM testweight_rum WHERE a @@ to_tsquery('pg_catalog.english', 'go & (!reach:a & way<->reach)');
78+
count
79+
-------
80+
0
81+
(1 row)
82+
83+
SELECT count(*) FROM testweight_rum WHERE a @@ to_tsquery('pg_catalog.english', 'reach:d & go & !way:a');
84+
count
85+
-------
86+
1
87+
(1 row)
88+
89+
SELECT count(*) FROM testweight_rum WHERE a @@ to_tsquery('pg_catalog.english', 'show:d & seem & !town:a');
90+
count
91+
-------
92+
1
93+
(1 row)
94+
95+
SELECT count(*) FROM testweight_rum WHERE a @@ to_tsquery('pg_catalog.english', '!way:a');
96+
count
97+
-------
98+
52
99+
(1 row)
100+
101+
SELECT count(*) FROM testweight_rum WHERE a @@ to_tsquery('pg_catalog.english', 'go & !way:a');
102+
count
103+
-------
104+
2
105+
(1 row)
106+
107+
SELECT count(*) FROM testweight_rum WHERE a @@ to_tsquery('pg_catalog.english', 'reach:d & !way:a');
108+
count
109+
-------
110+
1
111+
(1 row)
112+
113+
SELECT count(*) FROM testweight_rum WHERE a @@ to_tsquery('pg_catalog.english', 'reach:d & go');
114+
count
115+
-------
116+
1
117+
(1 row)
118+
119+
SELECT count(*) FROM testweight_rum WHERE a @@ to_tsquery('pg_catalog.english', 'think<->go:d | go<->see');
120+
count
121+
-------
122+
1
123+
(1 row)
124+
125+
SELECT count(*) FROM testweight_rum WHERE a @@ to_tsquery('pg_catalog.english', 'reach:d<->think');
126+
count
127+
-------
128+
0
129+
(1 row)
130+
131+
SELECT count(*) FROM testweight_rum WHERE a @@ to_tsquery('pg_catalog.english', 'reach<->think');
132+
count
133+
-------
134+
1
135+
(1 row)
136+

‎sql/rum_weight.sql

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
CREATETABLEtestweight_rum( ttext, a tsvector, rtext );
2+
3+
CREATEFUNCTIONfill_weight_trigger() RETURNS triggerAS $$
4+
begin
5+
new.a :=
6+
setweight(to_tsvector('pg_catalog.english', coalesce(new.r,'')),'A')||
7+
setweight(to_tsvector('pg_catalog.english', coalesce(new.t,'')),'D');
8+
return new;
9+
end
10+
$$ LANGUAGE plpgsql;
11+
12+
CREATETRIGGERtsvectorweightupdate
13+
BEFORE INSERTORUPDATEON testweight_rum
14+
FOR EACH ROW EXECUTE PROCEDURE fill_weight_trigger();
15+
16+
CREATEINDEXrumidx_weightON testweight_rum USING rum (a rum_tsvector_ops);
17+
18+
\copy testweight_rum(t,r)from'data/rum_weight.data' DELIMITER'|' ;
19+
20+
SET enable_seqscan=off;
21+
SET enable_indexscan=off;
22+
23+
SELECTcount(*)FROM testweight_rumWHERE a @@ to_tsquery('pg_catalog.english','ever:A|wrote');
24+
SELECTcount(*)FROM testweight_rumWHERE a @@ to_tsquery('pg_catalog.english','have:A&wish:DAC');
25+
SELECTcount(*)FROM testweight_rumWHERE a @@ to_tsquery('pg_catalog.english','have:A&wish:DAC');
26+
SELECTcount(*)FROM testweight_rumWHERE a @@ to_tsquery('pg_catalog.english','among:ABC');
27+
SELECTcount(*)FROM testweight_rumWHERE a @@ to_tsquery('pg_catalog.english','structure:D&ancient:BCD');
28+
SELECTcount(*)FROM testweight_rumWHERE a @@ to_tsquery('pg_catalog.english','(complimentary:DC|sight)&(sending:ABC|heart)');
29+
SELECTcount(*)FROM testweight_rumWHERE a @@ to_tsquery('pg_catalog.english','!gave:D & way');
30+
SELECTcount(*)FROM testweight_rumWHERE a @@ to_tsquery('pg_catalog.english','(go<->go:a)&(think:d<->go)');
31+
SELECTcount(*)FROM testweight_rumWHERE a @@ to_tsquery('pg_catalog.english','(go<->go:a)&(think:d<2>go)');
32+
SELECTcount(*)FROM testweight_rumWHERE a @@ to_tsquery('pg_catalog.english','go & (!reach:a | way<->reach)');
33+
SELECTcount(*)FROM testweight_rumWHERE a @@ to_tsquery('pg_catalog.english','go & (!reach:a & way<->reach)');
34+
SELECTcount(*)FROM testweight_rumWHERE a @@ to_tsquery('pg_catalog.english','reach:d & go & !way:a');
35+
SELECTcount(*)FROM testweight_rumWHERE a @@ to_tsquery('pg_catalog.english','show:d & seem & !town:a');
36+
SELECTcount(*)FROM testweight_rumWHERE a @@ to_tsquery('pg_catalog.english','!way:a');
37+
SELECTcount(*)FROM testweight_rumWHERE a @@ to_tsquery('pg_catalog.english','go & !way:a');
38+
SELECTcount(*)FROM testweight_rumWHERE a @@ to_tsquery('pg_catalog.english','reach:d & !way:a');
39+
SELECTcount(*)FROM testweight_rumWHERE a @@ to_tsquery('pg_catalog.english','reach:d & go');
40+
SELECTcount(*)FROM testweight_rumWHERE a @@ to_tsquery('pg_catalog.english','think<->go:d | go<->see');
41+
SELECTcount(*)FROM testweight_rumWHERE a @@ to_tsquery('pg_catalog.english','reach:d<->think');
42+
SELECTcount(*)FROM testweight_rumWHERE a @@ to_tsquery('pg_catalog.english','reach<->think');
43+
44+

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp