Environment details: Sitecore 9.0.2 with Solr and GlassMapper

I am using the method:

  public IEnumerable<TModel> GetAll<TModel>(string query, string language) where TModel : class
            return _service.GetItems<TModel>(new GetItemsByQueryOptions() { Query = Query.New(query), Language = LanguageManager.GetLanguage(language) });

The method calls:

IEnumerable<T> GetItems<T>(GetItemsOptions options) where T : class;

of ISitecoreService of GlassMapper.

Then I check the response for null and get that it is not null.

Query I am using:

/sitecore/content/Global Repository/Regions//*[@@templateid='{28103498-4995-4000-a0db-1d3c2a757c79}' and @@ServiceName=31597]

ServiceName is the name of the field I am looking for value 31597.

Further when I try to get the Count() or Any() on the search result, I never get the response back.

1 Answer 1


I think your code has to be modified a little bit:

  • field names in Sitecore Query should have the only one @ character, the ServiceName field value has to be in quotes and templateid with uppercase A-F letters
/sitecore/content/Global Repository/Regions//*[@@templateid='{28103498-4995-4000-A0DB-1D3C2A757C79}' and @ServiceName='31597']
  • if the items that you expect to read have only shared fields, there is no need to specify a language. You have to set VersionCount to false instead.
return _service.GetItems<TModel>(new GetItemsByQueryOptions() { Query = Query.New(query), VersionCount = false });

Your Answer

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

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