View Full Version : Search Engine
Al6200
July 25th, 2006, 03:47 PM
I've been writing a Flash-based tutorial which is a few hundred pages. I created a search engine to make navigation easier.
I created this little test to see how a search engine would work on the full tutorial.
http://denvish.net/ulf/1153847055_preloader_menu.php
(search engine can be accessed by rolling over the small button that says menu at the bottom of the page)
=guinness=
July 25th, 2006, 04:15 PM
you can make a flash movie different sizes than the default (550x400 or something).
your stage is so small on 1280x1024 and you're text is distracting with the all bold.
up the framerate so the rollin is quicker and smoother.
ramie
July 25th, 2006, 04:34 PM
The search works pretty good, I tried a few things and they all came up with revelant results.
Al6200
July 25th, 2006, 04:40 PM
Heh, thanks about the relevant results.
I can see now in hindsight that my stage is too small... Really, don't like the bold?
Remember that what I linked to is just one section out of some 40ish, so changing the bold and reformating it to look good on a wider stage would be very time consuming.
Its on my to-do-list, so I might get to reformating the stage size, I might not.
So, like the search engine?
bwh2
July 25th, 2006, 04:40 PM
i can't get the search to work on much after page 1.
Al6200
July 25th, 2006, 04:48 PM
bwh2,
What are you searching for that isn't returning results?
I might not have specified this but you're only supposed to search one word, if you search more than that it won't work very well...
I'd really like to fix your bug, but I'll need a little information on what you're doing and what the program is doing in order to address it effectivly.
Thanks though! :)
ramie
July 25th, 2006, 04:51 PM
yea, when I started to put it through it paces it's falling down, single letter searches, quoted strings etc, is this just a simple pattern match or have you some algorithm for matching phrases and words?
It also says goto frame, goto page would be better.
bwh2
July 25th, 2006, 04:58 PM
for instance, if you go to the Logic Errors page. you can search any of these terms and not come up with a result even though they are staring you in the face:
enterframe
minimalize
proper
expressing
Al6200
July 25th, 2006, 05:12 PM
Its an extremely simple "algorithem", but iteration makes it able to find the word in 1000s of pages with very little code.
I might make it more accurate in the future, so it can find the most relevant results (instead of just returning every page with the word).
This is my code:
for(j = 0; j < 25; j++) {
pageList.push(eval("page" + (j + 1)));
}
_root.men.back.btn.onPress = function() {
_root.searchResult = "Result:\n";
for(i = 0; i < 25; i++) {
searchReturn = pageList[i].indexOf(search);
if (searchReturn != -1) {
_root.searchResult += "Page " + (i + 1) + "\n"
}
}
}
Basically what it does is it starts with a series of string variables. Each string has the text on the page minus prepositions and common words (which are pointless for searching).
And then I take each string and push it onto the array. I can automate this process because each string is named Page1, Page2, Page3, etc.
Then I basically use a for loop to do run the indexOf function on the array for each string. If the characters are in the string, indexOf returns the position of that sub-string in the overall string. If it doesn't find the string, it returns -1.
Then the code uses that.
I find it neat how efficient this code is in terms of how short and concisely it can automate a bunch of processes.
Al6200
July 25th, 2006, 05:15 PM
bwh2,
The string values that its searching doesn't have the full text, rather I edited the text to remove prepositions and irrelevent terms.
This is done to reduce processing strain and also to optimize results. If someone searches "enterFrame", they should get the page explaining handlers in general, and the page going over that specific event, not the page that references it on the side. Do you see what I'm saying? I removed those words specifically because none of those words are that relevant to the topic, or they are more relevant to another page.
bwh2
July 25th, 2006, 06:01 PM
well, i guess that's your choice. such is life.
t0mm0
July 26th, 2006, 06:05 AM
The only site that i have ever been to and seen *preloader Loading*
lol the search is good though
Al6200
July 26th, 2006, 08:22 AM
I probably don't need the preloader loading. My preloader is 128 kb, which isn't huge... I just have the preloader loading thing because I don't like the user to see any white before the first frame loads.
I'm glad you like the search engine, and ideas for improving it are appreciated.
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.