/    Sign up×
Community /Pin to ProfileBookmark

Does Anyone Know Where I can Find

A tutorial that explains step by step how to create a search engine for your site. I keep trying these scripts and I can’t get it to work. I also have learned how to use javascript and I understand everything about the scripts I try to manipulate with the exception of all this math. The problem is the scripts you get aren’t very informational. You look at it and there is all these codes that you don’t understand. Does anyone know of a tutorial that explains step by step how to create a search. Maybe if I can find one, I can begin learning how to get the search to do what I want.

to post a comment
JavaScript

12 Comments(s)

Copy linkTweet thisAlerts:
@tam42025authorApr 23.2003 — what I want to do is create an advanced search engine for my site and I can't find any scripts or tutorials that show you how to do it. It's always the basic search script.
Copy linkTweet thisAlerts:
@khalidali63Apr 23.2003 — Do you mean a search utility for your site that will do search within your web pages???
Copy linkTweet thisAlerts:
@tam42025authorApr 23.2003 — yes, I want to be able to search my own pages. I used a script that was wonderful for a basic search but what if you want your search engine to do more. I see so many websites who have advanced search, even this one, and I just don't even know where to begin on how to do something like that. I have tried to use the little knowledge I have on javascript to manipulate other codes into doing it but they never work. I am so frustrated because I really want this option for my viewers and after an entire month, I am still no closer to it then when I started. If you know of some tutorials that specifically shows you how to create an advanced search option, I would appreciate it.
Copy linkTweet thisAlerts:
@khalidali63Apr 23.2003 — Ok the idea of having a search engine could be implemented as below, remind you there could be multiple approaches to it depending upon the person.

  • 1. You have all the webpages ready on your site.

  • 2. create a list of keywords for those individual webpages,e.g a webpage that contains info about all programming languages,it might have keywords such as "programming","C/C++","Java","Ada","SmallTalk","JavaScript","development" and so on.

    once you have all the relative keywords layed out on a paper,then comes to organise them in a way that they can be accessed quickly(Arrays????)..

  • 3. Now you can create an array which have all the keywords for all the pages..may be something like this


  • var keyWords = new Array();

    keyWords[0] = new Array("programming","C/C++","Java","Ada","SmallTalk","JavaScript","development");

  • 4. now what you need to do is get user input and compare it with the entries in the array

    in the above array you have a multidimensional array which has a whole new array at index = 0;

    where main array index=webpage

    and second dimention array will hold keywords for that page

    something liket his

    keyWords[0] = this will point to a webpage that programmig related stuff

    to loop through you will have to keep this distinction in mind


  • for(var n=0;n<keyWords.length;n++){//web page

    for(varx=0;x<keyWords[n].length;x++){//keywords for this page

    //comparison here

    }

    }

    once you have all the entries found

    then you can write the results to a window or the same page..

    I hope this helps a bit..
    Copy linkTweet thisAlerts:
    @tam42025authorApr 23.2003 — It helps a lot. Thank you! But what confuses me more is how do I get that code to recognize each individual input that is selected from the form. For instance if I had a dropdown menu that gives them the choic of selecting from option 1 option 2 and option 3 and then I have another input that asks them to select from a price range starting at option 1 option 2 option 3 and ending at option 1 option 2 and option 3. How do I get the code first to understand that when the viewer makes these selections and hits submit to combine these queries together.

    That's the part that I am really struggling with.
    Copy linkTweet thisAlerts:
    @khalidali63Apr 23.2003 — Well that can be achieved in multiple ways as well depending upon your validation rules.

    .you can make it so that if a value from first is checked and they try to click the submit,the search won't start unless the compplete the query,which is selecting from whatever fields you deem are necessary.
    Copy linkTweet thisAlerts:
    @tam42025authorApr 23.2003 — First I want to thank you for taking the time to explain this to me. This is what I thought I could do. I thought I could just name my selections give my options values and name my inputs and be able to call those names and values from the javascript code.

    For instance <form name="example1"><select name=work>

    <option value="">whatever</option>

    <option value="">whatever2</option>

    </select>

    <input type=text name=srchval value="">

    I thought in an example like that to call it in my code I would just have to enter this

    document.example1.work.options[] + document.example1.srchval.value

    I know this probably looks stupid, lol, but in my mind I thought I could combine the two with a + and that would make my code search for both queries. It didn't work.

    I don't want them to have to select everything in order to perform a search. I just want them to be able to search what they want to perform a search and that search will be limited to only what they select. If that makes sense.

    This link will take you to a page with an example of what I am trying to do [URL=http://ttsmerchandise.com/searchexample.htm]Search Example[/URL] As you can see the only thing that works is the keywords and that's because it contains the input that originally came with the javascript code.
    Copy linkTweet thisAlerts:
    @khalidali63Apr 23.2003 — [i]Originally posted by tam42025 [/i]

    [B]

    document.example1.work.options[] ......... [/B]
    [/QUOTE]


    to get a value selected by a user in a listbox you need to point to the option that is selected..you are close though.Here like this

    document.example1.work.options[document.example1.work.selectedIndex].text

    And I'll take a look and see how much time I can put away for this.. ?
    Copy linkTweet thisAlerts:
    @khalidali63Apr 23.2003 — Can you point me to the link where you have th original script....
    Copy linkTweet thisAlerts:
    @tam42025authorApr 23.2003 — what about this:

    For instance <form name="example1"><select name=work>

    <option value="0">whatever</option>

    <option value="1">whatever2</option>

    </select>

    <input type=text name=srchval value="">

    document.example1.work.options[1].text

    Or am I still off!!!!! lol
    Copy linkTweet thisAlerts:
    @tam42025authorApr 23.2003 — Sure it's [URL=http://javascript.internet.com/miscellaneous/site-search.html]Original Script[/URL]
    Copy linkTweet thisAlerts:
    @khalidali63Apr 23.2003 — it should work,but this does not necessary mean that you have selected the secons option...use the code I posted above..:p
    ×

    Success!

    Help @tam42025 spread the word by sharing this article on Twitter...

    Tweet This
    Sign in
    Forgot password?
    Sign in with TwitchSign in with GithubCreate Account
    about: ({
    version: 0.1.9 BETA 5.5,
    whats_new: community page,
    up_next: more Davinci•003 tasks,
    coming_soon: events calendar,
    social: @webDeveloperHQ
    });

    legal: ({
    terms: of use,
    privacy: policy
    });
    changelog: (
    version: 0.1.9,
    notes: added community page

    version: 0.1.8,
    notes: added Davinci•003

    version: 0.1.7,
    notes: upvote answers to bounties

    version: 0.1.6,
    notes: article editor refresh
    )...
    recent_tips: (
    tipper: @Yussuf4331,
    tipped: article
    amount: 1000 SATS,

    tipper: @darkwebsites540,
    tipped: article
    amount: 10 SATS,

    tipper: @Samric24,
    tipped: article
    amount: 1000 SATS,
    )...