Copied to clipboard

Flag this post as spam?

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


  • Rasmus Lynggaard 118 posts 325 karma points
    Apr 17, 2012 @ 16:27
    Rasmus Lynggaard
    0

    Examine fields.add working same way as lucene?

    I'm trying to add tags to a node through Examine.

    I'm using the GatheringNodeDataEvent and looping through the tags on the node. Instead of just a comma seperated list, I would like to add each tag as its own value on a field.

    In Lucene I would do like this:

    foreach (var tagId in tagIds)
    {
    var tag = new Node(Convert.ToInt32(tagId));
    d.Add(new Field("Tag", tag.Name, Field.Store.YES, Field.Index.ANALYZED, Field.TermVector.YES));
    }

    Where d i s my Lucene document. This works and adds several fields called Tag with different values on the document.

    I've tried to do it like this:

    foreach (var tagNode in tagNodes)
    {
    e.Field.Fields.Add("tag", tagNode.GetProperty("title").Value);
    }

    This gives me the follwing error:
    "An item with the same key has already been added."

    Do anybody have an idea on how to accomplish this through Examine?

Please Sign in or register to post replies

Write your reply to:

Draft