473,545 Members | 1,989 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

To add search in my page

lak
I want to search within my page. How can I do that. When I searched in
the net, it tells to use the google search. But I want to do for my
web page. I am using intra-net system.
Sep 4 '08 #1
12 1470
lak wrote:
I want to search within my page. How can I do that. When I searched in
the net, it tells to use the google search. But I want to do for my
web page. I am using intra-net system.
You'll need to build a search engine which examines the generated html
for every page, parses it into the appropriate words, catalogs those
words in a database, then matches the search arguments to each word.

Unless, of course, you want to search every page on every search, in
which case you don't need to store the words in a database. But such a
search, unless you have a very few number of pages, will take much longer.

Such a search function is not easy to implement. But if you need it,
probably the best way is to set your site up with one of the CMS's which
has it already built in.

--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attgl obal.net
=============== ===

Sep 4 '08 #2
On Sep 4, 3:21*pm, lak <lakindi...@gma il.comwrote:
I want to search within my page. How can I do that. When I searched in
the net, it tells to use the google search. But I want to do for my
web page. I am using intra-net system.
If i unterstood correctly, you do not have too much content right.
ex. if you do not have much than 1500 - 2000 pages, you can simple
use javascript for search.

use arrays to store your data, which will be used, available for
search process;

Ex. var data = new Array();

data[content] = new Array();

data[content][0] = ["x.html","keywo rd","keyword1", "keyword2" ...
"keywordn"];
_______________ _______________ _______________ _______________ _______________ _____
<script language="javas cript">
// Author: Barýþ ÇUHADAR, Licence: GPL..
var c = new String(window.l ocation); // http://foo.com/x.php?q=keyword
var s = c.split("="); // gets the keyword after "="
var flag = 0;

if(s[1])
{
s[1]=decodeURI(s[1]);

for(var i = 0; i < 3; i++)
{
for(var j = 0; j < site_data["content"][i]["keywords"].length;
j++)
if(site_data["content"][i]["keywords"][j].match(s[1]))
{
document.write( "<a href="+site_dat a["content"][i][0]
[0]+">"+site_da ta["content"][i][0][1]+"</a>");
document.write( "<br>");
document.write( site_data["content"][i][0][2]);
document.write( "<br>");
document.write( "<br>");
flag = 1;
}
else if(flag !=1) { flag = 2;}
}
if(flag == 2)
{
document.write( "nothing found");
}
}
else if(flag == 0) { document.write( "enter something to search");}

</script>
_______________ _______________ _______________ _______________ ___________

when you search within keywords by a loop, you can simply built a
simple js search engine skeleton.
Sep 4 '08 #3
Betikci Boris wrote:
On Sep 4, 3:21 pm, lak <lakindi...@gma il.comwrote:
>I want to search within my page. How can I do that. When I searched in
the net, it tells to use the google search. But I want to do for my
web page. I am using intra-net system.

If i unterstood correctly, you do not have too much content right.
ex. if you do not have much than 1500 - 2000 pages, you can simple
use javascript for search.

use arrays to store your data, which will be used, available for
search process;

Ex. var data = new Array();

data[content] = new Array();

data[content][0] = ["x.html","keywo rd","keyword1", "keyword2" ...
"keywordn"];
_______________ _______________ _______________ _______________ _______________ _____
<script language="javas cript">
// Author: Barýþ ÇUHADAR, Licence: GPL..
var c = new String(window.l ocation); // http://foo.com/x.php?q=keyword
var s = c.split("="); // gets the keyword after "="
var flag = 0;

if(s[1])
{
s[1]=decodeURI(s[1]);

for(var i = 0; i < 3; i++)
{
for(var j = 0; j < site_data["content"][i]["keywords"].length;
j++)
if(site_data["content"][i]["keywords"][j].match(s[1]))
{
document.write( "<a href="+site_dat a["content"][i][0]
[0]+">"+site_da ta["content"][i][0][1]+"</a>");
document.write( "<br>");
document.write( site_data["content"][i][0][2]);
document.write( "<br>");
document.write( "<br>");
flag = 1;
}
else if(flag !=1) { flag = 2;}
}
if(flag == 2)
{
document.write( "nothing found");
}
}
else if(flag == 0) { document.write( "enter something to search");}

