A Flash Developer Resource Site

Results 1 to 10 of 10

Thread: Database Search Function

  1. #1

    Database Search Function

    I hope everyone is having a great day today! First off, I would like to state that I have searched for about 2 hours for imformation regarding this and have not found much. Ok, now the question ;0)

    This is what I would like to accomplish. Everyone, minamize your internet browsers, click on your desktop and push F1, Yup.. "Windows Help" now proceed to click on the "Index" button and then start typing a word. That is what I would like to attempt in Flash, A "Seach" type function of an index (txt, asp, xml, etc.) Has anyone here done anything similar? I would like to find out if its possible before I spend countless hours trying to create it. If you need reiteration of what I am trying to do, please let me know. Thank you

    -davy

  2. #2
    Senior Member bs_grewal's Avatar
    Join Date
    Dec 2002
    Posts
    548
    ok its easy.
    now if u r thinking to make this type of search. then each csearch resuld should have a link to details. what about these details. r u thinking it to keep text base or a swf file for each topic?
    Thanks
    Baljit Singh Grewal
    Click here to email me
    Messengers: baljit@bsgrewal.com

  3. #3
    The results should be able to be text based, I need them to be html links to other websites. For instance, I start typing in a word and then underneath I start getting results of similar words. Then, once I find the word I'm looking for, I click on it and it opens up a new page (external website). Does that make sense? Thanks

    -Davy

  4. #4
    Senior Member bs_grewal's Avatar
    Join Date
    Dec 2002
    Posts
    548
    do u know php or asp??
    Thanks
    Baljit Singh Grewal
    Click here to email me
    Messengers: baljit@bsgrewal.com

  5. #5
    I know both to some extent, but the point is to make it all in Flash as a sort of stand alone application. Just a database index search. Thanks

    -Davy

  6. #6
    Registered User
    Join Date
    Feb 2001
    Posts
    13,041
    Hi,

    many databased applications these days use a brute-force approach: whenever you type a character, a database query retrieves all possible choices. This approach is agood way to convince people to bye faster 'puters every now and then

    The better approach would build a compact data structure from your data, and load that into flash. There should be plenty of theoretical articles on the net that describe this apprach, but I am not sure whether it would be really feasible within the flash environment

    Now, of course if your data changes frequently, method 2 may not be a good choice at all

    Musicman

  7. #7
    Hmm, I defenately agree with you on the brute force approach. Speed of the application is a MUST, and the information process would need to be interchangable. I'm going to keep researching this for about a week until I gather enough information to start the project. I think something like this could lead to alot of good developments in the flash community as far as database searching and indexing. So I would like to do a guide on this once I complete the project. If you don't mind Musicman, I would like to have this become more or less a developer discussion. Please please tell people to stop by and add their input. Also, the reason this is posted in the Scripting and Backend section of the forum as opposed to a "discussion board" is so that People who have experience in the backend applications can add input, plus I would hate to develop a guide to something that has already been done.

  8. #8
    Registered User
    Join Date
    Feb 2001
    Posts
    13,041
    Hi,

    here is example of the type of code I have in mind. It was originally designed for a language like C and more meant to be understandable than efficient

    assume the database contains the following words:
    hand, house, horse
    image, imagine
    shoe, sheep
    here is a possible data structure
    Code:
    tree = {
            h:{
                    a:{n:{d:1}},
                    o:{
                            r:{s:{e:2}},
                            u:{s:{e:3}}
                    }
            },
            i:{m:{a:{g:{
                    e:4,
                    i:{n:{e:5}}
            }}}},
            s:{h:{
                    e:{e:{p:6}},
                    o:{e:7}
            }}
    };
    and an algo to print the entire database:
    Code:
    function walk(tree, txt)
    {       for(var j in tree)
            {       var k = tree[j];
                    if(typeof(k) == 'object')
                            walk(k, txt+j);
                    else
                    else
                            output += '<a href=asfunction:info,'+k+'>'+txt+j+'</a>\n';
            }
    }
    output = '';
    walk(tree, '');
    here is somewhat more efficient database
    Code:
    tree = {
            h:{
                    and:1,
                    o:{
                            rse:2,
                            use:3
                    }
            },
            imag:{
                    e:4,
                    ine:5
            },
            sh:{
                    eep:6,
                    oe:7
            }
    };
    It works with same algo.
    However, an algo to output only words matching our input text would be slightly more complex than for first case.

    Musicman

  9. #9
    Nice! That seems like a good solution, considering it would probably be small and efficient. I'll play around with that for awhile and see if I can come up with anything.

    Please people, Submit any ideas, it doesn't matter if your new to databases, just throwing in your creative input will help! Thanks

    -Davy

  10. #10

    Just An Update

    I've been really busy, So I haven't had time to develop this very much. What I decided is that I am going to try a few differen't approaches. Starting with xml.

    From my experience with xml, it is very fast and efficient on a smaller scale. So far, it works great for "Search" type functions, I'll update with a .FLA when I have time to create my test search/Index.

    -Davy

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center