Search speed

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
dhobbs
Posts: 24
Joined: Tue Dec 15, 2009 6:25 pm

Search speed

Post by dhobbs » Mon Mar 08, 2010 4:03 pm

Thanks to the help I've received here, I have created a simple application for viewing images. I now would like to annotate the images so users can search on keywords and get the appropriate image. I'm thinking of two approaches. One, I can use stacks and cards. For each topic, the number of images is probably less than 25, so maybe I can just load the whole stack. I'm also considering reading from a formatted text file which contains all the annotations.

The question is: How do I do a search to return all the image files associated with a keyword? Is it easier to do this if they are all cards in a stack, or can I use a text file (with formatting, using "read file until" ) and repeat until all the files are retrieved? One uses larger files, and the other is frequently accessing the hard drive. Is one better?

Thanks,

--Doug

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: Search speed

Post by Mark » Tue Mar 09, 2010 10:09 am

Hi Doug,

I would keep a list (in memory, a text file, a property or a database) and search for the tag. Update the list each time when a tag is added. Make sure you keep the list in a writable location (not in the applications folder).

Best,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10317
Joined: Wed May 06, 2009 2:28 pm

Re: Search speed

Post by dunbarx » Thu Mar 11, 2010 3:28 pm

If the number of cards is less than a handful of thousands, I think the most intuitive way is to keep it all in a stack. Each card can hold the images and a bg field with keywords. Speed will be instantaneous.

Craig Newman

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: Search speed

Post by Mark » Thu Mar 11, 2010 3:48 pm

Craig

Why not do it right, right from the beginning? Whenever the database gets much bigger than originally intended, Doug might get into trouble, if keeping everything in cards.

Best,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

Post Reply