</script>
_______________ _______________ _______________ _______________ ___________

when you search within keywords by a loop, you can simply built a
simple js search engine skeleton.
Such an important site feature shouldn't rely upon JavaScript, which
can be disabled or unavailable. Also, when serving content as
application/xhtml+xml, document.write( ) is not an option, you need to
use DOM manipulation.

--
Curtis
Sep 5 '08 #4
AqD
On Sep 4, 8:21*pm, lak <lakindi...@gma il.comwrote:
I want to search within my page. How can I do that. When I searched in
the net, it tells to use the google search. But I want to do for my
web page. I am using intra-net system.
If you want only page-based search, there are free search engines for
whole websites (like another google for your site).

Or you can use Zend search engine, part of the Zend framework. It's a
port of java Lucene and can be customized to search in common objects
(= everything you can get); It also supports custom weighting,
keywords, language, etc. But it would require some coding by yourself
and I'm not sure how many people actually use it for real-world
projects (java's Lucene itself is popular and widely-used though)
Sep 5 '08 #5
lak wrote:
I want to search within my page. How can I do that. When I searched in
the net, it tells to use the google search. But I want to do for my
web page. I am using intra-net system.

Zend has a port of Java Lucene that works very well.
Creating the index can be slow, especially if you are--for
instance--indexing thousands of pages in a forum. So slow it
will time out on a shared-host.

You can write a small utility in java, which runs as an
application on the shared host. You will need to upload
the latest lucene.jar. Zend's php Lucene doesn't know
the index was made with java, and the queries work just fine.

Or you can download the search-source to a desktop box,
bump max execution time on your local php.ini and then
make the index with php locally....and then ftp it up
to the shared host.

If you have your own server, none of the above is your
problem. The searches are plenty fast enough and they give
very good results. You'll have to read the tutorials and
roll your own results display. But that isn't hard.

--
cut the board three times and it's still too short
Sep 5 '08 #6
>Such an important site feature shouldn't rely upon JavaScript, which
>can be disabled or unavailable. Also, when serving content as
application/xhtml+xml, document.write( ) is not an option, you need to
use DOM manipulation.
Yes possible. However my approach can be used with PHP regarding the
case of site security and maintenance.

I love JavaScript and using it ;)
Sep 5 '08 #7
Betikci Boris wrote:
>Such an important site feature shouldn't rely upon JavaScript, which
can be disabled or unavailable. Also, when serving content as
application/xhtml+xml, document.write( ) is not an option, you need to
use DOM manipulation.

Yes possible. However my approach can be used with PHP regarding the
case of site security and maintenance.

I love JavaScript and using it ;)
And it fails on 100% of the clients which have javascript disabled.

I use javascript to enhance the visiting experience. But I don't rely
on it.

--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attgl obal.net
=============== ===

Sep 5 '08 #8
AqD
On Sep 6, 2:57*am, Jerry Stuckle <jstuck...@attg lobal.netwrote:
Betikci Boris wrote:
Such an important site feature shouldn't rely upon JavaScript, which
can be disabled or unavailable. Also, when serving content as
application/xhtml+xml, document.write( ) is not an option, you need to
use DOM manipulation.
Yes possible. However my approach can be used with PHP regarding the
case of site security and maintenance.
I love JavaScript and using it ;)

And it fails on 100% of the clients which have javascript disabled.
If the clients do disable javascript, they would have much more to
worry than than your websites ;)
>
I use javascript to enhance the visiting experience. *But I don't rely
on it.
Things get nasty when you have to use ajax like in gmail. Depending on
the target customers, usually I try to keep javascript code compatible
with all major browsers, but if somebody doesn't like javascript (like
myself when i use IE), well he would just have to turn it on or go
away.
Sep 8 '08 #9
AqD wrote:
On Sep 6, 2:57 am, Jerry Stuckle <jstuck...@attg lobal.netwrote:
>Betikci Boris wrote:
>>>Such an important site feature shouldn't rely upon JavaScript, which
can be disabled or unavailable. Also, when serving content as
applicatio n/xhtml+xml, document.write( ) is not an option, you need to
use DOM manipulation.
Yes possible. However my approach can be used with PHP regarding the
case of site security and maintenance.
I love JavaScript and using it ;)
And it fails on 100% of the clients which have javascript disabled.

