Custom WordBreaker for SQL Server Full-text

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • MSethuraman
    New Member
    • Feb 2009
    • 1

    Custom WordBreaker for SQL Server Full-text

    Hi Guys,

    I am having some issues with developing a custom word breaker component for SQL2005 Full-text search and would appreciate if some one can help me.

    I have implemented the class with the guidance from this great article http://www.sqljunkies.ddj.com/HowTo/...61DA96A5B.scuk. with the test app, the breaker works fine. when I implement this class into SQL server 2005, I get different error messages. First I got, "No Signatures Found" which I overcame by applying "exec sp_fulltext_ser vice 'verify_signatu re', 0". Now I get "The Specified Procedure could not be found." Using the LRTEST tool, I get the following error.


    LRTEST /b /c:{E9A7B457-B7E5-3D7A-B7C9-FA4AA63BF78B} "C#"

    dll loaded: C:\WINDOWS\syst em32\mscoree.dl l
    dll version 2.0.50727.3053
    file create time: 7-25-2008 11:16a
    file last write time: 7-25-2008 11:16a
    FileVersion: '2.0.50727.3053 (netfxsp.050727-3000)'
    FileDescription : 'Microsoft .NET Runtime Execution Engine'
    CompanyName: 'Microsoft Corporation'
    ProductName: 'Microsoft« .NET Framework'
    Wordbreaker requires license: Yes
    fatal exception caught
    exception code: 0xc0000005
    exception address 0XE80010C2
    attempted write at address 0XE80010C2
    eax: 0x36fffec
    ebx: 0
    ecx: 0x923398
    edx: 0x6f9b0
    edi: 0
    esi: 0
    ebp: 0x6fa24
    eip: 0xe80010c2
    esp: 0x6f988
    fatal exception code 0xc0000005



    Here is my signatures in the WordBreaker Class.


    public void Init(bool fQuery, int maxTokenSize, out bool license)

    public void BreakText(ref TEXT_SOURCE textSource, IWordSink wordSink, IPhraseSink phraseSink)

    public void GetLicenseToUse (out string license)

    Any suggestions, help will be much appreciated.

    Ta
    Mahesh

    Here is my sample code.

    [StructLayout(La youtKind.Sequen tial)]
    public struct TEXT_SOURCE
    {
    [MarshalAs(Unman agedType.Functi onPtr)]
    public delFillTextBuff er
    pfnFillTextBuff er;
    [MarshalAs(Unman agedType.LPWStr )]
    public string awcBuffer;
    [MarshalAs(Unman agedType.U4)]
    public int iEnd;
    [MarshalAs(Unman agedType.U4)]
    public int iCur;
    }

    [ComImport]
    [Guid("CC906FF0-C058-101A-B554-08002B33B0E6")]
    [InterfaceType(C omInterfaceType .InterfaceIsIUn known)]
    public interface IPhraseSink
    {
    void PutSmallPhrase([MarshalAs(Unman agedType.LPWStr )] string pwcNoun,
    [MarshalAs(Unman agedType.U4)] int cwcNoun,
    [MarshalAs(Unman agedType.LPWStr )] string pwcModifier,
    [MarshalAs(Unman agedType.U4)] int cwcModifier,
    [MarshalAs(Unman agedType.U4)] int ulAttachmentTyp e);
    void PutPhrase([MarshalAs(Unman agedType.LPWStr )] string pwcPhrase,
    [MarshalAs(Unman agedType.U4)] int cwcPhrase);
    }

    [ComImport]
    [Guid("D53552C8-77E3-101A-B552-08002B33B0E6")]
    [InterfaceType(C omInterfaceType .InterfaceIsIUn known)]
    public interface IWordBreaker
    {
    void Init([MarshalAs(Unman agedType.Bool)] bool fQuery,
    [MarshalAs(Unman agedType.U4)] int maxTokenSize,
    [MarshalAs(Unman agedType.Bool)] out bool pfLicense);
    void BreakText([MarshalAs(Unman agedType.Struct )] TEXT_SOURCE pTextSource,
    [MarshalAs(Unman agedType.Interf ace)] IWordSink pWordSink,
    [MarshalAs(Unman agedType.Interf ace)] IPhraseSink pPhraseSink);
    void GetLicenseToUse ([MarshalAs(Unman agedType.LPWStr )] out string ppwcsLicense);
    }

    public class WordBreaker : ServicedCompone nt, IWordBreaker
    {
    #region Constructor

    public WordBreaker()
    {
    System.Diagnost ics.Trace.Write Line("Inside Default Constructor");
    System.Diagnost ics.Trace.Write Line(string.For mat("Calling Assembly Name {0}", System.Reflecti on.Assembly.Get CallingAssembly ().FullName));


    }

    public void WriteMessage(st ring message)
    {
    System.Diagnost ics.Trace.Write Line(message);
    }

    #endregion

    #region Implementation of IWordBreaker

    public void Init(bool fQuery, int maxTokenSize, out bool pfLicense)
    {
    System.Diagnost ics.Trace.Write Line("Inside Init MS");
    this.cwcMaxToke n = maxTokenSize;

    pfLicense = true;
    }

    public void BreakText(ref TEXT_SOURCE textSource, IWordSink wordSink, IPhraseSink phraseSink)
    {
    System.Diagnost ics.Trace.Write Line("Inside BreakText");

    }
Working...