Specialty Forums
Security and Virus
General Hardware
CPUs/Overclocking
Networking
Digital Photo/Video
Office Software
PC Gaming
Console Gaming
Programming
Database
Web Development
Digital Home

General Forums
Windows XP
Windows Vista
Windows 95/98
Windows Me
Windows NT
Windows 2000
Win Server 2008
Win Server 2003
Windows 3.1
Linux
PDAs
BeOS
Novell Netware
OpenVMS
Solaris
Disk Op. System
Unix
Mac
OS/2

Drivers
Driver Scan
Driver Forum

Software
Automatic Updates

BIOS Updates

My Computing.Net

Solution Center

Free IT eBook

Howtos

Site Search

Message Find

RSS Feeds

Install Guides

Data Recovery

About

Home
Reply to Message Icon Go to Main Page Icon

very strange search box

Original Message
Name: neonwill
Date: February 27, 2008 at 06:42:54 Pacific
Subject: very strange search box
OS: xp
CPU/Ram: 1GB
Model/Manufacturer: Dell
Comment:
hi everybody, here is the problem with my search box.(for example i have a product online name "lamp, hanging style, black" for me to search it i have to type in order to search it i can't type "black lamp" because its not gonna find it, but if i type "lamp, hang" then i can find it... any body know why? here is the code for that box


<%
':: Accware Online
':: ?Copyright 2000, ICODE Inc
':: Template: AMAZING
'*** Search.asp
%>

<script Language = "Javascript">
function submitMainsearch()
{

/*
if (document.Mainsearch.edtSearchWords.value.indexOf(" ") == 0)
{
alert("Search string should not start with spaces.");
document.Mainsearch.edtSearchWords.focus();
return false;
}
if (document.Mainsearch.edtSearchWords.value.indexOf("\"") > -1 )
{
alert("Please enter a valid Search String.");
document.Mainsearch.edtSearchWords.focus();
return false;
}
if (document.Mainsearch.edtSearchWords.value == "")
{
alert("Please enter a Search String.");
document.Mainsearch.edtSearchWords.focus();
return false;
}

document.Mainsearch.submit();
return true;
*/


var strValue;
strValue = new String(document.Mainsearch.edtSearchWords.value);
var strLen = strValue.length;

if ((strValue == "")||(strValue==" "))
{
alert("Please enter a Search String.");
document.Mainsearch.edtSearchWords.focus();
return false;
}
if (document.Mainsearch.edtSearchWords.value.indexOf("\"") > -1 )
{
alert("Please do not enter \" inside Search String.");
document.Mainsearch.edtSearchWords.focus();
return false;
}
if(strValue.charAt(strLen-1)=="\\")
{
alert("Please do not end Search String with \\.");
document.Mainsearch.edtSearchWords.focus();
return false;
}

//*** Checking for all spaces - Starts here
var AllSpaces = true;
for (i = 0; i < strValue.length; i++)
{
if (strValue.charAt(i) != " " )
{
AllSpaces = false;
break;
}
}
if (AllSpaces)
{
alert("Please enter a Search String.");
document.Mainsearch.edtSearchWords.focus();
return false;
}
//*** Checking for all spaces - Ends here

document.Mainsearch.submit();
return true;
}
</script>

<%

Function search_FormatString(strName)
Dim m_Name, m_Temp

m_Name = UCase(Mid(strName,1,1)) & LCase(Mid(strName,2))
m_Temp = 0

While m_Temp <> -1
m_Temp = inStr(m_Temp+1,m_Name," ")
If m_Temp > 0 Then
m_Name = Mid(m_Name,1,m_Temp) & UCase(Mid(m_Name,m_Temp+1,1)) & Mid(m_Name,m_Temp+2)
Else
m_Temp = -1
End If
Wend
m_Name=Mid(m_Name,1,12) &"..."
search_FormatString = m_Name
End Function
'*** End Function
%>
<form name = "Mainsearch" method="post" action ="<%=g_NonSecurePath%>searchresult.asp?CartId=<%=cartid%>" onSubmit="return submitMainsearch('search','','');">
<input type="hidden" name="from">
<input type="hidden" name="FrmSearchWords">
<%Set objThirdParty = objSearch.GetThirdPartyInfo%>


thanx


Report Offensive Message For Removal


Response Number 1
Name: Michael J (by mjdamato)
Date: February 27, 2008 at 10:17:43 Pacific
Subject: very strange search box
Reply: (edit)
Well, I'm not going to read through all of that code (please only post the relevant code), but the problem is pretty simple.

The EXACT string "black lamp" does not exist within "lamp, hanging style, black". But, "lamp, hang" does: "lamp, hanging style, black".

What you are after is called Full text searching where the search input is parsed into individual words and all the words are used for the search. This requires a database implementation. You'll have to find out the specifics for your environment.

Michael J


Report Offensive Follow Up For Removal

Response Number 2
Name: neonwill
Date: February 27, 2008 at 11:13:01 Pacific
Subject: very strange search box
Reply: (edit)
how do i implementate a better searching option like other website, as i know of i am the only website having that problem. it make search more complicate for others

thanx


Report Offensive Follow Up For Removal

Response Number 3
Name: neonwill
Date: February 27, 2008 at 11:23:59 Pacific
Subject: very strange search box
Reply: (edit)
it not that i don't want to post the relevant code..but i have limited knowlege on these codes...that's why i post what i konw that might be the one which cost the problem on here..sorry for the trouble

thanx


Report Offensive Follow Up For Removal

Response Number 4
Name: Michael J (by mjdamato)
Date: February 27, 2008 at 13:06:13 Pacific
Subject: very strange search box
Reply: (edit)
Well, the code you posted doesn't do any of the actual searching and reading code that is not related to the problem is a waste of time. If you are not sure what code to post, just state you can post code as requested.

As to your problem I can not offer any definitive solution. I typically use PHP & MySQL. It looks like you are using VBScript? and I have no clue to the database you are using. But, full text searching (which is what you are asking for and which I have already stated) is mostly dependant on the database. You should do a google search for "Full Text Searching [DB_Name]" Where DB_Name is the name of the type of database you are using.

Michael J


Report Offensive Follow Up For Removal

Response Number 5
Name: neonwill
Date: February 27, 2008 at 13:10:54 Pacific
Subject: very strange search box
Reply: (edit)
but i want them not to be in full text search, i want my customer search my whole website by entering either model number or part of the name(doesn't have to be in order)....not full text search

thanx


Report Offensive Follow Up For Removal


Response Number 6
Name: Michael J (by mjdamato)
Date: February 27, 2008 at 15:15:09 Pacific
Subject: very strange search box
Reply: (edit)
You are not understanding what Full Text Searching is.

Fine. On the page "searchresult.asp", or perhaps an included page, find the code that queries the database. Should be something along the lines of SELECT * FROM table name (just do a text search for the word select).

Post that code here.

Michael J


Report Offensive Follow Up For Removal

Response Number 7
Name: neonwill
Date: February 28, 2008 at 06:23:03 Pacific
Subject: very strange search box
Reply: (edit)
sorry for all the trouble but i really want it to work..here is the what i found in searchresult.asp i can not find what you are asking me to look for... and once again sorry for the trouble...thanx


<script language="JavaScript">

/* ### This function will be called when the user clicks prev , next or searchagain.
### bm = bookmark
### nav = prev or next depends on the navigation clicked by the user.
### type = itemtype of the last product diplayed in the current list.
### all these three parameters will be null if user clicks search again.
*/
function submitSearch(bm,nav,type)
{
document.frmSearch.BookMark.value =bm;
document.frmSearch.prevnext.value = nav;
document.frmSearch.itype.value = type;
document.frmSearch.submit();
}
function validateqty(txtQty,code,which,code1)
{
var element;
var i,temp1,temp2;
element = "document.frmSearch" + ".qty" + txtQty + ".value";
temp1 = eval(element);
retval=IsNumeric(temp1);
if(retval == 1){
alert("Enter valid quantity");
eval("document.frmSearch" + ".qty" + txtQty + ".value=1");
eval("document.frmSearch" + ".qty" + txtQty + ".focus()");
return;
}
<%If Application("bAutoAdd") Then%>
//showAdd()
if(navigator.appName == "Microsoft Internet Explorer")
miniCart.document.location.replace("<%=g_NonSecurePath%>includes/minicart.asp?CartId=<%=CartId%>&qty=" + eval(element) + "&type=" + which + "&ic=" + code1 + "&tpc=<%=tpdata%>");
else
document.miniCart.document.first.src="<%=g_NonSecurePath%>includes/minicart.asp?CartId=<%=CartId%>&qty=" + eval(element) + "&type=" + which + "&ic=" + code1 + "&tpc=<%=tpdata%>";
return;
<%End if%>
document.frmAdd.qty.value = eval(element);
document.frmAdd.ic.value = code;
if(which=="K")
document.frmAdd.type.value = "kit";
document.frmAdd.submit();
}

// This is the function to show added msg in IE (only for Auto Addition)
function showAdd()
{
if(showadd.style.visibility != "visible")
{
showadd.style.visibility = "visible";
showadd.style.top = bbody.scrollTop + 100;
setTimeout("showAdd()",1000);
}
else
showadd.style.visibility = "hidden";
}

function validatewishqty(txtQty,code,which)
{
var element;
var i,temp1,temp2;
element = "document.frmSearch" + ".qty" + txtQty + ".value";
temp1 = eval(element);
retval=IsNumeric(temp1);
if(retval == 1){
alert("Enter valid quantity");
eval("document.frmSearch" + ".qty" + txtQty + ".value=1");
eval("document.frmSearch" + ".qty" + txtQty + ".focus()");
return;
}
document.frmWish.Wqty.value = eval(element);
document.frmWish.Wic.value = code;
document.frmWish.submit();
}
/*#### This uses regular expression for valid the entered parameter a valid numeric.*/
function IsNumeric(value)
{
var validate=/(^\d+$)/
if ((validate.test(value)) && (value > 0))
return 0;
else
return 1;
}
</script>


</body>
</html>


Report Offensive Follow Up For Removal

Response Number 8
Name: neonwill
Date: February 28, 2008 at 06:28:45 Pacific
Subject: very strange search box
Reply: (edit)
<select name="shop" size="1">
<option value="">Main Catalog</option>
<% If objThirdParty.Count > 0 Then%>
<%For m_Index = 1 to objThirdParty.Count%>
<option <%If (Trim(Request.Form("shop")) = objThirdParty.item(m_Index).code) Or (tpdata = objThirdParty.item(m_Index).code) Then%>Selected<%End If%> value="<%=objThirdParty.item(m_Index).code%>"><%=search_FormatString(objThirdParty.item(m_Index).name)%></option>
<%Next%>
<%end if%>
</select>


thanx


Report Offensive Follow Up For Removal

Response Number 9
Name: Michael J (by mjdamato)
Date: February 28, 2008 at 07:59:59 Pacific
Subject: very strange search box
Reply: (edit)
Sorry, but I can't see anything in the code that you've posted that actually does the searching. It looks to all be validation functions.

Michael J


Report Offensive Follow Up For Removal

Response Number 10
Name: neonwill
Date: February 28, 2008 at 08:48:41 Pacific
Subject: very strange search box
Reply: (edit)
Michael, do you know where can i learn how to write database for the website? thanx for all the help

Report Offensive Follow Up For Removal

Response Number 11
Name: neonwill
Date: February 28, 2008 at 10:11:17 Pacific
Subject: very strange search box
Reply: (edit)

<table cellpadding="0" cellspacing="0" border="0" width="181">
<tr class=siteNavTD><td valign="top" height="20"></td><td width="100%">Search</td>
<td valign="top"></td>
</tr></table>
<table cellpadding="0" cellspacing="0" border="0" width="181">
<tr><td colspan="3" class=siteNav3TD>
 <input type="text" name="edtSearchWords" value="<%=Request.Form("edtSearchWords")%>" size="11" style="font-family: Verdana; font-size: 8pt" maxlength="16"> <% If objThirdParty.Count > 0 Then%>IN<%End if%>
<% If objThirdParty.Count > 0 Then%>
</td></tr>
<tr><td colspan="3" class=siteNav3TD>

thanx


Report Offensive Follow Up For Removal

Response Number 12
Name: Michael J (by mjdamato)
Date: February 28, 2008 at 11:19:55 Pacific
Subject: very strange search box
Reply: (edit)
There are many tutorials available. you will want to find ones specific for your programming language and your particular database. Again, I have no idea what type of database you are using, so I can't provide any suggestions.

Michael J


Report Offensive Follow Up For Removal



Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: very strange search box

Comments:

 
  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 


Data Recovery Software




Batch File- Current Date in Excel

how to setup call of duty to joytok

WindowsME / HotMail Problem

Corrupt memory

Convert fat32 to Ntfs


The information on Computing.Net is the opinions of its users. Such opinions may not be accurate and they are to be used at your own risk. Computing.Net cannot verify the validity of the statements made on this site. Computing.Net and Computing.Net, LLC hereby disclaim all responsibility and liability for the content of Computing.Net and its accuracy.
PLEASE READ THE FULL DISCLAIMER AND LEGAL TERMS BY CLICKING HERE

All content ©1996-2007 Computing.Net, LLC