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

Free text search

Vote:
 

Hi,

 

I use the following code to search data

var pages = client.Search<PageData>()
.For(model.SearchText)
.InAllField()
.GetPagesResult();

One page contains word 'Chicken' in XhtmlString property.

Data is indexed and this word is in the index.

If I'm looking through 'Explore Index' (application/Find/IndexOverview/Explore) then I got this page in results.

 

Why sometimes the code shown above does not find this page?

 

I hope for your help.

#85354
Apr 23, 2014 16:09
Vote:
 

Exactly what are you searching for, is it Chicken?

Looking at the question I am thinking that you should use UnifiedSearch instead of Search, since you are searching all pagedata in all fields. You should also try to use SearchClient.Instance instead of an instans of client since there are a lot of conversions that you might missing.
To write the question you do with UnifiedSearch it should be:
SearchClient.Instance.UnifiedSearchFor(model.SearchText).GetResult();

That will not give you back Pagedata, but it is not hard to convert it, see more info here:
http://world.episerver.com/Documentation/Items/Developers-Guide/EPiServer-Find/75/DotNET-Client-API/Searching/Unified-search/

#85357
Apr 23, 2014 16:45
Vote:
 

Hi Henrik,

I try the proposed version, but I can not get the link to the page (ContentReference) or IContent.

What better way to get IContent data from UnifiedSearchHit?

Thanks

#85387
Edited, Apr 24, 2014 9:37
Vote:
 

If your using the UnifiedSearch you should be getting a ISearchContent back, so unless your doing some projections you should have a SearchHitUrl property. Does this not exist?

#85388
Apr 24, 2014 9:50
Vote:
 

I have following "/en/recipe-listing/resipe-3/product-1/" but I need ContentReference.

#85389
Edited, Apr 24, 2014 9:57
Vote:
 

UnifiedSearch does not give back a contentReference because it can return files and so on (maby the latest version do, I have not tried that). So if you need that, you have to do a extension method that get the content by the url.

#85391
Apr 24, 2014 10:02
Vote:
 

Read Joels good article on this:

http://joelabrahamsson.com/new-in-episerver-find-unified-search/

#85392
Apr 24, 2014 10:10
Vote:
 

Thanks for your help and for what you sent me in the right direction

#85438
Apr 25, 2014 9:36
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* 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.