Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8774967
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T18:41:49+00:00 2026-06-13T18:41:49+00:00

I just wrote a custom CharTokenizer , and I want to use it in

  • 0

I just wrote a custom CharTokenizer, and I want to use it in my Solr server.

In Solr3, I could just extend TokenizerFactory and return my CharTokenizer in the create method, but TokenizerFactory does not exist in Solr4.

So, I was noticed that I should replace TokenizerFactory with TokenFilterFactory, but in this case, I cannot return my custom CharTokenizer, because the parameters don’t match.

I also search for some documentation, but looks like there is nothing really useful about that out there.

So, how can I make it works?

Example:

public class MyCustomTokenizer extends CharTokenizer {

  char anotherSpace = 24;

  public MyCustomTokenizer(Version matchVersion, Reader in) {
    super(matchVersion, in);
  }

  protected boolean isTokenChar(int c) {
    return !Character.isWhitespace(c) && isToken((char) c);
  }

  private boolean isToken(char c) {
    if (c == anotherSpace || c == ',') {
        return false;
    }
    return true;
  }
}

public class MyCustomTokenizerFactory extends TokenFilterFactory {

  public void init(Map<String, String> args) {
    super.init(args);
    assureMatchVersion();
  }

  @Override
  public TokenStream create(TokenStream input) {
      // sh*t happens here
    return new MyCustomTokenizer(luceneMatchVersion, input);
  }
}

Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T18:41:50+00:00Added an answer on June 13, 2026 at 6:41 pm

    The best way to check for implementation is looking the Source code of an existing Tokenizer in Lucene.

    Example :-

    WhitespaceTokenizer
    WhitespaceTokenizerFactory

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I just want to use developer app for creating normal simple custom tab. And
Just wrote a web service and try to return columns of a sharepoint list
I just wrote this into my WebForms .aspx: <span id=GenerateChartButton runat=server></span> I went to
I just wrote a custom progress bar, it's single buffered and will remain so.
I just wrote a simple DirectShow Filter (which inherits from CTransformFilter). But I want
I just wrote some code. It has my own custom made class. In that
This is just an exercise in mechanics. I am attempting to create three custom
I wrote myself a custom NavigationHandler very similar to following one but just using
I want to have some text with a custom line-spacing, so I wrote an
I just wrote a very simple perl tk script to read a huge text

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.