November Happy Hour will be moved to Thursday December 5th.

Search and Navigation Searching on URL field

Vote:
 

I want to stop Search and Navigation from searching on the URL field of the index, as right now, if you search for the site name (which is part of the domain name), it returns every page in the index, which is not the desired effect.

My site domain is for example acme-group.com, so any search for "acme group" or just "group" returns every page in the index, as all of them have a "SearchHitUrl" field with the domain name in it.

I have checked specific results JSON in the CMS, and the only instance of the word "acme" and/or "group" is in the URL field.

I have tried setting some Search conventions, clearing the index, and rebuilding, but I keep getting the same results.

        SearchClient.Instance.Conventions
            .ForInstancesOf<ISearchContent>()
            .ExcludeField(i => i.SearchHitUrl);

or

        SearchClient.Instance.Conventions.ForInstancesOf<BaseContentPage>()
            .ExcludeField(i => i.URLSegment)
            .ExcludeField(i => i.ExternalURL)
            .ExcludeField(i => i.LinkURL)
            .ExcludeField(i => i.StaticLinkURL)
            .ExcludeField(i => i.StaticLinkURL)
            .ExcludeField(i => (i as ISearchContent).SearchHitUrl)
            .ExcludeField("SearchHitUrl");

I am guessing I can't fully exclude this field, as otherwise, you would not be able to link to a result, but I just don't want to search upon that field.

My search query is currently:

  var query = _client.Search<BaseContentPage>(_contentLanguageAccessor.Language.GetLanguage())
            .For(model.SearchText)
            .InAllField(); 
#312232
Nov 09, 2023 8:33
Vote:
 

Could you look into the Find UI to see what is in the index of the content? In what field contains the "group" thing that you can spot? 

#312235
Nov 09, 2023 10:58
Vote:
 

Hi Quan,

Thanks for the reply.
Yes, I checked the FInd UI/Search & Navigation part of the CMS.
I loaded an example page and searched the content. the only occurrence of "group" appears in the SearchHitUrl field.

#312237
Edited, Nov 09, 2023 11:14
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.