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 Krishnendra Nandi <kr...@hewitt.com> on 2006/11/08 08:08:00 UTC

Problems while using double quotes

Hi All,

in my search criteria i am using a criteria "apache tomcat" but it is 
giving me a parse exception.

my searcher has this piece of code:

searchQuery=makeWildcardQuery(searchQuery);
masterQuery.add(MultiFieldQueryParser.parse(searchQuery,fields,analyzer),REQUIRED,PROHIBITED);




private String makeWildcardQuery(String query)
    {
        String result = query.trim();

        if (0 != result.length())
        {
            if (!result.endsWith("*"))
            {
                result = result + "*";
            }
        }

        return result;
    }

Thanks and Regards
Krishnendra Nandi
Hewitt Associates India (Pvt.) Ltd.
Unitech World
Sector-39, Gurgaon
Haryana-India
 
The information contained in this e-mail and any accompanying documents may contain information that is confidential or otherwise protected from disclosure. If you are not the intended recipient of this message, or if this message has been addressed to you in error, please immediately alert the sender by reply e-mail and then delete this message, including any attachments. Any dissemination, distribution or other use of the contents of this message by anyone other than the intended recipient 
is strictly prohibited.



Re: Problems while using double quotes

Posted by Chris Hostetter <ho...@fucit.org>.
: in my search criteria i am using a criteria "apache tomcat" but it is
: giving me a parse exception.

if i understand you correctly, you're saying that when searchQuery is...

	"apache tomcat"

you get a parse error? .. is that by any chance because you are allways
attaching a "*" to the end of searchQuery in the makeWildcardQuery method,
so what you wind up passing to the QueryParser is...

	"apache tomcat"*

... ? ... that's not a legal query string.



:
: my searcher has this piece of code:
:
: searchQuery=makeWildcardQuery(searchQuery);
: masterQuery.add(MultiFieldQueryParser.parse(searchQuery,fields,analyzer),REQUIRED,PROHIBITED);
:
:
:
:
: private String makeWildcardQuery(String query)
:     {
:         String result = query.trim();
:
:         if (0 != result.length())
:         {
:             if (!result.endsWith("*"))
:             {
:                 result = result + "*";
:             }
:         }
:
:         return result;
:     }
:
: Thanks and Regards
: Krishnendra Nandi
: Hewitt Associates India (Pvt.) Ltd.
: Unitech World
: Sector-39, Gurgaon
: Haryana-India
:
: The information contained in this e-mail and any accompanying documents may contain information that is confidential or otherwise protected from disclosure. If you are not the intended recipient of this message, or if this message has been addressed to you in error, please immediately alert the sender by reply e-mail and then delete this message, including any attachments. Any dissemination, distribution or other use of the contents of this message by anyone other than the intended recipient
: is strictly prohibited.
:
:
:



-Hoss


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