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 DM...@lbl.gov on 2002/07/31 02:46:32 UTC

Loss of wildcard when search term is quoted with StandardAnalyzer

For an index created with StandardAnalyzer, with fields called "go_desc"
and "pu_desc", I construct the following query using QueryParser with
the StandardAnalyzer:

annotQueryStr = "go_desc:\"intracellular signaling\"";
 Query query = 
		QueryParser.parse(annotQueryStr,"pu_desc", new StandardAnalyzer());
log.writeToLog(Log.DEBUG," query is " + query.toString("pu_desc"));

My log output shows that the Query is parsed as:
         query is go_desc:"intracellular signaling"

So that seems to be working fine, and the query returns the expected
results.

If I construct add a wildcard to the query:
annotQueryStr = "go_desc:\"intracellular signal*ng\"";
 Query query = 
		QueryParser.parse(annotQueryStr,"pu_desc", new StandardAnalyzer());
log.writeToLog(Log.DEBUG," query is " + query.toString("pu_desc"));

My log output shows that the wilcard is replaced by whitespace:
        query is go_desc:"intracellular signal ng"
and this returns no results.

Why should StandardAnalyzer be doing this?  Note that this only happens
with "quoted" search terms.  If I try

annotQueryStr = "go_desc:signal*ng";
My logfile shows that
        query is go_desc:signal*ng

So it's handling wildcards fine in this case.

thanks,
--David Goodstein



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Loss of wildcard when search term is quoted with StandardAnalyzer

Posted by Otis Gospodnetic <ot...@yahoo.com>.
Which version of Lucene are you using?
This should work with the latest (nightly) versions.
There are even tests that excercise this functionality and they pass.

Otis

--- DMGoodstein@lbl.gov wrote:
> For an index created with StandardAnalyzer, with fields called
> "go_desc"
> and "pu_desc", I construct the following query using QueryParser with
> the StandardAnalyzer:
> 
> annotQueryStr = "go_desc:\"intracellular signaling\"";
>  Query query = 
> 		QueryParser.parse(annotQueryStr,"pu_desc", new StandardAnalyzer());
> log.writeToLog(Log.DEBUG," query is " + query.toString("pu_desc"));
> 
> My log output shows that the Query is parsed as:
>          query is go_desc:"intracellular signaling"
> 
> So that seems to be working fine, and the query returns the expected
> results.
> 
> If I construct add a wildcard to the query:
> annotQueryStr = "go_desc:\"intracellular signal*ng\"";
>  Query query = 
> 		QueryParser.parse(annotQueryStr,"pu_desc", new StandardAnalyzer());
> log.writeToLog(Log.DEBUG," query is " + query.toString("pu_desc"));
> 
> My log output shows that the wilcard is replaced by whitespace:
>         query is go_desc:"intracellular signal ng"
> and this returns no results.
> 
> Why should StandardAnalyzer be doing this?  Note that this only
> happens
> with "quoted" search terms.  If I try
> 
> annotQueryStr = "go_desc:signal*ng";
> My logfile shows that
>         query is go_desc:signal*ng
> 
> So it's handling wildcards fine in this case.
> 
> thanks,
> --David Goodstein
> 
> 
> 
> --
> To unsubscribe, e-mail:  
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> 


__________________________________________________
Do You Yahoo!?
HotJobs - Search Thousands of New Jobs
http://www.hotjobs.com

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>