ScannerTypeahead & BrowseTypeahead

49 views
Skip to first unread message

Andrew O'Brien

unread,
Oct 5, 2012, 11:14:04 AM10/5/12
to cleo-ty...@googlegroups.com
So, I've been playing around with cleo-primer a bit and am starting to look around at some of the other typeaheads aside from GenericTypeahead and had some questions:

1) ScannerTypeahead: it looks like the main difference between this and GenericTypeahead is that it doesn't have a connectionStore. With the connectionStore acting as an adjacency list of all permutations of a string prefix (up to a certain limit) and its associated set of element ids, in the GenericTypeahead we're able to choose fewer elements to run against the Bloom filter which would seem more efficient in general to me. So, when would you use a ScannerTypeahead instead? I see documentation says that it's intended for collections in the tens or hundreds of thousands... is it a matter of space efficiency from not having to store the connection store beating out the potential time savings of not checking every element?

2) BrowseTypeahead: I guess I have pretty much the same question here: when would you use it? It looks like it has an internal collection of element ids and Bloom filters... is it for small collections of frequently changing elements?

Thanks!

Jingwei

unread,
Oct 12, 2012, 1:18:55 AM10/12/12
to cleo-ty...@googlegroups.com
Hi Andrew,

As you have observed, ScannerTypeahead avoids connections-store to save some space since efficiency is good enough for the scale of tens or hundreds of thousands of elements. The brute force scanning aided by bloom filter is only a few milliseconds. ScannerTypeahead lets you openRangeTyeahead for different ranges. We use it different groups of elements. For example, 1st Group has 5000 cities, 2nd Group has 10000 hotels, 3nd Group has 6700 restaurants. You can put these groups into a ScannerTypeahead and open the corresponding range for each group and do search.

BrowseTypeahead is similar to ScannerTypeahead but it scans non-continuous element ids. For example, you have 10000 hotels, you have a BrowseTypeahead for category-one hotels [1, 19, 207, 3089]  and one for category-two hotels [2, 4, 5, 10, 101, 327, 8999, ....] and one for category-three and one for category-four and etc. If the category-one hotels are changed to [3, 19, 207, 3089, 4129, 10000], and you can call update(int[]) on the category-one BrowseTypeahead.

Hope this is helpful.

jingwei 
Reply all
Reply to author
Forward
0 new messages