Return-Path: Delivered-To: apmail-lucene-java-user-archive@www.apache.org Received: (qmail 8558 invoked from network); 4 Apr 2007 21:56:22 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 4 Apr 2007 21:56:22 -0000 Received: (qmail 79009 invoked by uid 500); 4 Apr 2007 21:56:10 -0000 Delivered-To: apmail-lucene-java-user-archive@lucene.apache.org Received: (qmail 78979 invoked by uid 500); 4 Apr 2007 21:56:10 -0000 Mailing-List: contact java-user-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: java-user@lucene.apache.org Delivered-To: mailing list java-user@lucene.apache.org Received: (qmail 78954 invoked by uid 99); 4 Apr 2007 21:56:09 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 04 Apr 2007 14:56:09 -0700 X-ASF-Spam-Status: No, hits=2.0 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: domain of erickerickson@gmail.com designates 209.85.132.241 as permitted sender) Received: from [209.85.132.241] (HELO an-out-0708.google.com) (209.85.132.241) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 04 Apr 2007 14:56:01 -0700 Received: by an-out-0708.google.com with SMTP id c3so392144ana for ; Wed, 04 Apr 2007 14:55:40 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; b=McfW5u0DpMWWpTBEEuaQ3sFrmyuXAvWtViwvVRWszozYOzFcYSpOCO5xm4bMbX2ObpX/S2auPvCVqvTq1uidF+GrkWfzvkj82zX38713ccNHDASkW5LyW9hHLYvC3LtHKIf2gRc0QUFcqKR2vK2aHj55cjFfoo/0d1KAv0i/xYo= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; b=Fr+iy9vqUEZxcOUwc5BegugpptNUKp6xsuoArc+MfEB/JAvehMv/jF5GyIrC6WaYiFHg7viZ4RyD3/0p5Al/5F6yAC6T25QUpgYERkBWsl4u9el1M0PnXELqIsgU1fAGxvBMjv6lTcygQhjZrjRQjf0L7aPwm6ejTR3CnCeIO+Y= Received: by 10.114.14.1 with SMTP id 1mr447911wan.1175723740112; Wed, 04 Apr 2007 14:55:40 -0700 (PDT) Received: by 10.114.58.3 with HTTP; Wed, 4 Apr 2007 14:55:40 -0700 (PDT) Message-ID: <359a92830704041455v6739a312v885c1518cab0c4af@mail.gmail.com> Date: Wed, 4 Apr 2007 17:55:40 -0400 From: "Erick Erickson" To: java-user@lucene.apache.org Subject: Re: Better parsing of Queries In-Reply-To: <20070404204212.GP27177@thegestalt.org> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_40640_5520453.1175723740054" References: <20070404204212.GP27177@thegestalt.org> X-Virus-Checked: Checked by ClamAV on apache.org ------=_Part_40640_5520453.1175723740054 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline About all you can do is roll your own. I suspect a decent regular expression would work, or you could let Lucene escape the query and then re-replace all \: with : Erick On 4/4/07, Simon Wistow wrote: > > I'm looking for some advice on dealing with malformed queries. > > If a user searches for "yow!" then I get an exception from the query > parser. I can get round this by using QueryParser.escape(query) first > but then that prevents them from searching using other bits of the the > query syntax such as "author:alice". > > Is there an easy way to get a query such as > > "yow! author:alice" > > and get back > > "yow\! author:alice" > > i.e only escape the special characters when they don't make sense? > > Simon > > --------------------------------------------------------------------- > To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org > For additional commands, e-mail: java-user-help@lucene.apache.org > > ------=_Part_40640_5520453.1175723740054--