Closed bahaabeih closed 8 years ago
Hi @bahaabeih!
Thank you for your interest.
I suppose that in the .NET version, you are creating your CustomFilterFactory
in .NET (not in Java, then converting to .NET).
If this is the case, then the following code should work:
CustomAnalyzer myCustomAnalyzer = CustomAnalyzer.Builder()
.WithTokenizer("keyword")
//.AddTokenFilter(Class.forName("MyCompany.MyProduct.CustomFilterFactory"))
.AddTokenFilter(Class.forName(typeof(MyCompany.MyProduct.CustomFilterFactory).AssemblyQualifiedName))
.Build();
Note that I am using the AssemblyQualifiedName
as opposed to using the FullName
of the CustomFilterFactory
class. This is how IKVM likes it.
Here is the implementation of the CustomFilterFactory
, just for good measure:
namespace MyCompany.MyProduct
{
public class CustomFilterFactory : TokenFilterFactory
{
public CustomFilterFactory(Map m) : base(m) {}
public override TokenStream Create(TokenStream ts)
{
throw new NotImplementedException();
}
}
}
Let me know if it works.
Hello @vladnega. Thanks for the response. It worked like a charm!
I have been using FlexLucene for while now with great success. I wrote a custom
TokenFilter
along with a customTokenFilterFactory
to be used in an analysis chain usingCustomAnalyzer
as follows (Java version, which works fine):This is the .NET version, which doesn't work:
I get the following exception messages:
Is there a way to get this to work?