Skip to content Skip to sidebar Skip to footer

What Is The SQL Used To Do A Search Similar To "Related Questions" On Stackoverflow

I am trying to implement a feature similar to the 'Related Questions' on Stackoverflow. How do I go about writing the SQL statement that will search the Title and Summary field of

Solution 1:

Check out this podcast.

One of our major performance optimizations for the “related questions” query is removing the top 10,000 most common English dictionary words (as determined by Google search) before submitting the query to the SQL Server 2008 full text engine. It’s shocking how little is left of most posts once you remove the top 10k English dictionary words. This helps limit and narrow the returned results, which makes the query dramatically faster.


Solution 2:

They probably relate based on tags that are added to the questions...


Solution 3:

After enabling Full Text search on my SQL 2005 server, I am using the following stored procedure to search for text.

ALTER PROCEDURE [dbo].[GetSimilarIssues] 
(
 @InputSearch varchar(255)
)
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;

DECLARE @SearchText varchar(500);

SELECT @SearchText = '"' + @InputSearch + '*"'

SELECT  PostId, Summary, [Description], 
Created
FROM Issue

WHERE FREETEXT (Summary, @SearchText);
END

Solution 4:

I'm pretty sure it would be most efficient to implement the feature based on the tags associated with each post.


Solution 5:

It's probably done using a full text search which matches like words/phrases. I've used it in MySQL and SQL Server with decent success with out of the box functionality.

You can find more on MySQL full text searches at:

http://dev.mysql.com/doc/refman/5.1/en/fulltext-search.html

Or just google Full Text search and you will find a lot of information.


Post a Comment for "What Is The SQL Used To Do A Search Similar To "Related Questions" On Stackoverflow"