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 Andy <an...@hotmail.com> on 2010/04/19 19:40:28 UTC

How to search by numbers

Hi, I have indexed the following two fields:
org_id - NOT_ANALYZEDorg_name - ANALYZED
However when I try to search by org_id, for example, 12345, I get no hits.  
I am using the StandardAnalyzer to index and search.  
And I am using:  Query query = queryParser.parse("org_id:12345");
Any ideas?  Thx 		 	   		  
_________________________________________________________________
Hotmail is redefining busy with tools for the New Busy. Get more from your inbox.
http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_2

Re: How to search by numbers

Posted by Erick Erickson <er...@gmail.com>.
You might also want to think about which analyzer you're using
for this field then. KeywordAnalyzer may suit your purpose if
you're using some other one, or possibly even WhitespaceAnalyzer.

PerFieldAnalyzeWrapper may be your friend too....

Bestr
Erick

On Mon, Apr 19, 2010 at 2:39 PM, Andy <an...@hotmail.com> wrote:

>
> That works, and now that I re-test my original code, it also works.
>
> > Date: Mon, 19 Apr 2010 10:52:45 -0700
> > From: iorixxx@yahoo.com
> > Subject: Re: How to search by numbers
> > To: java-user@lucene.apache.org
> >
> >
> > > Hi, I have indexed the following two fields:
> > > org_id - NOT_ANALYZEDorg_name - ANALYZED
> > > However when I try to search by org_id, for example, 12345,
> > > I get no hits.
> > > I am using the StandardAnalyzer to index and search.
> > >
> > > And I am using:  Query query =
> > > queryParser.parse("org_id:12345");
> >
> > What happens when you search with this query?
> > Query query  = new TermQuery(new Term("org_id","12345"));
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> > For additional commands, e-mail: java-user-help@lucene.apache.org
> >
>
> _________________________________________________________________
> Hotmail has tools for the New Busy. Search, chat and e-mail from your
> inbox.
>
> http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_1
>

RE: How to search by numbers

Posted by Andy <an...@hotmail.com>.
That works, and now that I re-test my original code, it also works.

> Date: Mon, 19 Apr 2010 10:52:45 -0700
> From: iorixxx@yahoo.com
> Subject: Re: How to search by numbers
> To: java-user@lucene.apache.org
> 
> 
> > Hi, I have indexed the following two fields:
> > org_id - NOT_ANALYZEDorg_name - ANALYZED
> > However when I try to search by org_id, for example, 12345,
> > I get no hits.  
> > I am using the StandardAnalyzer to index and search. 
> > 
> > And I am using:  Query query =
> > queryParser.parse("org_id:12345");
> 
> What happens when you search with this query? 
> Query query  = new TermQuery(new Term("org_id","12345"));
> 
> 
>       
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
> 
 		 	   		  
_________________________________________________________________
Hotmail has tools for the New Busy. Search, chat and e-mail from your inbox.
http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_1

Re: How to search by numbers

Posted by Ahmet Arslan <io...@yahoo.com>.
> Hi, I have indexed the following two fields:
> org_id - NOT_ANALYZEDorg_name - ANALYZED
> However when I try to search by org_id, for example, 12345,
> I get no hits.  
> I am using the StandardAnalyzer to index and search. 
> 
> And I am using:  Query query =
> queryParser.parse("org_id:12345");

What happens when you search with this query? 
Query query  = new TermQuery(new Term("org_id","12345"));


      

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org