java - How do I use ASCIIFoldingFilter in my Lucene app? -
I have a standard Lucene app that searches from an index. There are so many French words in my index and I am using ASCIfolding filters. Want to use
I have searched a lot and I do not know how to use it. The constructor takes a tokenstream object, will I call that method on the analyzer which gets the flow of the flow when you send it to the field? So what do I do? Does anyone point me to an example where a token filter is being used? Thank you.
token filters - such as ASCIIfolding filters - have a tokenstream based on them, so they are some of the analyzer main Uses the following method from:
public abstract TokenStream tokenStream (string field, reader reader);
As you have seen, the filters take a tokenstream as an input. They work like wrappers or more correctly, as if their input means that they increase the behavior of the token stream contained, display both their operation and the inherent input operation.
You can get an explanation. It is not directly focusing on an ASCIIfolding filter, but the same principle applies. Basically, you create a custom analyzer with something like this (the example is stripped down):
Expands the public class CustomAnalyzer Analyzer {// Other content left // ... public tokenstream token stream (string field name, reader reader) {tokenstream result = new standard connector (reader); Results = new standard filter (results); Result = New Lower Sense Filter (results); // etc etc ... Result = New StopFilter (Results, yourSetOfStopWords); Results = new ASCIIfolding filter (results); Return result; } // ...}
are both sub-categories of both tokenfilter and tokenerager.
Also remember that you should use the same custom analyzer in both the indexing and search or you can get the wrong result in your questions.
Comments
Post a Comment