Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Topic author was deleted

    Apr 06, 2015 @ 13:56

    Why can't I get a dictionary item into here?

    Hi Guys,

    I am trying to get a dictionarty item into my variable, however I can't seem to get it working.

    var Searcher = Examine.ExamineManager.Instance.SearchProviderCollection["DictionaryItemHERE"];
    

    Could some please suggest how to get this working? or even using an Umbraco Document Type Field would suffice.

    Many thanks, kind regards - Stephen

  • Jan Skovgaard 11258 posts 23500 karma points MVP 7x admin c-trib
    Apr 06, 2015 @ 14:01
    Jan Skovgaard
    100

    Hi Stephen

    I have not tried this myself but perhaps either using

    var Searcher = Examine.ExamineManager.Instance.SearchProviderCollection[@Umbraco.Field("#DictionaryItemHERE")]; or

    var Searcher = Examine.ExamineManager.Instance.SearchProviderCollection[@Umbraco.GetDictionaryValue("DictionaryItemHERE")];
    

    Does any of these approaches work?

    /Jan

  • Comment author was deleted

    Apr 06, 2015 @ 14:12

    Jan, thanks for the reply.

    But both throw this exception.

    Compiler Error Message: CS1003: Syntax error, ']' expected
    
  • Jan Skovgaard 11258 posts 23500 karma points MVP 7x admin c-trib
    Apr 06, 2015 @ 14:36
    Jan Skovgaard
    0

    Hi Stephen

    Hmm, did you miss the closing ] when copying over the example? What does your exact code look like?

    /Jan

  • Comment author was deleted

    Apr 06, 2015 @ 14:41

    Meh - Don't worry - I figured out my problem.

    I kept in the original quotation marks inside the [].

    Many thanks for the help Jan.

  • Jan Skovgaard 11258 posts 23500 karma points MVP 7x admin c-trib
    Apr 06, 2015 @ 14:43
    Jan Skovgaard
    0

    Hi Stephen

    Yeah it's closed...but you're wrapping the expression in "" - Those gotta go :)

    This is what your variable looks like var Searcher = Examine.ExamineManager.Instance.SearchProviderCollection["@Umbraco.Field("#DictionaryItemHERE")"];

    It should look like this var Searcher = Examine.ExamineManager.Instance.SearchProviderCollection[@Umbraco.Field("#DictionaryItemHERE")]; - Otherwise the expression is interpreted as a string...and you can't have "" inside "".

    Hope this makes sense.

    /Jan

  • Comment author was deleted

    Apr 06, 2015 @ 14:48

    Indeed. Many thanks.

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies