[ic] Simple question

Mike Heins mikeh@minivend.com
Mon, 2 Apr 2001 06:09:52 -0400


Quoting Ken Lyons (info@4co.de):
> >Is your database INDEXed?
> 
> 
> Yes, It indexed it (taking 10 minutes)
> It takes 4 min 20 to do a standard search on this data base (GDBM tab delimited, 120 colums)
> Is there a faster way, or database?
> 

If you have a 100MB database in GDBM, that is too big for standard search
methods, which essentially go line-by-line. SQL is better in lots of cases,
though if you want a full-text search you have the same problems there.

Glimpse can be used for full-text searches, and is quite fast. It requires
pre-indexing, and a method is described in the docs.

The documented binary search (with indexes) can search for qualifying
strings for category searches.

The most common need is addressed in the demo with the 

	Database  products  INDEX   category

That allows you to do:

    [loop search="
		st=text
		fi=products

		dl=Hammers
		di=category
	    "
    ] [loop-code] -- [loop-field title] -- [loop-price]<BR>
    [/loop]

with very fast search speeds (assuming Hammers is a small subset of
the database). Of course, it is mostly useful for generating lists
of products.

You can expand it to a coordinated search of associated records with:

     [loop search="
		st=text
		fi=products

		dl=Hammers
		di=category

		co=yes
		sf=products:price
		se=20
		op=<
		nu=1
	    "   
    ] [loop-code] -- [loop-field title] -- [loop-price]<BR>
    [/loop]

which returns all category=Hammers with a price less than 20.

This should all be documented. Search for "binary search" on the developer
site.

-- 
Red Hat, Inc., 131 Willow Lane, Floor 2, Oxford, OH  45056
phone +1.513.523.7621 fax 7501 <mheins@redhat.com>

"Even if you're on the right track, you'll get run over if you just
sit there." -- Will Rogers