space/fetch 'match [] ; space/fetch-all space/probe 'match [none "Vanilla"] space/probe 'query [none none [= x 'snip/number-of-displays]] space/probe 'query [none none [= x 'snip/number-of-displays] [if number? x [x > 40]]] space/build 'query [none none [= x 'snip/number-of-displays]] func [x] [reduce [x/2 x/4]] space/fetch/with-indices 'query [none none none [x = "ngjosmnipessyx"]] [object "ngjosmnipessyx"] space/fetch/with-indices 'query [none none none [if date? x [x < now]]] [predicate 'person/birthdate] space/set-indexing off for i 1 100 1 [space/add compose [attribute "Vanilla" snip/displays (probe i)]] space/set-indexing on ; 3space is file-based. for (reasonably) high querying/matching performance, indices are necessary. ; indexing makes adds and removes much slower. it can temporarily be turned off (for bulk ops). ; 3space keys by subject. that makes hints necessary if full scans are to be avoided. ; if the /with-indices refinement is not used, the indices are ignored. ; no hints needed for match (of course). none it. space/probe/with-indices 'query [ none none [= x 'artifact/developed-by] [contains? x "s"] ] [predicate 'artifact/developed-by] space/probe/with-indices 'query [ none none [= x 'person/birthdate] [if date? x [x < now]] ] [predicate 'person/birthdate] space/probe/with-indices 'query [ none none [x = 'snip/displays] [if number? x [x > 50]] ] [predicate 'snip/displays] space/build/with-indices 'match [ none none snip/displays ] func [x] [reduce [x/2 x/4]] none ; most-popular sort/skip/compare/reverse flatten space/build/with-indices 'match [ none none snip/displays ] func [x] [reduce [x/2 x/4]] none 2 2 ; most-linking (for most-linked exchange x/2 with x/4) inc-in: func [s e d /local p] [ either found? p: find s e [ change next p p/2 + d ] [ repend s [e 1] ] ] count: copy [] space/match [link] func [x] [inc-in count x/2 1] sort/skip/compare/reverse count 2 2 ; recent-stores stores: flatten space/build/with-indices 'match [ attribute none snip/last-store-date ] func [x] [ reduce [x/2 x/4] ] none sort/skip/compare/reverse stores 2 2 ; most-wanted inc-in-collect: func [s e c d /local p] [ either found? p: find s e [ change next p p/2 + d append p/3 c ] [ repend s [e 1 reduce [c]] ] ] count: copy [] space/match [link] func [x] [ if not space/exists-subject? x/4 [ inc-in-collect count x/4 x/2 1 ] ] sort/skip/compare/reverse count 3 2