Copied to clipboard

Flag this post as spam?

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


  • Ran Chen 40 posts 117 karma points
    Feb 23, 2015 @ 16:51
    Ran Chen
    0

    Searching page content or Grid TextPage (Umbraco 7.2)

    Hi there,

    I've found an example for implementing search on Umbraco using this code

    https://gist.github.com/carlosmartinezt/fba2e880f5c3e7d2cccd

    ...
    var searcher = ExamineManager.Instance;
    var searchCriteria = searcher.CreateSearchCriteria();
    var query = searchCriteria.GroupedOr(new[] { "nodeName", "name", "title", "bodyText", "eventDetails", "subtitle", "location", "newShortText", "newsLongText", "description", "seo" }, searchTerm).Compile();
    var searchResults = searcher.Search(query).Where(r => r["__IndexType"] == "content").ToList()
    ...

    However, I did not manage to find a way how to search the page textual content.

    There is a property named Conent of type Grid TextPage which contains most of the textual content of the page.
    The problem that its data is stored in json format and contains also images and other html not relevant content.

    I would like to retrieve the text only version of this Grid TextPage so I could also search within the page and not just the fields mentioned above (name , title, bodyText...)

    Any idea ?

     

  • Jeroen Breuer 4908 posts 12265 karma points MVP 5x admin c-trib
    Feb 24, 2015 @ 12:57
    Jeroen Breuer
    0

    Hello,

    This example might help: https://gist.github.com/abjerner/bdd89e0788d274ec5a33

    Jeroen

Please Sign in or register to post replies

Write your reply to:

Draft