I am using full-text search, its working fine on a direct column of table but not on a derived/aliased column.
SELECT ExpectationId
,ExpectationName
,(
CASE
WHEN ExpectationOrganization_OrganizationId IS NOT NULL
THEN (
SELECT OrganizationName
FROM Organizations
WHERE OrganizationId = ExpectationOrganization_OrganizationId
)
WHEN ExpectationBeneficiary_BeneficiaryId IS NOT NULL
THEN (
SELECT BeneficiaryName
FROM Beneficiaries
WHERE BeneficiaryId = ExpectationBeneficiary_BeneficiaryId
)
ELSE (
SELECT TeamName
FROM Teams
WHERE TeamId = ExpectationTeam_TeamId
)
END
) AS ParentName
FROM Expectations
WHERE
FREETEXT(ExpectationName, @Keyword) ---Working
OR FREETEXT(ParentName, @Keyword) ---Not working
All these columns ExpectationName
, OrganizationName
, BeneficiaryName
, TeamName
are full-text indexed.
How can I make it work for ParentName
column?