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 Patrick Kates <pa...@comcast.net> on 2004/01/14 00:19:08 UTC
StandardAnalyzer and numbers indexed as text
Hi all,
I have a text field called ACTIVE_YEAR that stores (of course) a year like
2003. When I index this field I can see the number in my index (using Luke)
but I can't search it. If I add a text character to the end of the field
and index it (200x) I can then search and find 'x', but not any portion of
the number.
One finally piece of info, when using Luke to view the terms contained in
the index I can find my 'x' term, but none of the years are listed as terms.
Any ideas on how to fix this?
Thanks
pdk
---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-user-help@jakarta.apache.org
Re: StandardAnalyzer and numbers indexed as text
Posted by Patrick Kates <pa...@comcast.net>.
Thanks for the responses everyone. They helped lead me to my real problem.
Which I suspect is the typical uber newb mistake. I was indexing with
SimpleAnalyzer and searching with StandardAnalyzer.
So we are now indexing AND searching with StandardAnalyzer and things are
working beautifully.
Thanks again,
pdk
----- Original Message -----
From: "Erik Hatcher" <er...@ehatchersolutions.com>
To: "Lucene Users List" <lu...@jakarta.apache.org>
Sent: Tuesday, January 13, 2004 7:10 PM
Subject: Re: StandardAnalyzer and numbers indexed as text
> On Jan 13, 2004, at 6:19 PM, Patrick Kates wrote:
> > I have a text field called ACTIVE_YEAR that stores (of course) a year
> > like
> > 2003. When I index this field I can see the number in my index (using
> > Luke)
> > but I can't search it. If I add a text character to the end of the
> > field
> > and index it (200x) I can then search and find 'x', but not any
> > portion of
> > the number.
>
> Is it possible you're using a Keyword field for indexing, but an
> analyzer at query time that is ripping off the number? Try the latest
> Luke (0.4) and you'll see the query expression that it got parsed to on
> the Search tab. The results may tell the tale.
>
> > One finally piece of info, when using Luke to view the terms contained
> > in
> > the index I can find my 'x' term, but none of the years are listed as
> > terms.
> >
> > Any ideas on how to fix this?
>
> Be careful how you index and query. Field.Keyword sounds like what you
> want for indexing. But for querying, QueryParser has some nasty habits
> of analyzing everything. Do some Query.toString debugging if you are
> using QueryParser - therein likely lies the clues to the problem.
>
> Erik
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: lucene-user-help@jakarta.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-user-help@jakarta.apache.org
Re: StandardAnalyzer and numbers indexed as text
Posted by Erik Hatcher <er...@ehatchersolutions.com>.
On Jan 13, 2004, at 6:19 PM, Patrick Kates wrote:
> I have a text field called ACTIVE_YEAR that stores (of course) a year
> like
> 2003. When I index this field I can see the number in my index (using
> Luke)
> but I can't search it. If I add a text character to the end of the
> field
> and index it (200x) I can then search and find 'x', but not any
> portion of
> the number.
Is it possible you're using a Keyword field for indexing, but an
analyzer at query time that is ripping off the number? Try the latest
Luke (0.4) and you'll see the query expression that it got parsed to on
the Search tab. The results may tell the tale.
> One finally piece of info, when using Luke to view the terms contained
> in
> the index I can find my 'x' term, but none of the years are listed as
> terms.
>
> Any ideas on how to fix this?
Be careful how you index and query. Field.Keyword sounds like what you
want for indexing. But for querying, QueryParser has some nasty habits
of analyzing everything. Do some Query.toString debugging if you are
using QueryParser - therein likely lies the clues to the problem.
Erik
---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-user-help@jakarta.apache.org
Re: StandardAnalyzer and numbers indexed as text
Posted by Pawan preet <pa...@yahoo.com>.
Hi
if u want that your number like 200x should not filter by StandardAnalyzer then
Change the method isTokenChar() called in CharTokenizer.java file and
is implemented in LetterTokenizer.java
So do not filter number : for that use
Character.isDigit(char)
Patrick Kates <pa...@comcast.net> wrote:
Hi all,
I have a text field called ACTIVE_YEAR that stores (of course) a year like
2003. When I index this field I can see the number in my index (using Luke)
but I can't search it. If I add a text character to the end of the field
and index it (200x) I can then search and find 'x', but not any portion of
the number.
One finally piece of info, when using Luke to view the terms contained in
the index I can find my 'x' term, but none of the years are listed as terms.
Any ideas on how to fix this?
Thanks
pdk
---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-user-help@jakarta.apache.org
---------------------------------
Do you Yahoo!?
Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes