Copied to clipboard

Flag this post as spam?

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


  • Stephen 'KINK' Wilde 23 posts 94 karma points
    Apr 06, 2015 @ 13:56
    Stephen 'KINK' Wilde
    0

    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 11242 posts 23391 karma points MVP 6x 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.SearchProviderCollectionE372029431E@Umbraco.Field("#DictionaryItemHERE")]; or

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

    Does any of these approaches work?

    /Jan

  • Stephen 'KINK' Wilde 23 posts 94 karma points
    Apr 06, 2015 @ 14:12
    Stephen 'KINK' Wilde
    0

    Jan, thanks for the reply.

    But both throw this exception.

    Compiler Error Message: CS1003: Syntax error, ']' expected
    
  • Jan Skovgaard 11242 posts 23391 karma points MVP 6x 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

  • Stephen 'KINK' Wilde 23 posts 94 karma points
    Apr 06, 2015 @ 14:41
    Stephen 'KINK' Wilde
    0

    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 11242 posts 23391 karma points MVP 6x 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.SearchProviderCollectionE372029431E@Umbraco.Field("#DictionaryItemHERE")]; - Otherwise the expression is interpreted as a string...and you can't have "" inside "".

    Hope this makes sense.

    /Jan

  • Stephen 'KINK' Wilde 23 posts 94 karma points
    Apr 06, 2015 @ 14:48
    Stephen 'KINK' Wilde
    0

    Indeed. Many thanks.

Please Sign in or register to post replies

Write your reply to:

Draft