Log in

View Full Version : search engine



madu
08-02-2010, 06:11 PM
I would like to put a search option on my website so people can type in a word and it will direct them to the most appropriate item or page.
Is there an easy way to do this ???
can any one tell me a please to get a code ???

bluewalrus
08-02-2010, 06:17 PM
How is your page set up? Does it use a database?

madu
08-02-2010, 06:28 PM
no. it has only static pages.

fastsol1
08-02-2010, 07:21 PM
Well the results page would have to be a php page for this to work, but the other pages can remain the same as they are. You would also need a mysql database to store the search terms and such. Here is a great tutorial on this -
http://www.youtube.com/user/phpacademy#p/u/51/6pW7mGr8oAU

Beverleyh
08-02-2010, 07:24 PM
There was one that used a javascript array and no database - It was called Tipue 4.2.
You have to define the searchable terms/text in the javascript file, which means a lot of manual text-keyword typing, but it does an OK job as far as flat files search engines go.

Here's the link: http://www.brothersoft.com/tipue-js-download-26404.html
(the server 2 or 3 download links are still live)

When I used it, I used the "Javascript" folder in the download pack and bypassed the RSS and XML folders.

"tipue_data.js" is the file where you define your search data.

The official website doesnt seem to exist anymore but as luck would have it, I copied and pasted the tutorial/setup pages into a Word doc at the end of 2007 :)
See attached.

Hope that helps.

Beverleyh
08-02-2010, 07:30 PM
Thinking on - I used Tipue a few years ago in a college project and I just found the archived link again to my sample website - this provides a good example of how the search works and how it can be styled to fit in with your site. http://chesterfieldstudents.co.uk/ptfdsc/bev/

Just search on "Tapton" to produce a good amount of search results.

Beverleyh
08-02-2010, 08:13 PM
Here's a spreadsheet that might help you to prepare and keep track of your search terms in Tipue (attached)

Dont edit the cells with red text, just the cells with black text.
Array numbers must be a new number per search item line, starting from 0 with no missing numbers (must be sequential)
No semi-colon on the very last line.

Once you've populated all your search data, you can highlight and copy all the data (from yellow cell to yellow cell) and paste it into the "tipue_data.js" file via Notepad.

Hope that helps.

djr33
08-03-2010, 03:53 AM
There have already been a number of good answers, but here's a general response to your question: there is no easy way to create a good search engine. Either it will be good and very hard to make, or it will not be very functional. One of the easiest ways is to create a keyword list where you manually describe items and guess what people may search. This makes everything simpler, though it is still by no means "easy". The problem here is that it takes a lot of effort to maintain this system, and maybe one way you could make it easier is to skip the "search" and instead use a "tagging" system where you simply apply tags like "animal" or "books" to whatever items they apply. Any creative system like that will be easier and more effective than anything but a full search system which is complex.

It is possible to use a database like MySQL and do a full text search, but this is intense for the processor and may be slow, depending on the size of your site. You will certainly need to move away from html files and start using a database if you want to try this (in theory you could duplicate your content into the database and still have regular html files, but that seems unhelpful).

In conclusion, this is a particularly hard thing to write and I'm working on it myself. There are a few threads here in PHP and in MySQL about some of the algorithms I've worked out and while they work well, they are difficult to implement and not very efficient. After that, it's amazing how fast google and other real search engines can go through so many pages.


My recommendation if you really want something "easy" is to just use a google custom search. Many sites use it and it really is effective. The only problem is that it's google and not your page, so it may not look so "professional", but it's a great way to create a search and certainly the easiest, as long as you don't need to control it yourself (such as adding custom options). Now google custom search even allows some integration into the page such as styling, etc.
For an example, just look at the search here.

madu
08-03-2010, 07:13 AM
wow....it's working nicely. thank you Beverleyh :)

Beverleyh
08-03-2010, 07:27 AM
No problem madu.

hansan
08-03-2010, 12:31 PM
hey Beverleyh, it's working nicely for me also.
but there are 3 types of categorizes named as JavaScript, RSS & XML. they all are giving the search option.
but what are the difference of these 3 :( ?

Beverleyh
08-03-2010, 12:35 PM
Presumably they are just different methods of using the search engine.

I only ever used the stuff in the "Javascript" folder, and never played with the others, and now the website is gone so I cant give a better answer, Sorry :(

I'm just pleased that I copied and pasted the tutorial aspect of their old website into the Word doc so I (we) can refer back to it now. Thank heavens for small mercies!

Beverleyh
08-03-2010, 12:49 PM
I've just had another look and the XML, RSS and Javascript folder just appear to be reference to the different files that store the search arrays - each uses a slightly different method of storing the data.

Use what you feel most comfortable with - the Javascript one was the one that originally felt most "familiar" to me so that's the one I remember (I'd never used RSS or XML when I stumbled on the script). It was also (to me) the one that translated the easiest into the Excel spreadsheet due to the horizontal array layout. Of course, you can set up the others that way in Excel too but when you need to use something quickly, you just look for the most obvious patterns and work with that. I used to be a number-cruncher, working with statistical data and contract prices, so Excel was just a tool I used to achieve a neater layout than trying to manage the text file alone.

Hope that helped.