I think Erik Hatcher commented on a similar problem the other day. When QueryParser 
handles a * query which it creates as a prefix query, the token the prefix query is 
built from is not analyzed.

StandardAnalyzer would turn abc$def into two tokens "abc" and "def"

QueryParser would take query 2 and build a PrefixQuery with "abc" as the prefix and 
query 3 as a PrefixQuery with "abc$" as the prefix.

There are probably a million valid reasons why this is appropriate default behavior 
for QueryParser. One off the top of my head is that with a stemming analyzer, you may 
not get an approriate stem if you analyzed the prefix. In this case, if this is not 
appropriate behavior for your application, you should probably create a custom query 
parser with different behavior.

Eric

Here is the snip of QueryParser.jj that builds the query objects. The only one that is 
analyzed is the field query. The term productions generally break on whitespace and 
special unescaped query operators (see the .jj file for the full details):

       term=<TERM>
       | term=<PREFIXTERM> { prefix=true; }
       | term=<WILDTERM> { wildcard=true; }
       | term=<NUMBER>
     )
     [ <FUZZY> { fuzzy=true; } ]
     [ <CARAT> boost=<NUMBER> [ <FUZZY> { fuzzy=true; } ] ]
     {
       String termImage=discardEscapeChar(term.image);
       if (wildcard) {
       q = getWildcardQuery(field, termImage);
       } else if (prefix) {
         q = getPrefixQuery(field,
           discardEscapeChar(term.image.substring
          (0, term.image.length()-1)));
       } else if (fuzzy) {
         q = getFuzzyQuery(field, termImage);
       } else {
         q = getFieldQuery(field, analyzer, termImage);
       }
     }

-----Original Message-----
From: Otis Gospodnetic [mailto:[EMAIL PROTECTED] 
Sent: Thursday, March 18, 2004 11:44 AM
To: Lucene Users List
Subject: Re: Searches containing a dollar sign $


Are you indexing your documents with the same Analyzer?
Are you using QueryParser?
Are you able to get query 3) to work when using queries directly, without a 
QueryParser?

Otis

--- Reece <[EMAIL PROTECTED]> wrote:
> Hi,
> 
> I have a field that has a dollar sign in it like this:
>   abc$def
> 
> I perform the following queries using the
> StandardAnalyzer:
> 
> 1). myField:abc$def - work
> 2). myField:abc*    - work
> 3). myField:abc$*   - no work
> 
> Why doesn't the third query work?  Is there an
> analyzer that will handle all three of these queries?
> 
> Thanks,
> Reece
> 
> __________________________________
> Do you Yahoo!?
> Yahoo! Mail - More reliable, more storage, less spam 
> http://mail.yahoo.com
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to