I'm importing around 12000 nodes, and everything is coming in fine except there is no summary/teaser created for the body_summary field. the problem is, all my articles have an inline image at the top, so just setting the teaser to trim won't work since the images still shows.
Is there anyway to auto generate, or at least map a field to the summary so it get's populated?
If this has been addressed, please tell which version since I reluctant to move since I've run so many patches.
I'd be willing to contrib/pay someone for a patch if interested as well.
Thanks.
Comment | File | Size | Author |
---|---|---|---|
#23 | feeds-map_text_teasers-1329626-23.patch | 4.28 KB | Rob_Feature |
#13 | add_input_format-1329626-13.patch | 4.11 KB | valderama |
#10 | add_input_format-1329626-10.patch | 4.12 KB | valderama |
#2 | text_with_summary_mapper-1329626-2.patch | 3.89 KB | johnbarclay |
Comments
Comment #1
johnbarclay CreditAttribution: johnbarclay commentedCurrently the body field is treated as any other "text_with_summary" field. In mappers/field.inc it treats it as a generic text field and only populates the value column. Which is a good stop gap measure. But a better mapper for text_with_summary fields would deal with both the value and summary columns.
To implement this,
1. add another mapper in feeds/mappers. link.inc might be good starting points since it has multiple columns in their field storage. the file would be named 'text_with_summary.inc'.
2. after this is done, in your mapping you should see body:text and body:summary. Map whatever source to both of these.
3. use feeds tamper to deal with the summary field. use regexes to remove images. or strip tags to get rid of all html in the summary. also truncate to your favorite length.
Since text_with_summary field is in core, this functionality should be part of the feeds module rather than a contrib module.
Comment #2
johnbarclay CreditAttribution: johnbarclay commentedHere is a patch. It basically moves the text field mappers to mappers/text.inc. I believe all the fields in mappers/fields.inc should be treated this way for consistency. Thus list.inc, number.inc,etc would be other candidates for their own .inc files.
Comment #3
dotman CreditAttribution: dotman commentedHye John, thanks. have you tested this successfully? So upon doing a re-import, i would now map the content for body to body:text, and any custom field for the summary to body:summary? just want to be clear.
thanks.
Comment #4
johnbarclay CreditAttribution: johnbarclay commentedyeah. I tested it. Thats also how the import would go also. In my tests I was mapping the same field to body:text and body:summary, but two seperate fields should work the same.
Comment #5
InTheLyonsDen CreditAttribution: InTheLyonsDen commentedThe patch works great for the body but it also seems to affect any other text fields defaulting them with a ":summary" suffix and I'm not able to import them via feeds. i.e., field_twitter_account:summary and field_reference_id:summary. I changed the field_reference_id to an int field and the import succeeded. Any ideas?
Comment #6
valderama CreditAttribution: valderama commentedThe patch in #2 works fine, but it does not set the input format of the body field.
I somehow did not manage to create a proper patch, so I just post the updated function which adds the text format (replace your func in text.inc with this one):
Comment #7
jedprentice CreditAttribution: jedprentice commentedPlease roll a patch with this code so it can be reviewed and tested by the community.
Thanks,
Jed
Comment #8
jedprentice CreditAttribution: jedprentice commentedComment #9
jedprentice CreditAttribution: jedprentice commentedSetting status to 'active' until a patch is provided.
Comment #10
valderama CreditAttribution: valderama commentedhey,
I manually added some lines to the patch from #2. I tried to apply it to a fresh clone from GIT, and it works correctly.
However - maybe you give me a hint, how to automatically create the patch, here is what I tried:
git clone --branch 7.x-2.x http://git.drupal.org/project/feeds.git
cd feeds
git apply -v text_with_summary_mapper-1329626-2.patch
git diff > add_input_format-1329626-10.patch
Thanks, and best
Comment #11
emackn CreditAttribution: emackn commentedIs there any reason you dont use the migrate module?
Comment #12
valderama CreditAttribution: valderama commentedI use Feeds when I want to import content regularly. I would see Migrate module as solution for one time migrations (or did I miss something?)
Comment #13
valderama CreditAttribution: valderama commentedas mentioned in #5 simple text fields are not working, with the patch posted before. I could fix it easily and updated the patch,
please test..
Comment #14
franzI cannot see why this is critical at all.
Comment #15
Funkwarrior CreditAttribution: Funkwarrior commentedpatch #13 works fine for me, thanks a lot!
Comment #16
franzIt would be nice to have some tests here.
Comment #17
derekw CreditAttribution: derekw commented#13 working well here.
Comment #18
twistor CreditAttribution: twistor commentedThis should be implemented using the new configuration api for mappers.
Comment #19
twistor CreditAttribution: twistor commentedThis is going to conflict with #1588938: Allow selection of filter for each text field imported. You can see where I'm going with this. I've already split the field.inc into number.inc and text.inc.
Comment #20
timtk CreditAttribution: timtk commentedI have got this patch working on 7.x-2.0-alpha5 however not on 7.x-2.0-alpha6 I am unable to find the field.inc file am I missing something?
Comment #21
timtk CreditAttribution: timtk commentedSorry, figured it out managed to get the patch in text.inc on alpha 6 and it looks like its working.
Comment #22
Rob_Feature CreditAttribution: Rob_Feature commentedCan someone post a patch that applies to the latest dev, please? Lakes, sounds like you got it working (if you dont know how to patch, maybe post your text.inc file so I can roll it) Thanks.Patch below...
Comment #23
Rob_Feature CreditAttribution: Rob_Feature commentedHere's a quick patch that (hopefully) applies to the latest dev.
Comment #24
derekw CreditAttribution: derekw commentedPatch in #23 confuses mapping when there are more than one text with summary fields.
I'm using XML Expression parser and when I add text/teaser fields for both my text-with-summary fields, only one body text field appears in the XML Expression Parser settings field.
Comment #25
MegaChriz CreditAttribution: MegaChriz commentedI think issue #962912: Mapping to node summary deals with the exact same problem.
Comment #26
MegaChriz CreditAttribution: MegaChriz commentedI've tried the patch in #23 and I had one problem with it: mapping to plain text fields no longer worked. That is because I believe the callback for plain text fields is wrong. It should not be
field_feeds_set_target_text
, buttext_feeds_set_target
.(I have no time at the moment to post a new patch.)
Comment #27
MegaChriz CreditAttribution: MegaChriz commentedI have posted a new patch in #962912-23: Mapping to node summary that is based on the patch in #23 of this issue.
I'm closing this as a duplicate of #962912: Mapping to node summary now, as in both issues we are trying to achieve the same thing: mapping to node summary.
Comment #28
subramani.msc2011 CreditAttribution: subramani.msc2011 commented#23 Working for 7.x-2.0-alpha8 " https://www.drupal.org/files/feeds-map_text_teasers-1329626-23.patch "