@@ -1,7 +1,6 @@
11/- s=sphinx
22/+ gossip, default-agent, verb, dbug
33/+ *sphinx
4−/+ *validate-url
54/+ sift
65/+ m=metaphone
76/$ grab-listing %noun %directory-listing
@@ -12,29 +11,12 @@
1211 |%
1312 +$ card card:agent:gall
1413 +$ edition
15− $% state-0
16− state-1
17− ==
18− +$ state-1
19− $: %1
20− =lookup:s
21− =trigrams:s
22− =phonetics:s
23− =trail:s
24− =directory:s
25− published=directory:s
26− ==
27− +$ state-0
28− $: %0
29− =lookup:s
30− =trigrams:s
31− =phonetics:s
32− =trail:s
33− =directory:directory-state-zero:s
34− published=directory:directory-state-zero:s
14+ $% state-0:s
15+ state-1:s
16+ state:s
3517 ==
3618 --
37−=| state-1
19+=| state:s
3820=* state -
3921=<
4022 %+ verb &
@@ -62,13 +44,9 @@
6244 =/ old !<(edition vase)
6345 |^
6446 ?- -.old
65− %1 `this(state old(published (purge published.old)))
66− %0
67− %_ $
68− -.old %1
69− published.old (purge (directory-0-to-1 published.old))
70− directory.old (directory-0-to-1 directory.old)
71− ==
47+ %2 `this(state (get-state-2 directory.old))
48+ %1 `this(state (get-state-2 directory.old))
49+ %0 `this(state (get-state-2 (directory-0-to-1 directory.old)))
7250 ==
7351 ++ directory-0-to-1
7452 |= =directory:directory-state-zero:s
@@ -79,6 +57,19 @@
7957 =/ post post.listing(+63 [+63.post.listing ''])
8058 listing(+2 post)
8159 ::
60+ ++ get-state-2
61+ |= =directory:s
62+ :* %2
63+ (reindex directory)
64+ directory
65+ (purge directory)
66+ ==
67+ ++ reindex
68+ |= =directory:s
69+ %+ roll
70+ ~(tap by directory)
71+ |= [[=hash:s l=listing:s] i=index:s]
72+ (~(catalog delver i) hash l)
8273 ++ purge
8374 |= =directory:s
8475 ^- directory:s
@@ -193,10 +184,12 @@
193184 %directory
194185 =+ !<(d=directory:s vase)
195186 =. directory (~(uni by directory) d)
196− %+ roll
197− ~(tap by d)
198− |= [[=hash:s l=listing:s] c=_cor]
199− (index:c hash l)
187+ =. index
188+ %+ roll
189+ ~(tap by d)
190+ |= [[=hash:s l=listing:s] i=_index]
191+ (~(catalog delver i) hash l)
192+ cor
200193 ==
201194 ==
202195 ==
@@ -234,7 +227,7 @@
234227 ~(val by directory)
235228 |= =listing:s
236229 |(=(filter %all) =(filter type.post.listing))
237− =/ entries (~(get-entries delver [lookup trigrams phonetics]) term)
230+ =/ entries (~(get-entries delver index) term)
238231 :: ~& %+ turn
239232 :: entries
240233 :: |= [=hash:s =rank:s]
@@ -272,11 +265,11 @@
272265 di-core(hash h, listing (~(gut by directory) h *listing:s))
273266 ++ di-remove
274267 =. gone &
275− =/ keys (~(got by trail) hash)
276− =. trail (~(del by trail) hash)
277− =. lookup
268+ =/ keys (~(got by trail.index) hash)
269+ =. trail.index (~(del by trail.index) hash)
270+ =. lookup.index
278271 ^- lookup:s
279− %- ~(uni by lookup)
272+ %- ~(uni by lookup.index)
280273 %- malt
281274 %+ turn
282275 keys
@@ -284,7 +277,7 @@
284277 :- key
285278 ^- (list entry:s)
286279 %+ skip
287− (~(got by lookup) key)
280+ (~(got by lookup.index) key)
288281 |=([h=hash:s =rank:s] =(h hash))
289282 =? published (~(has by published) hash)
290283 (~(del by published) hash)
@@ -292,73 +285,11 @@
292285 ++ di-publish
293286 |= l=listing:s
294287 =. listing l
295− =. cor (index hash l)
288+ =. index (~(catalog delver index) hash l)
296289 =. published
297290 ?. =(src our):bowl published
298291 (~(put by directory) hash.listing listing)
299292 =. cor (emit (invent:gossip %directory-listing !>(listing)))
300293 di-core
301294 --
302−++ index
303− |= [=hash:s l=listing:s]
304− ?> (lte (lent (trip title.post.l)) 77)
305− ?> (lte (lent (trip description.post.l)) 256)
306− ?> (lte (lent tags.post.l) 8)
307− ?> (lte (lent (trip link.post.l)) 1.024)
308− ?> (lte (lent (trip image.post.l)) 1.024)
309− =. cor
310− ?: =(image.post.l '') cor
311− =/ image (validate image.post.l)
312− cor
313− =/ link (validate link.post.l)
314− =/ entries=lookup:s
315− %- malt
316− %- zing
317− :~ ~[[(crip (cass (trip title.post.l))) ~[[hash rank=0]]]]
318− %+ turn
319− (sift:sift title.post.l)
320− |= word=@t
321− [word ~[[hash rank=1]]]
322− %+ turn
323− tags.post.l
324− |= tag=@t
325− [(norm:sift tag) ~[[hash rank=2]]]
326− %+ turn
327− (sift:sift description.post.l)
328− |= word=@t
329− [word ~[[hash rank=3]]]
330− ~[[type.post.l ~[[hash rank=4]]]]
331− ==
332− =/ keys ~(tap in ~(key by entries))
333− =. trail (~(put by trail) hash keys)
334− =. lookup
335− %- ~(uni by entries)
336− %- ~(rut by lookup)
337− |= [=key:s value=(list entry:s)]
338− ?. (~(has by entries) key) value
339− (weld value (~(got by entries) key))
340− =. trigrams
341− %+ roll
342− %+ snoc
343− %+ turn keys
344− |= =key:s
345− %- malt
346− %+ turn (iching key)
347− |= =trigram:s
348− [trigram (silt ~[key])]
349− trigrams
350− |= [next=trigrams:s t=trigrams:s]
351− %- (~(uno by t) next)
352− |= [k=key:s v=(set key:s) w=(set key:s)]
353− (~(uni in v) w)
354− =. phonetics
355− %-
356− %- ~(uno by phonetics)
357− %- malt
358− %+ turn keys
359− |= =key:s
360− [(utter:m key) (silt ~[key])]
361− |= [k=key:s v=(set key:s) w=(set key:s)]
362− (~(uni in v) w)
363− cor
364295--