0

I have written a custom analyzer that wraps a StandardAnalyzer with a Length. Now I want to filter out all terms that contain just numbers. What is the best way to implement this?

Rohit Banga
  • 18,458
  • 31
  • 113
  • 191

2 Answers2

1

You may be in for a custom TokenFilter. Check out one of the simplest filters out there, the LowerCaseFilter. I think you'll find it easy to write your own along those lines.

Marko Topolnik
  • 195,646
  • 29
  • 319
  • 436
0

You can use the PatternReplaceFilter to detect and remove numbers from the TokenStream by using a regular expression.

Bertil Chapuis
  • 2,477
  • 1
  • 18
  • 12