Copied to clipboard

Flag this post as spam?

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


  • Jesus Mirabal 8 posts 78 karma points
    Dec 16, 2016 @ 15:56
    Jesus Mirabal
    0

    Merchello product search through User Fields

    Hello, I'm fairly new to Umbraco and pretty much taking my first steps with it. I'm currently testing the search capabilities for a potential ecommerce implementation based on the Merchello package.

    The versions I'm using are

    • Umbraco v7.5.4 (assembly 1.0.6136.27241)
    • Merchello v2.3.1

    Just put together a very simple "search by Product" implementation where I'm trying to retrieve all the products that match a user given text. I want the search to retrieve back all Products in which the text was found in any of its fields. Here's what I'm doing (sorting by score)

    <div class="row">
    @{
        var searchQuery = Request.QueryString["query"];
    
        if (!string.IsNullOrEmpty(searchQuery))
        {
    
            var Searcher = Examine.ExamineManager.Instance.SearchProviderCollection["MerchelloProductSearcher"];
            var productResults = Searcher.Search(searchQuery, true).OrderByDescending(x => x.Score);
            var merchelloHelper = new MerchelloHelper();
    
            <div class="searchresults">
                <p><strong>@productResults.Count().ToString()</strong> Products were found for <strong>@searchQuery</strong></p>
    
                <ul>
                    @foreach (var prodResult in productResults)
                    {
                        var node = merchelloHelper.TypedProductContent(new Guid(prodResult.Fields["productKey"]));
                        <li>
                            <a href="@node.Url">@node.Name</a>
                        </li>
                    }
                </ul>
            </div>
        }
    }
    

    My problem is that this works only for the Product system fields (searches fine through product name, etc.). However, this will not retrieve matches for the User Fields. I see the User Fields properly indexed as detachedContents when I try the lucene search in the Examine Management UI. What do I have to do so that my code retrieves matches for those fields as well?

    Any help is appreciated!

    Thanks,

    J. Mirabal

  • Jesus Mirabal 8 posts 78 karma points
    Dec 19, 2016 @ 23:19
    Jesus Mirabal
    0

    I was doing more research and found out that actual values for all User Fields are stored in the same field, an ntext field named values in the table merchProductVariantDetachedContent. Why is the Product Searcher not looking through this field that seems to be properly indexed in the Lucene index?

  • Cristovao 12 posts 33 karma points
    Oct 13, 2017 @ 08:39
    Cristovao
    0

    Hi All,

    Did you find a solution for this? I also want to add fields from detached content on the MerchelloProductIndexSet. I realized that even the "modelNumber" field is not indexed (or at least I am not able to search on this field, dispite it exists on the IndexAttributeFields). I would like to add ModelNumber field and other fields from my detachedContent.

    From some Google search I realized that we can hook GatheringNodeData event from the ExamineManager. But I still working on that.. I am on the right path?

    I am using Merchello 2.4

Please Sign in or register to post replies

Write your reply to:

Draft