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_service 'verify_signature', 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\system32\mscoree.dll
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(LayoutKind.Sequential)]
public struct TEXT_SOURCE
{
[MarshalAs(UnmanagedType.FunctionPtr)]
public delFillTextBuffer
pfnFillTextBuffer;
[MarshalAs(UnmanagedType.LPWStr)]
public string awcBuffer;
[MarshalAs(UnmanagedType.U4)]
public int iEnd;
[MarshalAs(UnmanagedType.U4)]
public int iCur;
}
[ComImport]
[Guid("CC906FF0-C058-101A-B554-08002B33B0E6")]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown )]
public interface IPhraseSink
{
void PutSmallPhrase([MarshalAs(UnmanagedType.LPWStr)] string pwcNoun,
[MarshalAs(UnmanagedType.U4)] int cwcNoun,
[MarshalAs(UnmanagedType.LPWStr)] string pwcModifier,
[MarshalAs(UnmanagedType.U4)] int cwcModifier,
[MarshalAs(UnmanagedType.U4)] int ulAttachmentType);
void PutPhrase([MarshalAs(UnmanagedType.LPWStr)] string pwcPhrase,
[MarshalAs(UnmanagedType.U4)] int cwcPhrase);
}
[ComImport]
[Guid("D53552C8-77E3-101A-B552-08002B33B0E6")]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown )]
public interface IWordBreaker
{
void Init([MarshalAs(UnmanagedType.Bool)] bool fQuery,
[MarshalAs(UnmanagedType.U4)] int maxTokenSize,
[MarshalAs(UnmanagedType.Bool)] out bool pfLicense);
void BreakText([MarshalAs(UnmanagedType.Struct)] TEXT_SOURCE pTextSource,
[MarshalAs(UnmanagedType.Interface)] IWordSink pWordSink,
[MarshalAs(UnmanagedType.Interface)] IPhraseSink pPhraseSink);
void GetLicenseToUse([MarshalAs(UnmanagedType.LPWStr)] out string ppwcsLicense);
}
public class WordBreaker : ServicedComponent, IWordBreaker
{
#region Constructor
public WordBreaker()
{
System.Diagnostics.Trace.WriteLine("Inside Default Constructor");
System.Diagnostics.Trace.WriteLine(string.Format(" Calling Assembly Name {0}", System.Reflection.Assembly.GetCallingAssembly().Fu llName));
}
public void WriteMessage(string message)
{
System.Diagnostics.Trace.WriteLine(message);
}
#endregion
#region Implementation of IWordBreaker
public void Init(bool fQuery, int maxTokenSize, out bool pfLicense)
{
System.Diagnostics.Trace.WriteLine("Inside Init MS");
this.cwcMaxToken = maxTokenSize;
pfLicense = true;
}
public void BreakText(ref TEXT_SOURCE textSource, IWordSink wordSink, IPhraseSink phraseSink)
{
System.Diagnostics.Trace.WriteLine("Inside BreakText");
}