lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kai Hu" <>
Subject 答复: unable to search from a string containing numbers seperated by comma.
Date Wed, 05 Sep 2007 07:25:09 GMT
	I have this problem too. I made a test use StandardAnalyzer:

	Analyzer analyzer = new StandardAnalyzer();
	 Reader reader = new BufferedReader(new InputStreamReader(new StringBufferInputStream("Aaa,0982,abc")));
	  TokenStream tokenStream = analyzer.tokenStream("abc",reader);
	  org.apache.lucene.analysis.Token token =;
	  while(token != null){
		 token =;

	The result is "(aaa,0982,abc,0,12,type=<NUM>)",the analyzer parsed the 
"Aaa,0982,abc" as a "NUM" type word.

发件人: prabin meitei [] 
发送时间: 2007年8月30日 星期四 18:07
主题: unable to search from a string containing numbers seperated by comma.

  I am trying to search from an idlist (string containing comma seperated
numeric values)

QueryParser vParser = new QueryParser("idlist", new AlphanumAnalyzer()); //
analyzer using custom lettertokenizer which tokenize nuber also. class is
given below.
Query q = vParser.parse("55"); // example

now even if the field idlist contains say (44, 55, 66)
my search returns 0 hit. is there any alternative solution or is there some
problem with wat i am using.

Thanks in advance.

public class AlphanumericTokenizer extends LetterTokenizer {
  public AlphanumericTokenizer(Reader reader) {

  protected boolean isTokenChar(char c) {
    return super.isTokenChar(c) || Character.isDigit(c);

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message