If the clients do disable javascript, they would have much more to
worry than than your websites ;)
Yet about 10% of users do disable javascript, for one reason or another.
>I use javascript to enhance the visiting experience. But I don't rely
on it.

Things get nasty when you have to use ajax like in gmail. Depending on
the target customers, usually I try to keep javascript code compatible
with all major browsers, but if somebody doesn't like javascript (like
myself when i use IE), well he would just have to turn it on or go
away.
And they will go away, which means lost potential sales. Do you tell
10% of your potential customers without even knowing what they want?
--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attgl obal.net
=============== ===

Sep 8 '08 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
4125
by: R. Rajesh Jeba Anbiah | last post by:
Q: Is PHP search engine friendly? Q: Will search engine spiders crawl my PHP pages? A: Spiders should crawl anything provided they're accessible. Since, nowadays most of the websites are been developed with PHP, you are not supposed to doubt that. As a proof that PHP pages could be crawled and indexed, refer this Google search
1
8707
by: Les Juby | last post by:
A year or two back I needed a search script to scan thru HTML files on a client site. Usual sorta thing. A quick search turned up a neat script that provided great search results. It was fast, returned the hyperlinked page title, filename, and the body txt (30 preceding and following words) in context with the search word highlighted. ...
2
3520
by: CharitiesOnline | last post by:
Hello, I have set this script up to add paging to a search results page. Which on the first page works fine. I calculates how many pages there should be depending on the number of results returned from my search and how many records I have set it to display per page. All great so far, HOWEVER..... When you click the next link to see the...
5
2959
by: George | last post by:
Hi, Anyone has the background for explaining? I have made a search on my name and I have got a link to another search engine. The link's title was the search phrase for the other search engine (a wicked phrase). Some but not all of the words of that phrase exist in my website. I reported it and they removed the link but did not give...
4
2164
by: MDW | last post by:
Posted this on another board, but evidently it was off-topic there...hope you folks will be able to provide some guidance. I've been working on a Web site for a business (my first non-personal site) and I want to help my client get the best search engine listing. Because this is my first for-profit site, I'm not sure what I need to do for...
11
3497
by: emailus | last post by:
I am webmaster for the domain <www.alpha1.org.au>. Not being an expert in html, I take advantage of my domain Registrant's web building tool, 'Instant Website'. This tool is provided as part of the fee I pay for web hosting. 'Instant Website' provides the option of having your opening page as a Flash Page, which you'll see if you visit...
4
3513
by: bendlam | last post by:
I have a page that contains search criteria and when you click on the search button it causes a post back that populates a dataview on the same page. One of the gridview columns contains a link that navigates to a details page. When I try to go back to the search results page i get "Page cannot be displayed" error. How do i go back to the...
1
7518
Merlin1857
by: Merlin1857 | last post by:
How to search multiple fields using ASP A major issue for me when I first started writing in VB Script was constructing the ability to search a table using multiple field input from a form and having the sql statement dynamically built according to the input provided by the user. I have used the method described here hundreds of times it is...
13
2100
by: jfarthing | last post by:
Hi everyone! I am using the script below to search a db. If the is more than one match in the db, all goes well. But if there is only one match in the db, nothing gets displayed. Any suggestions will be greatly appreciated. Jim #! /usr/bin/perl -w use strict;
3
1478
by: Bigalan | last post by:
Hello, i am relatively new to PHP and i am struggling with printing multiple search results on to different pages. The code below works ok but when you click on next page button, it brings up a blank screen. I think it might have something to do with resetting the $found variable. Can you have a quick look? any suggestions would be greatly...
0
7420
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
1
7446
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7778
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6003
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5349
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
4966
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3459
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1908
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1033
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.