I'm working on to implement the Free-Text-Search in my EPiServer 6R2 site. I have downloaded the latest Find.EPiServer dlls - EPiServer.Find, EPiServer.Find.CMS, EPiServer.Find.Framework and Newtonsoft.Json from "http://world.episerver.com/Download/Items/EPiServer-Find/EPiServer-Find-1-R2/" and referenced the same in my solution.I have gone through the samples in mentioned http://find.episerver.com/Documentation/dotnet-api-free-text-search. However, I believe that all these methods can be implemented only when the Page Types are created through Page-Builder. When we want to search through pages that are created through admin mode, we got to use the method ".InField(x => x.SearchText())", so that the fields that are marked as searchable can be queried upon. However, I not able to find the x.SearchText() method under "EPiServer.Find" namespace. Can any one let me know the namespace that I need to add in order to find the SearchText method. Also I would like to know the options available to implement the Free-Text-Search for pages of Page Types that are created through admin mode. Thank you.
SearchText is an extension method for PageData and you can do InField(x => x.SearchText()) IF you are searching for PageData, ie:
SearchClient.Instance.Search<PageData>().For("something").InField(x => x.SearchText()) //x is of type PageData.GetPagesResult();
If you can't get it to work, please paste your code here.
I have pasted my code below:
using EPiServer;using EPiServer.Core;
publicpartialclassFindEPiServer : EPiServer.TemplatePage
protectedIClient client = Client.CreateFromConfig();protectedvoid Page_Load(object sender, EventArgs e)
var result = client.Search<PageData>().For("about-us").InField(x => x.SearchText()).GetResult();
However, on compiling I get the following error:
'EPiServer.Core.PageData' does not contain a definition for 'SearchText' and no extension method 'SearchText' accepting a first argument of type 'EPiServer.Core.PageData' could be found (are you missing a using directive or an assembly reference?)
You're missing a using statement:
Also, instead of Client.CreateFromConfig, use SearchClient.Instance.
Read more on the EPiServer/CMS integration here.
I have "EPiServer.Find.Cms" now and the following query returns the results:
var result = SearchClient.Instance.Search<PageData>().For(Query).InField(x => x.SearchText()).GetResult()
Thank you for your help.