SELECT cat.CategoryId
,cat.CategoryImageURL
,cat.CategoryName
,cat.isDeleted
,ap.AppCreatedBy
,ap.AppCreatedOn
,ap.AppDetails
,ap.AppId
,ap.AppImageURL
,ap.AppModifiedBy
,ap.AppModifiedOn
,ap.AppName
,ap.isDeleted
,subcat.SubCategoryId
,subcat.SubCategoryName
,subcat.SubCategoryImageUrl
FROM Category cat
INNER JOIN App ap
ON cat.CategoryID = ap.CategoryID
INNER JOIN SubCategory subcat
ON subcat.SubCategoryId = ap.SubCategoryId
WHERE FREETEXT (
cat.CategoryName
,@searchparameter
)
OR FREETEXT (
subcat.SubCategoryName
,@searchparameter
)
OR FREETEXT (
ap.AppName
,@searchparameter
)
OR CONTAINS (
ap.AppDetails
,@searchparameter
)
OR CONTAINS (
cat.CategoryName
,@searchparameter
)
OR CONTAINS (
subcat.SubCategoryName
,@searchparameter
)
OR CONTAINS (
ap.AppName
,@searchparameter
)
OR CONTAINS (
ap.AppDetails
,@searchparameter
)
USE [AppStore]
GO
DECLARE @return_value INT
EXEC @return_value = [dbo].[IndianAppStore_Search] @searchparameter = N'wishpicker'
SELECT 'Return Value' = @return_value
GO
In the AppName column in App table there is a row which contains wishpicker as an AppName i want to show this result even if the user writes only wish for the search query.
Is that possible with freetext or any other search algo in sql server?
Read up on the LIKE keyword. But in short...
WHERE (ap.AppName LIKE 'wish%') -- Finds app names BEGINNING with wish
WHERE (ap.AppName LIKE '%wish%') -- Finds app names CONTAINING wish
WHERE (ap.AppName LIKE '%wish') -- Finds app names ENDING with wish