You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by prabin meitei <pr...@gmail.com> on 2007/08/30 12:06:33 UTC
unable to search from a string containing numbers seperated by comma.
Hi,
I am trying to search from an idlist (string containing comma seperated
numeric values)
eg:
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) {
super(reader);
}
protected boolean isTokenChar(char c) {
return super.isTokenChar(c) || Character.isDigit(c);
}
}
Re: unable to search from a string containing numbers seperated by comma.
Posted by Grant Ingersoll <gs...@apache.org>.
Give these tips a try to see if they help:
http://wiki.apache.org/lucene-java/
LuceneFAQ#head-3558e5121806fb4fce80fc022d889484a9248b71
Luke is your friend.
Cheers,
Grant
On Aug 30, 2007, at 6:06 AM, prabin meitei wrote:
> Hi,
> I am trying to search from an idlist (string containing comma
> seperated
> numeric values)
>
> eg:
> 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) {
> super(reader);
> }
>
> protected boolean isTokenChar(char c) {
> return super.isTokenChar(c) || Character.isDigit(c);
> }
> }
--------------------------
Grant Ingersoll
http://lucene.grantingersoll.com
Lucene Helpful Hints:
http://wiki.apache.org/lucene-java/BasicsOfPerformance
http://wiki.apache.org/lucene-java/LuceneFAQ
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org