2

What is _content in SOLR. While mapping through Sitecore, what are the fields will it map?

Is it good practice to use Content property in search query builder? In that case, How will it work in solr stopword functionality language wise? Or We need to use specific property to search.

If not, how to achieve language wise _content mapping?

namespace Sitecore.ContentSearch.SearchTypes
{
    public class SearchResultItem : ISearchResult, IObjectIndexers
    {
        [IndexField("_content")]
        public virtual string Content { get; set; }
    }

}

1 Answer 1

3

When your Sitecore application is configured to use Solr, default configuration contains _content field which is a computed field using MediaItemContentExtractor to populate its value.

It uses mediaIndexing configuration to determine which mime types and extensions should be indexed and indexes their content.

From what I know, when you upload new media item to media library, Sitecore creates unversioned media item with a version in every language version there is defined in Sitecore.

That said, I don't think it's a good idea to use _content computed field. If you upload EN document to media library, it will create a version of that document for every single language defined in Sitecore and while indexing it won't care about EN stopwords when other language version document will be created in Solr.

There is a setting in Sitecore which allows to upload items as versionable by default:

<setting name="Media.UploadAsVersionableByDefault" value="false"/>

but it's disabled in vanilla Sitecore apps.


EDIT:

You're right. There is hardcoded functionality in LuceneDocumentBuilder (I there is similar in Solr but I cannot confirm it now) which adds value of all text fields ("Single-Line Text", "Rich Text", "Multi-Line Text", "text", "rich text", "html", "memo", "Word Document") to the _content field.

I might be wrong here but from what I remember all the fields starting with _ in their names are considered as "internal" fields and there are no language specific. If I'm right here, there would be no option to use language specific stopwords for _content.

2
  • But i think _content field indexes the full content of the website. Can you please tell me _content maps what are fields in sitecore item? We are using Content in predicate query builder. But it's creating *_t_pt or *_t_en like that. So it's point to corresponding stopword_pt or stopword_en txt file.But content points to stopword.txt. How to make content also language wise? thanks in advance Jun 1, 2017 at 10:20
  • See edited answer
    – Marek Musielak
    Jun 1, 2017 at 10:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.