The three rules of Ruby Quiz:

1.  Please do not post any solutions or spoiler discussion for this quiz until
48 hours have passed from the time on this message.

2.  Support Ruby Quiz by submitting ideas as often as you can:

http://www.rubyquiz.com/

3.  Enjoy!

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

by Lyndon Samson

All this fiddling with bits in the thread "How to get non-unique elements from
an array" got me digressing to search engines and indexing.

So if you have for example:

	Doc1=The quick brown fox
	
	Doc2=Jumped over the brown dog
	
	Doc3=Cut him to the quick

You can build a table with bit number and word.

	1 the
	2 quick
	3 brown
	4 fox
	5 jumped
	6 over
	7 dog
	8 cut
	9 him
	10 to
	11 quick

To create indices:

	Doc1=00000001111
	Doc2=00001110101
	Doc3=11110000011

You can very quickly return the Docs that contain 'the' [ Doc1,Doc2,Doc3 ], or
brown [ Doc1,Doc2 ] etc.

This week's Ruby Quiz is to write a simple indexer/query system.

[ Note:

In the spirit of that thread, I think part of the quiz should be to solve the
indexing problem in the shortest, most elegant, yet fastest way possible. Maybe
that goes without saying, but I've seen some pretty long quiz solutions in the
past.

--Ryan Leavengood ]