Find to include files and documents

Vote:
 

Hi,

My question is related to episerver CMS6 R2 version.

I am doing a FIND search on my base pagetype and adding pdf/words/jpg documents as a separate file type in the search

using IncludeType and projecting the results.

It brings the result as I expected with only one exception.

There is a file that I have with the name "Sarah.pdf".

If I type only Sarah it never brings the file results in it but only pages. And, if I type Sarah.pdf, it brings the results i.e only that file. What I want is, if i type Sarah, it should bring me all files and pages starts with SARAH which it is not doing. I do have a wildcardquery extension added to it.

Here is my code:-

 var query = SearchClient.Instance.Search()
                .For(queryText)
                .WildCardQuery(queryText, x=>x.PageName)
                .Skip((PageNumber - 1) * ResultsPerPage)
                .Track()
                .Take(ResultsPerPage);

 var result = query.Select(x => new FindSearchCommon.SearchHit
            {
                Title = x.PageName,
                Url = x.LinkURL(),
                Text = x.BodyContent.AsHighlighted(new HighlightSpec { NumberOfFragments = 2, FragmentSize = 200 }),
                CategoryInt = x.CategoryList,
                PageType = x.PageTypeName,
                PageList = x.PageaHierarchyList,
                PublishedDate = x.SearchPublishDate()

            })
            .IncludeType(x => new FindSearchCommon.SearchHit
            {
                Title = x.Name,               
                Url = x.PermanentLinkVirtualPath,
                PublishedDate = x.SearchPublishDate(),

            }).GetResult();

If I expliclity add .WildCardQuery(queryText, x=>x.Name)  it gives error, because only it includes the base pagetype properties in it and not the document x.Name in it.

What is that I am missing? If please someone can help.

I am not doing any filtering in the code.

Many thanks in advance

#89222
Aug 11, 2014 18:16
Vote:
 

I would recommend using UnifiedSearch() if you want to mix UnifiedFiles and Pages in your result.

#116242
Jan 27, 2015 8:40
* 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.