In our application, I am trying to implement stopword for various language. We are having country wise core index. One of my search, I am fetching search item using Content, Headline and SearchKeyword fields. Below is my custom search result item model.
public class SiteSearchResultItem: SearchResultItem
{
[IndexField("headline")]
public string HeadLine { get; set; }
[IndexField("searchkeywords")]
public string SearchKeywords { get; set; }
}
Content maps to “Sitecore.ContentSearch.SearchTypes.SearchResultItem” Property. I am building filter using predicate builder as below.
predicate = predicate.Or(p => p.Content.Contains(searchParms.SearchTerm))
.Or(p => p.Content.Equals(searchParms.SearchTerm))
.Or(p => p.HeadLine.Contains(searchParms.SearchTerm).Boost(5f))
.Or(p => p.HeadLine.Equals(searchParms.SearchTerm).Boost(5f))
.Or(p => p.SearchKeywords.Contains(searchParms.SearchTerm))
.Or(p => p.SearchKeywords.Equals(searchParms.SearchTerm));
I am testing stopword for Portuguese language. So, I have added a stopword “estávamos” in corresponding stopword_pt.txt file. While query through solr admin, it’s working fine. Below are the queries, I have tested.
In sitecore, I have create two item which has title and “menu_title” which points to headline in solr field.
Solr Admin Raw Query:
headline_t_pt:estávamos brazil => Providing no data
headline_t_pt:”estávamos brazil” => Providing only Item which has title brazil data
menu_title_t_pt:"estávamos brazil" => Providing only item which has menu title brazil.
Query which passed to solr:
(_content:(estávamos brazil) OR _content:("estávamos brazil") OR headline_t_pt:(estávamos brazil) OR headline_t_pt:("estávamos brazil")) AND _language:(pt-BR)
So, It’s working fine in solr Admin tool. But in my sitecore application, it’s not excluding those data.
And Also I need what are the fields will be in content property in solr sitecore. It's mapping to "_content" solr field?