Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Answered

lookup search not returning expected results

(0) ShareShare
ReportReport
Posted on by 70

Hi Techies,

We are facing a similar problem to the one discussed in the below link
https://community.dynamics.com/crm/f/microsoft-dynamics-crm-forum/179854/lookup-records-with-search-criteria-is-not-working-in-mscrm-2015/444140

We are on Dynamics CRM 2015 On-premises with UR 0.3.
The search in the lookup works in all environments except the Production.

The lookup column points to the view "Product Family Lookup View".
When the user searches for keyword in the lookup not all elements are shown in the production environment.

The view on the whole works fine. When we don't use keyword search in the lookup we can see all the Items.

We tried comparing the data in the ProductBase in INTEGRATION & PRODUCTION and they are identical.

We tried querying using "Advanced Search" with the same keyword and we get the correct result. We get the correct result from FetchXML. We get the correct result when querying the database with a simple SQL query with LIKE predicate.

We profiled the SQL Query that's used to Filter the lookup using SQL server profiler and we got the below query. 

WITH __QuickFind__ as (select top 10001 [ProductId] from (
SELECT "BDL".[ObjectId] AS [ProductId] FROM [BusinessDataLocalizedLabelBase] AS "BDL" WITH (NOLOCK)
where (
contains("BDL".Label, '((("GEODE*" OR FORMSOF(FREETEXT, "GEODE"))) OR ("GEODE"))') and "BDL".LanguageId in (1036) 
and "BDL".ObjectColumnNumber = 6 and "BDL".ObjectIdTypeCode = 1024)) as [__QuickFindInternal__])select 
top 12 coalesce("LL0".Label,"product0".Name ) as "name"
, "product0".HierarchyPath as "hierarchypath"
, "product0".StateCode as "statecode"
, "product0".ProductStructure as "productstructure"
, "product0".ProductId as "productid"
, "product0".ProductTypeCode as "producttypecode"
, case when (select COUNT(*) from [__QuickFind__]) = 10001 then 1 else 0 end as [__QuickFindLimitValue__] 
from
ProductBase as "product0" WITH (NOLOCK) 
left outer join BusinessDataLocalizedLabel as "LL0" on 
("LL0".ObjectId = "product0".ProductId and "LL0".LanguageId = 1036 and "LL0".ObjectColumnNumber = 6 ) 
where
[product0].[ProductId] in (select [ProductId] from [__QuickFind__]) and (((("product0".StateCode = 0 and (("product0".ProductStructure = 2)))))) order by
name asc,"product0".ProductId asc

On executing the profiled query directly on the production database  we are able to simulate the same issue. The query didn't return all the expected records. In the above query we noticed that full-text search feature of SQL server is being used. 

Will rebuilding the free-text catalog help our cause? 
What are the other things that we need to verify? 
Thanks in advance.

Regards,
Clement


  • Verified answer
    David Jennaway Profile Picture
    David Jennaway 14,063 on at
    RE: lookup search not returning expected results

    It does look like the issue is with the full-text index in SQL Server, so I'd suggest rebuilding the free-text catalog as the first step

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,516 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,436 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans