I followed the Exemplary Usage Instructions on the project page.
It works, the extracted tags are added to the node's field (node:field_tags in my case), but any existing tags in that field are erased!
How can i modify the rule so that extracted tags are added to the field/list with existing tags?
I prefer not to create another separate field for the extracted tags.

Thanks

Comments

dasjo’s picture

Title: Rules Autotag: the action set (Autotag to terms list) erases existing tags » Add extracted tags to populated term field
Category: bug » support
Status: Active » Fixed

one of many possible approaches might be:

- at admin/config/workflow/rules/components clone the existing "Autotag to terms list" action set
- instead of the "Set a data value" action which overwrites the existing terms you would to "loop" over all extracted terms and "add an item to a list" for each of those

feel free to share the component with the community afterwards :)

Yuri’s picture

I managed to get one extracted term added to the extisting terms, but the loop does not work for me yet.

My custom component:
------
Extract tags
Parameter: Text to extract terms from: [text], Vocabulary used for extraction: [vocabulary]
Provides variables: Extracted terms (extraced_terms)

Loop
Parameter: List: [extraced-terms]
List item: Current list item (list_item)

> Add an item to a list
Parameter: List: [target-terms], Item to add: [list-item], Enforce uniqueness: true
---------
Suggestions to get this working are greatly appreciated. Thanks.

dasjo’s picture

looks good for me.

i suggest that you try using the debug action which comes with the devel module in order to tack down whats happening.

generally you can just post the code of your exported rule then you don't have to write it by hand :)

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

BeaPower’s picture

Status: Closed (fixed) » Active

Can someone provide a screencast or screenshot, this is all too confusing!

BeaPower’s picture

anyone?

BeaPower’s picture

Did you ever get this to work?

TimelessDomain’s picture

Priority: Normal » Major
dasjo’s picture

Priority: Major » Normal
onequad’s picture

Hi,

I am unable to ge this working as well. Any help please?

I added this component:

{ "rules_autotag_all_terms" : {
    "LABEL" : "Autotag all terms",
    "PLUGIN" : "action set",
    "REQUIRES" : [ "rules_autotag", "rules" ],
    "USES VARIABLES" : {
      "text" : { "label" : "The text for extracting terms", "type" : "text" },
      "vocabulary" : {
        "label" : "The vocabulary used for extraction",
        "type" : "taxonomy_vocabulary"
      },
      "target_terms" : {
        "label" : "Target list for storing extracted terms",
        "type" : "list\u003Ctaxonomy_term\u003E"
      }
    },
    "ACTION SET" : [
      { "rules_autotag_extract" : {
          "USING" : { "text" : [ "text" ], "vocabulary" : [ "vocabulary" ] },
          "PROVIDE" : { "extraced_terms" : { "extraced_terms" : "Extracted terms" } }
        }
      },
      { "LOOP" : {
          "USING" : { "list" : [ "extraced-terms" ] },
          "ITEM" : { "list_item" : "Current list item" },
          "DO" : [
            { "list_add" : { "list" : [ "target-terms" ], "item" : [ "list-item" ], "unique" : 1 } }
          ]
        }
      }
    ]
  }
}

And then add this rule:

{ "rules_test_rules" : {
    "LABEL" : "test rules",
    "PLUGIN" : "reaction rule",
    "REQUIRES" : [ "rules" ],
    "ON" : [ "node_presave" ],
    "IF" : [
      { "entity_has_field" : { "entity" : [ "node" ], "field" : "field_team" } }
    ],
    "DO" : [
      { "component_rules_autotag_all_terms" : {
          "text" : "[node:title] [node:body:value]",
          "vocabulary" : "team",
          "target_terms" : [ "node:field-team" ]
        }
      }
    ]
  }
}
onequad’s picture

Update: changing the above rule to use

"[node:title] [node:body]"

instead of

"[node:title] [node:body:value]"

seems to fix the problem.

Please consider adding this component to the module.

dasjo’s picture

thanks onesquad!
would you like to file a patch for adding the component?

onequad’s picture

@dasjo I have no idea how to make a patch for doing that. Please go ahead and add the component if you find it could be useful. Thanks a lot. ^^

timb’s picture

First thanks for this module! I use it extensively to autotag websites on my site: http://attorneylawpractice.com/website/14153/wwwbipccom. As I was reworking my scripts, I ran accross the fact that the built-in rule 'Autotag to terms list' will clobber the taxonomy field it is populating.

I cloned and rewrote as 'Autotag to terms list (no clobber / no dupes)', and thought I would provide as an import for you forum people

{ "rules_autotag_to_terms_list_no_clobber_no_dupes_" : {
    "LABEL" : "Autotag to terms list (no clobber \/ no dupes)",
    "PLUGIN" : "action set",
    "REQUIRES" : [ "rules_autotag", "rules" ],
    "USES VARIABLES" : {
      "text" : { "label" : "The text for extracting terms", "type" : "text" },
      "vocabulary" : {
        "label" : "The vocabulary used for extraction",
        "type" : "taxonomy_vocabulary"
      },
      "target_terms" : {
        "label" : "Target list for storing extracted terms",
        "type" : "list\u003Ctaxonomy_term\u003E"
      }
    },
    "ACTION SET" : [
      { "rules_autotag_extract" : {
          "USING" : { "text" : [ "text" ], "vocabulary" : [ "vocabulary" ] },
          "PROVIDE" : { "extraced_terms" : { "extraced_terms" : "Extracted terms" } }
        }
      },
      { "LOOP" : {
          "USING" : { "list" : [ "extraced-terms" ] },
          "ITEM" : { "list_item" : "Current list item" },
          "DO" : [
            { "list_add" : { "list" : [ "target-terms" ], "item" : [ "list-item" ], "unique" : 1 } }
          ]
        }
      }
    ]
  }
}