Re: search error
- From: "Hilary Cotter" <hilary.cotter@xxxxxxxxx>
- Date: 18 Apr 2005 13:00:33 -0700
have a look at this link. It is some javascript in an html page which
will remove the noise words.
Then you would have to execute a proc like this one. If you pass it a
parameter of 1 it will do what you are looking for
searchsql1 'test test1 test2',2
CREATE procedure SearchSQL1 (@stringin varchar(200), @BooleanType int=
NULL)
as
-- a @boolean type of null means a phrase based search
-- a @boolean type of 1 means an OR type search
-- a @boolean type of 2 means an AND type search
declare @holdingString varchar(2000)
declare @whitespace int
declare @boolean varchar(10)
set @boolean=case when @booleantype is null then ' ' when
@booleantype=1
then char(34)+' OR ' + char(34) else char(34)+' AND '+char(34) end
declare @counter int
declare @posold int
declare @posnew int
set @holdingstring='select * from authors where contains(*,'''+char(34)
select @whitespace=len(@stringin) - len(replace(@stringin,' ',''))
select @posold=0
select @posnew=Charindex(' ',@stringin)
while @whitespace >=0
begin
if @whitespace=0
begin
select @holdingString=@holdingString+substring(@stringin,@posold+1,
len(@stringin)-@posold+1)+char(34)+char(39)+')'
end
else
begin
select @holdingString = case when len(substring(@stringin,@posold+1,
@posnew-@posold-1))>0 then
@holdingString+substring(@stringin,@posold+1,
@posnew-@posold-1)+@boolean else @holdingstring end
select @posold=@posnew, @posnew=Charindex(' ',@stringin, @posold+1)
end
select @whitespace=@whitespace-1
end
print @holdingstring
exec(@holdingstring)
return @@rowcount
.
- Follow-Ups:
- Re: search error
- From: tshad
- Re: search error
- References:
- search error
- From: tshad
- Re: search error
- From: John Kane
- Re: search error
- From: tshad
- search error
- Prev by Date: Re: search error
- Next by Date: Re: search error
- Previous by thread: Re: search error
- Next by thread: Re: search error
- Index(es):
Relevant Pages
|
Loading