November Happy Hour will be moved to Thursday December 5th.
November Happy Hour will be moved to Thursday December 5th.
1. See: http://world.episerver.com/Documentation/Items/Developers-Guide/EPiServer-Find1/75/DotNET-Client-API/Searching/Languages/
for specifying language stemming rules.
2. I don't understand the question, can you specify what you want to achieve?
/Henrik
1. looks like didn't work
2. if i search for "product" i want to get text around the word "product" from page, like:
In marketing, a product is anything that can be offered to a market that might satisfy a want or need. In retailing
3. Also is there way to search only in page content, because if i search for "product" and my page like:
<div class="product">some text of page</div>
it will appear in search results
If you mean by the first question that you like to have a starsearch (product*) then you have to build a extensionmethod like this one:
public static class SearchExtensions
{
public static IQueriedSearch<ISearchContent> UnifiedSearchGraspingRightHandTruncationFor(this IClient client, string query, Language language)
{
language = language ?? Language.None;
return client.Search<ISearchContent>(language).GraspingRightHandTruncationFor<ISearchContent>(query).WithAndAsDefaultOperator().InAllField();
}
public static IQueriedSearch<TSource, QueryStringQuery> GraspingRightHandTruncationFor<TSource>(this ITypeSearch<TSource> search, string queryString)
{
if (search == null)
{
throw new ArgumentNullException("search");
}
var str = (string.IsNullOrWhiteSpace(queryString) ? "" : queryString);
str += !str.Contains("\"") ? "*" : "";
return new Search<TSource, QueryStringQuery>(search, (ISearchContext context) =>
{
var queryStringQuery = new QueryStringQuery(str);
context.RequestBody.Query = queryStringQuery;
});
}
}
2: if you are using unified search you use [hit].Document.Excerpt, a good example by Ted on how to do that you can find here:
http://tedgustaf.com/blog/2013/10/highlight-query-matches-in-episerver-find-search-results/
3: Don't know, I guess that you are using xhtml there and the div.. are accually in the text of that property.
Important, when update to EPiServer Find 8 you have to change the codeExample I showed, to this:
public static IQueriedSearch GraspingRightHandTruncationFor(this ITypeSearch search, string queryString)
{
if (search == null)
{
throw new ArgumentNullException("search");
}
var str = (string.IsNullOrWhiteSpace(queryString) ? "" : queryString);
str += !str.Contains("\"") ? "*" : "";
return new Search(search, (ISearchContext context) =>
{
var queryStringQuery = new QueryStringQuery(str);
queryStringQuery.RawQuery = queryString;
var queryStringQuery1 = queryStringQuery;
context.RequestBody.Query = queryStringQuery1;
});
}
Otherwise there will not register any statistics with the search.
1. is there way if i search for "product" i will see results also for "products", "producting" and so on
2. is there way to get text around search key "product"
code: SearchClient.Instance.Search<IContent>().For(terms.SearchKey)