Copied to clipboard

Flag this post as spam?

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


  • Josef Henryson 24 posts 98 karma points
    May 18, 2021 @ 16:21
    Josef Henryson
    0

    Search grid components with Examine

    We are using examine to search our content. When I search the index in the search tool under Examine Management I can see that a specific query is found in grid components. But in my code where I try to get results from the search provider, it gives me nothing for content based in a grid. I get hits for other properties in standard pages.

    _searcher = ExamineManager.Instance.SearchProviderCollection[$"{searcherName}-Searcher"]; (I checked that searcherName is correct)

    var searchCriteria2 = searcher.CreateSearchCriteria(); _query = searchCriteria2.GroupedOr(new string[] { "nodeName", "heading", "title", "shortDescription", "mainBody", "grid", "grid.Standard Row", "grid.Project Row" }, _searchstring.MultipleCharacterWildcard()).And().Field("nodeTypeAlias", "componentService").Compile(); var results = _searcher.Search(query);

    I added "grid.Standard Row" & "grid.Project Row" to existing code to see if that would help. But it did not and in the index it seems like those only contain IDs.

    Should I add some other keyword to the "properties list"? Or is there some other way to solve this?

    Thank you in advance for any guidance!

  • Søren Gregersen 441 posts 1884 karma points MVP 2x c-trib
    May 18, 2021 @ 20:55
    Søren Gregersen
    0

    Hi Josef,

    If you look at index under the settings tab, you can look at was in in the result from the index (just search for the id of the page).

    The content of the grid controls are just the content you input - the full text of an RTE, the value of a string field etc. If you pick an image, only the id is stored.

    If you need to expand the text, you may find some inspiration from this old gist : https://gist.github.com/abjerner/bdd89e0788d274ec5a33

    HTH :)

  • Josef Henryson 24 posts 98 karma points
    May 26, 2021 @ 06:35
    Josef Henryson
    0

    Hi Søren and thanks for your reply.

    Sorry for my late answer. Just before I read your reply, I realized that the problem for us was using the search criteria in the wrong way.

    But your code looks interesting, and if we don't get the result we want, I might do something like that to improve our search.

    Cheers, Josef

  • Josef Henryson 24 posts 98 karma points
    May 26, 2021 @ 08:57
    Josef Henryson
    0

    When I inspect my index and search for 'utveckling' I get these hits of the exact same page type (componentpage). But the first one shows the property '_Rawgrid' instead of 'grid' as in the other hit. And the property 'grid' refers to 2 numbers. I can't see the difference between these two, and it seems like this affect my search results as well. Any idea why this is so?

    Index of grid components

  • micke911 5 posts 35 karma points
    Sep 02, 2021 @ 12:45
    micke911
    0

    Another late reply.

    I think that you need to escape spaces in field names in queries. grid.Project Row should be grid.Project\ Row

    At least when running a query in "Examine management" tab in the back office.

  • Josef Henryson 24 posts 98 karma points
    Sep 02, 2021 @ 13:39
    Josef Henryson
    0

    Thank you, I will try to add that to my code and verify in next release.

Please Sign in or register to post replies

Write your reply to:

Draft