Hi,
I'm new to fulltext search and am having a problem formulating a query.
I have a table with key, title, description within it. I'm trying to do
a search, but weight results in the title higher than the description.
I've only written this so far.
select [KEY], Rank, listing_id, title FROM FREETEXTTABLE (listing,
title, 'my phrase') F JOIN listing p on p.listing_id=F.[KEY] order by
rank desc
Any help on doing a similar query, but ranking results in title higher
appreciated.
Spondishy,
Could you post back with the full output of the following SQL code as this
is helpful in troubleshooting SQL FTS issues.
use <your_database_name_here>
go
SELECT @.@.language
SELECT @.@.version
sp_configure 'default full-text language'
EXEC sp_help_fulltext_catalogs
EXEC sp_help_fulltext_tables
EXEC sp_help_fulltext_columns
EXEC sp_help <your_FT-enable_table_name_here>
go
Additionally, have you tried using the WEIGHT parameter on the title column?
Review the SQL Server BOL for either CONTAINSTABLE or FREETEXTTABLE for more
info on Weight.
Thanks,
John
SQL Full Text Search Blog
http://spaces.msn.com/members/jtkane/
"Spondishy" <spondishy@.tiscali.co.uk> wrote in message
news:1131363042.622970.188750@.g14g2000cwa.googlegr oups.com...
> Hi,
> I'm new to fulltext search and am having a problem formulating a query.
> I have a table with key, title, description within it. I'm trying to do
> a search, but weight results in the title higher than the description.
> I've only written this so far.
> select [KEY], Rank, listing_id, title FROM FREETEXTTABLE (listing,
> title, 'my phrase') F JOIN listing p on p.listing_id=F.[KEY] order by
> rank desc
> Any help on doing a similar query, but ranking results in title higher
> appreciated.
>
|||I'd try something like this
CREATE TABLE HTML
(pk int not null identity CONSTRAINT htmlPK PRIMARY KEY,
TITLE Varchar(20),
DESCRIPTION Varchar(20)
)
INSERT INTO HTML(TITLE, DESCRIPTION) VALUES('this is a test','this is a
test')
INSERT INTO HTML(TITLE, DESCRIPTION) VALUES('test','test')
INSERT INTO HTML(TITLE, DESCRIPTION) VALUES('nada','test')
INSERT INTO HTML(TITLE, DESCRIPTION) VALUES('test','nada')
INSERT INTO HTML(TITLE, DESCRIPTION) VALUES('test nada','nada test')
INSERT INTO HTML(TITLE, DESCRIPTION) VALUES('test test','test test')
INSERT INTO HTML(TITLE, DESCRIPTION) VALUES('test','test test test test')
exec sp_fulltext_catalog N'test', N'create'
GO
exec sp_fulltext_table N'[dbo].[HTML]', N'create', N'test', N'htmlPK'
GO
exec sp_fulltext_column N'[dbo].[HTML]', N'TITLE', N'add', 1033
GO
exec sp_fulltext_column N'[dbo].[HTML]', N'DESCRIPTION', N'add', 1033
GO
exec sp_fulltext_table N'[dbo].[HTML]', N'activate'
GO
sp_fulltext_catalog 'test','start_Full'
SELECT pk, TITLE, DESCRIPTION, TITLE.RANK, DESCRIPTION.RANK FROM HTML
JOIN (SELECT * FROM CONTAINSTABLE(HTML, DESCRIPTION,'test')) AS DESCRIPTION
ON DESCRIPTION.[KEY]=HTML.PK
JOIN (SELECT * FROM CONTAINSTABLE(HTML, TITLE,'test')) AS TITLE ON
TITLE.[KEY]=HTML.PK
ORDER BY TITLE.[RANK] DESC, DESCRIPTION.RANK DESC
Hilary Cotter
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com
"Spondishy" <spondishy@.tiscali.co.uk> wrote in message
news:1131363042.622970.188750@.g14g2000cwa.googlegr oups.com...
> Hi,
> I'm new to fulltext search and am having a problem formulating a query.
> I have a table with key, title, description within it. I'm trying to do
> a search, but weight results in the title higher than the description.
> I've only written this so far.
> select [KEY], Rank, listing_id, title FROM FREETEXTTABLE (listing,
> title, 'my phrase') F JOIN listing p on p.listing_id=F.[KEY] order by
> rank desc
> Any help on doing a similar query, but ranking results in title higher
> appreciated.
>
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment