Calling all developers! We invite you to provide your input on Feature Experimentation by completing this brief survey.
Calling all developers! We invite you to provide your input on Feature Experimentation by completing this brief survey.
Hi,
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.
Hi,
I have pasted my code below:
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
usingSystem.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using EPiServer;using EPiServer.Core;
using EPiServer.DataAbstraction;
using EPiServer.Web.WebControls;
using EPiServer.Find;
namespace EPiServer
{
publicpartialclassFindEPiServer : EPiServer.TemplatePage
{
protectedIClient client = Client.CreateFromConfig();protectedvoid Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
Search();
}
}
protectedvoid Search()
{
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?)
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.
/Rajesh B