Well, I'd suggest the first thing you do is remove your custom tokenizer and see what results you get with one of the normal parsers.
Then creep up on your custom analyzer bit by bit. Otherwise, it's almost impossible to figure out what's going on except by setting breakpoints in your analyzer and inspecting. Best Erick On 6/29/07, pratik shinghal <[EMAIL PROTECTED]> wrote:
On 6/29/07, Erick Erickson <[EMAIL PROTECTED]> wrote: > > What do you get if you do a > System.out.println(que.toString())? > > And what analyzer are you using? > > Erick > > On 6/28/07, pratik shinghal <[EMAIL PROTECTED]> wrote: > > > > i m using lucene(org.apache.lucene) and i want the java code for parsing > > single character string.. > > > > my code is : > > > > QueryParser qp = new QueryParser("",analyser); > > String str = " track 9"; > > Query que = qp.parse(str); > > System.out.println(que); > > > > and i want the answer as : track , 9 > > > > > > but i m getting only "track" and not getting "9" . > > so tell me which analyser & queryparser i should use and kindly give me > > the > > java code for the same , as i m new to > > lucene. > > > > -- > > Pratik Shinghal > > > the output of System.out.println(que.toString()) is "track". i m using AlphanumericAnalyser which is the custom Analyser made by me. the code of this analyser is as follows : * class* AlphanumericAnalyzer *extends* Analyzer { *public* *TokenStream* *tokenStream*(String *fieldName*, Reader reader) { *return* *new* CharTokenizer(reader) { *protected* *char* normalize(*char* c) { *return* Character.*toLowerCase*(c); } *protected* *boolean* isTokenChar(*char* c) { *return* Character.*isLetter*(c) || Character.*isDigit*(c); } }; } *}* -- Pratik Shinghal