Copied to clipboard

Flag this post as spam?

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


  • Jason Evans 50 posts 71 karma points
    Oct 01, 2012 @ 13:31
    Jason Evans
    0

    Lucene SearchResult.Fields collection is missing some properties.

    I've got a task where I need to manually add database records for a media image file, which is to appear in an Umbraco site for our client.

    My SQL consists of:

    • Adding a record in umbracoNode for the image.
    • Adding a record in cmsContent
    • Adding a record in cmsContentXml
    • Adding records to cmsPropertyData for the image's umbracoFile, umbracoWidth, umbracoHeight, umbracoBytes, umbracoExtension
    After executing the aobve, and logging into Umbraco, I can see the image in the Media area and all looks fine.
    The problem is the call the @Model.MediaById() (in a Razor file) when I want to display that image - basically no image is displayed since the img 'src' attribute is not set.
    I've stepped through the Umbraco code and found the problem. Basically when the code uses Lucene to search for the media (ExaminedBackendMedia.GetUmbracoMedia()), it does find the image file, however there are a number of fields missing for the SearchResult. For example, none of the "umbraco*" properties adde to cmsPropertyData appear in the fields collection. When I step through the code for another image (one that was added manually) I can see an extra 5 or so properties in the fields collection - including all the "umbraco*" properties.
    So I can see that I have missing data here. Basically the SearchResult object is missing some fields. Can someone suggest what I may have missed please? Why is Lucene not picking up the "umbraco*" properties that I've added via SQL scripts?

  • Jason Evans 50 posts 71 karma points
    Oct 03, 2012 @ 16:01
    Jason Evans
    0

    Someone has suggested an answer, which I tried out and it worked :)

    Basically, right click on the root node in the content pane in Umbraco and choose the "Republish" option. After doing this, my images appeared, so it looks like them issing properties have now been included in the cache.

Please Sign in or register to post replies

Write your reply to:

Draft