@@ -98,22 +98,31 @@
9898 |= [=mark =vase]
9999 |^ ^+ cor
100100 ?+ mark ~|(bad-poke/mark !!)
101− %directory-listing
102− =+ !<(=listing:s vase)
103− (publish listing)
101+ %declare
102+ =+ !<(=declare:s vase)
103+ di-abet:(publish declare di-core)
104+ %declarations
105+ =+ !<(declared=(list declare:s) vase)
106+ =. di-core (roll declared publish)
107+ cor
104108 ==
105109 ++ publish
106− |= =listing:s
107− ^+ cor
110+ |= [=declare:s core=_di-core]
111+ ^+ di-core
108112 ::
109− ?> =(src.bowl source.listing)
110113 ?> from-self
111− ?> =(hash.listing (digest post.listing))
114+ =/ listing
115+ :* post=q.declare
116+ hash=(digest q.declare)
117+ reach=p.declare
118+ source=our.bowl
119+ time=now.bowl
120+ ==
112121 ?: (~(has by directory) hash.listing)
113122 ~& 'Listing already exists.'
114123 cor
115124 =. published (~(put by directory) hash.listing listing)
116− di-abet:(di-publish:(di-abed:di-core hash.listing) listing)
125+ (di-publish:(di-abed:core hash.listing) listing)
117126 --
118127::
119128++ watch
@@ -165,16 +174,7 @@
165174 =/ limit (slav %ud i.t.t.t.t.path)
166175 :: expects encoded @t values)
167176 =/ term `@t`(slav %t i.t.t.path)
168− =/ term-counts (get-term-counts term)
169− ~& term-counts
170− =/ terms (get-terms term-counts)
171− ~& terms
172− =/ all=(list listing:s)
173− %- zing
174− %+ turn
175− terms
176− |= [=key:s v=@ud]
177− (get-listings (get-hashes key))
177+ =/ all (get-listings (get-hashes term))
178178 =/ listings (swag [start limit] all)
179179 :* listings
180180 start
@@ -183,69 +183,15 @@
183183 (lent all)
184184 ==
185185 ==
186−::
187−++ get-terms
188− |= tally=(map @t @ud)
189− ^- (list [@t @ud])
190− =/ sorted
191− %+ sort
192− ~(tap by tally)
193− |= [[k=@t v=@ud] [l=@t w=@ud]]
194− (lth v w)
195− =/ median-index (div (lent sorted) 2)
196− =/ q1 (median (scag +(median-index) sorted))
197− =/ q3 (median (slag median-index sorted))
198− =/ iqr (sub q3 q1)
199− %+ skim
200− sorted
201− |= [k=@t v=@ud]
202− (gth:rs (sun:rs v) (mul:rs (sun:rs q3) .1.5))
203−++ median
204− |= terms=(list [k=@t v=@ud])
205− ^- @ud
206− =/ length (lent terms)
207− =/ middle (div length 2)
208− ?. =((mod length 2) 0) (tail (snag middle terms))
209− %+ div
210− %+ add
211− (tail (snag middle terms))
212− (tail (snag +(middle) terms))
213− 2
214−++ get-term-counts
215− |= term=@t
216− ^- (map @t @ud)
217− =/ parts (split:sift term)
218− =/ ngrams=(list @t)
219− %- zing
220− %+ turn
221− parts
222− |= part=@t
223− (iching part)
224− %+ roll
225− ngrams
226− |= [ngram=@t tally=(map @t @ud)]
227− ^- (map @t @ud)
228− =/ words=(set @t) (~(gut by trigrams) ngram *(set @t))
229− %-
230− %- ~(uno by tally)
231− %- malt
232− %+ turn
233− ~(tap in words)
234− |= word=@t
235− [word 1]
236− |= [k=@t v=@ud w=@ud]
237− (add v w)
238186++ get-hashes
239187 |= =key:s
240− ^- (list hash:s)
241188 %+ turn
242189 %+ sort (~(gut by lookup) key *(list entry:s))
243190 |= [a=entry:s b=entry:s]
244191 (gte rank.a rank.b)
245192 |=(=entry:s hash.entry)
246193++ get-listings
247− |= l=(list hash:s)
248− ^- (list listing:s)
194+ |= l=(list hash)
249195 %+ turn l
250196 |=(=hash:s (~(got by directory) hash))
251197++ from-self =(our src):bowl
@@ -264,22 +210,18 @@
264210 =/ entries=lookup:s
265211 %- malt
266212 %- zing
267− :~ %+ turn
268− (sift:sift title.post.l)
269− |= word=@t
270− [word ~[[hash rank=0]]]
271− ~[[type.post.l ~[[hash rank=1]]]]
213+ :~ ~[[title.post.l ~[[hash rank=0]]]]
272214 %+ turn
273215 tags.post.l
274216 |= tag=@t
275− [tag ~[[hash rank=2]]]
217+ [tag ~[[hash rank=1]]]
276218 %+ turn
277219 (sift:sift description.post.l)
278220 |= word=@t
279− [word ~[[hash rank=3]]]
221+ [word ~[[hash rank=2]]]
222+ ~[[type.post.l ~[[hash rank=3]]]]
280223 ==
281224 =/ keys ~(tap in ~(key by entries))
282− ~& keys
283225 =. trail (~(put by trail) hash keys)
284226 =. lookup
285227 %- ~(uni by entries)