none
Reading a file in C# Custom Stage - Pipelineextensibility RRS feed

  • Question

  • Hi Experts,

    If you are aware that we have a Attributemapper stage in ESP which was removed in the FS4SP. I'm trying to write a custom stage to mimic Attributemapper which bascially means I need to read a XML file for every record that comes for document processing.

    My question is, what is the best way to do this? As any XML parsing code I write, it will mean that the XML file has to be loaded into the memory everytime a new document that comes for doc processing. To re-phrase, for every document I will read the same XML file once.

    Are there any ways by which we can load these XML files into some kind of cache and read it from there?

    First off, it is possible to read/write files in Pipelineextensibility stages right?

    Much Thanks!!


    Freddie Maize ..A story with Glory is History. Doesn’t matter whether Glory rest in the world of Demon or God. Lets create History..

    Monday, July 2, 2012 1:14 PM

All replies

  • Hi,

    Yes, you can read/write files. The folders you have access to are limited, but reading from the same folder as your .exe should work just fine.

    As for sharing a file, you have some options the way I see it:

    1. Use a webservice which holds the data and loads the file once

    2. Use memory mapped files, which can be shared among processes

    3. Call upon some third party program which holds the data via IPC/WCF

    4. Write it in python the way you know how to - the attribute mapper might even be there and can be manually added. I just haven't tested it.

    Thanks,
    Mikael Svenson


    Search Enthusiast - SharePoint MVP/MCT/MCPD
    http://techmikael.blogspot.com/
    Author of Working with FAST Search Server 2010 for SharePoint

    Monday, July 2, 2012 7:52 PM
  • Hi Mikael,

    Thanks for the response!!

    >>4. Write it in python the way you know how to - the attribute mapper might even be there and can be manually added. I just haven't tested it.

    If you mean by using the same python stage from ESP, then thats already tried and it works prefectly fine. We were just wondering with this approach as MS is not recommading this approach.

    Thanks for the suggestions. I shall post back on them.

    Much Thanks!!


    Freddie Maize ..A story with Glory is History. Doesn’t matter whether Glory rest in the world of Demon or God. Lets create History..

    Tuesday, July 3, 2012 6:32 AM
  • Hi,

    MS is not recommending it due to support. If you are comfortable with it, then it should be ok. Just make sure when you applies CU's that the pipelineconfig.xml is not modified to remove your entry. You already have to backup/restore your pipelineextensibility config during patching today, so more or less the same routine.

    My main issue with doing python is maintainability across time as most people I work with are .Net people. But if you have python/ESP expertise available and good documentation on your changes I think you might be just fine with doing it the "old" way. You should also think about future-proofing. Do you see a scenario where SharePoint/search will be upgraded beyond 2010? If so you can be pretty sure python will be abandoned in the future. Question is if you want to prepare now or document the changes for an upgrade later on at some time.

    Thanks,
    Mikael Svenson


    Search Enthusiast - SharePoint MVP/MCT/MCPD
    http://techmikael.blogspot.com/
    Author of Working with FAST Search Server 2010 for SharePoint

    Tuesday, July 3, 2012 7:03 AM