Copied to clipboard

Flag this post as spam?

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


  • Mike Driscoll 10 posts 81 karma points
    Apr 05, 2021 @ 17:12
    Mike Driscoll
    0

    Search Umbraco Form Responses

    This may be a simple question, but I have not found a solution in these forums yet...

    I see that after configuring Umbraco Forms, a search index was created called UmbracoFormsRecordIndex. I already have a search working that seems to be using the "ExternalIndex" (this came with my UnSkinned theme). Where in the templates/code/configuration can I look to change it so it searches against the UmbracoFormsRecordIndex rather than the ExternalIndex?

    Thanks! md

  • Alex Skrypnyk 6163 posts 24143 karma points MVP 8x admin c-trib
    Apr 05, 2021 @ 20:34
    Alex Skrypnyk
    0

    Hi Mike

    What search do you want to use UmbracoFormsRecordIndex?

    Is it a custom search or search in the Umbraco backend?

    If it's a custom one you can easily use the needed index.

    Thanks,

    Alex

  • Mike Driscoll 10 posts 81 karma points
    Apr 07, 2021 @ 18:08
    Mike Driscoll
    0

    I believe it would be a custom search? The theme I installed has a search on the front end that currently uses the ExternalIndex to search page content. I would like to override that search and return results from the UmbracoFormsRecordIndex.

    I found the partial view that seems to control the results, and found this line:

    ExamineManager.Instance.TryGetIndex(Constants.UmbracoIndexes.ExternalIndexName, out IIndex index)

    Would it be as simple as swapping out that ExternalIndexName with the form's index? I guess I can't find where the Constants are coming from.

    Thanks! md

  • Mike Driscoll 10 posts 81 karma points
    Apr 13, 2021 @ 15:50
    Mike Driscoll
    0

    I think I'm on the right track, but I n eed to figure out what "Category" needs to be passed in to the CreateQuery method. "Content" works for the ExternalIndex, but it must be something else for form results.

    Here is some of my code:

    if (!String.IsNullOrEmpty(searchTerm) && ExamineManager.Instance.TryGetIndex("UmbracoFormsRecordsIndex", out IIndex index))
            {
                var searcher = index.GetSearcher();
    
                var criteria = searcher.CreateQuery("content", BooleanOperation.And) ...
    
Please Sign in or register to post replies

Write your reply to:

Draft