5 Replies Latest reply on Nov 29, 2011 4:07 PM by kglad

    Search Function/Strategy

    Rothrock Level 5

      I've got a catalog of events in XML that is read into my Flash swf.

       

      I'm trying to develop a search box that will search through the titles, descriptions, presenters, etc. and return a list of related events.

       

      Does anybody know a prebuilt AS2 system that does this? Or a good tutorial on how to go about this? I have googled, but haven't found much.

       

      Here is my approach so far.

       

      When I load in the XML I create an array of the frequency of all the words in the nodes that I'm interested in. I figured it would be useful to do this once instead of each time a search is performed.

       

      I store that word index in another array with an index that will take me back to the original node. I was trying to figure out if there was someway to put it all into one index, but then I'm not sure how I'd link back to the original nodes.

       

      When performing a search I look through the array of word indexs and check for the word and return another array of which original nodes contain the word.

       

      If the search term isn't represented I generate all the permutations of the word that have an edit distance of 1 -- i.e. that have a letter changed, added, or deleted in any position. So for example if the search is for "the" the list of 1-edit would be ahe, bhe, ... tae, tbe,... tha, thb...athe, bthe,...tahe,tbhe, ....... he, te, th. If any of those are found it returns the results and puts up a "Did you mean xxxxx?" type of notice.

       

      So far all of this is working rather well.

       

      I'm still working on figuring out what to do if the user puts two words into the search box.

       

      Also haven't figured out what to do with plurals and other "stem" type situations.

       

      I want to make this pretty simple and easy for people to get the results they want.