3

I am trying to search on a solr core which contains static data without any Sitecore details.

<doc>
<str name="_property_text">1</str>
<str name="_itemnumber_string">1250000</str>
<str name="_propertykey_string">Black</str>
<doc>

When I try to make a search using the content search manager it will always return an empty result.

var index= ContentSearchManager.GetIndex("index_name");
 using (var ctx = comboIndex.CreateSearchContext()){
     var queryable = ctx.GetQueryable<CustomSearchModel>();
 }
1
  • 4
    Why are you trying to use the Sitecore Search API on a non-Sitecore index? Just use Solr.net.
    – Richard Seal
    Feb 18, 2019 at 16:49

1 Answer 1

1

The field you're missing is going to be _indexname. It will need to be set to the name of the index you are searching, in your case index_name. If you look at the Search.log in the data folder, you will see exactly what query string Sitecore is generating. At the end, you should see that it is generating fq=_indexname:index_name. You can test this by adding the _indexname field to all of your documents and checking if they then get returned.

I believe that this is the only field that Sitecore requires, but there may be others.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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