Return-Path: X-Original-To: apmail-lucene-java-user-archive@www.apache.org Delivered-To: apmail-lucene-java-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id AE2B6D2A5 for ; Mon, 1 Oct 2012 14:34:37 +0000 (UTC) Received: (qmail 23317 invoked by uid 500); 1 Oct 2012 14:34:35 -0000 Delivered-To: apmail-lucene-java-user-archive@lucene.apache.org Received: (qmail 23262 invoked by uid 500); 1 Oct 2012 14:34:35 -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 23254 invoked by uid 99); 1 Oct 2012 14:34:35 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 01 Oct 2012 14:34:35 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of jochenhebbrecht@gmail.com designates 209.85.220.176 as permitted sender) Received: from [209.85.220.176] (HELO mail-vc0-f176.google.com) (209.85.220.176) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 01 Oct 2012 14:34:28 +0000 Received: by vcbgb22 with SMTP id gb22so7168783vcb.35 for ; Mon, 01 Oct 2012 07:34:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=G6ocz4Rv5PQE+yPe/waeDCT3KarCh/pMq4Wc68Twog0=; b=wYhGLK/HVsuobUym3RAiL/A2ax1ndkHWHNnUqxhoomMBTvIOZ2RFvaNu8Aff088kBG 5R4s2E04iy4uvlYpZK07E+bHjcvbB5ZCzKOxDqvd3HqIVEkkB0LJIa5thHRZPF28N9mx k60KP+46f7U67opgc1WeYQ8Ox0CjqOersmr/4ucp+4mS7WBnvbAuOpd4NgMDa5h2cJCJ VM1IlS5Duo3kWB2X3PHuqmECFIXP5322mdOez3LXHftyhd+tpCvCsdxGbDhl5F4v7XVO NIKFISqJTZAKu93IvEKdbSvhEj/ZXIuhPeJ3fM/ZGmwcF7RYtWGqtcN0tzOQaY6aH1sz iKZQ== MIME-Version: 1.0 Received: by 10.58.125.39 with SMTP id mn7mr8711274veb.37.1349102047922; Mon, 01 Oct 2012 07:34:07 -0700 (PDT) Received: by 10.220.129.11 with HTTP; Mon, 1 Oct 2012 07:34:07 -0700 (PDT) In-Reply-To: <4FB7C08158A448B09E305C1F76DF3261@JackKrupansky> References: <23719B3684194B6A8C67DFBD43A03C56@JackKrupansky> <4FB7C08158A448B09E305C1F76DF3261@JackKrupansky> Date: Mon, 1 Oct 2012 16:34:07 +0200 Message-ID: Subject: Re: Searching for a search string containing a literal slash doesn't work with QueryParser From: Jochen Hebbrecht To: java-user@lucene.apache.org Content-Type: multipart/alternative; boundary=047d7b5db12c550aa504cb004ced --047d7b5db12c550aa504cb004ced Content-Type: text/plain; charset=ISO-8859-1 Hi Jack, I tried analyzing through WhitespaceAnalyzer. Now I can search on my query string AND I can find my document! Great! But all my searches are now case sensitive. So when I index a field as "JavaOne", I also have to enter in my search word: "JavaOne" and not "javaone" or "javaOne". How do you solve this in a proper way? Bringing all characters toLowerCase() when indexing them? Jochen 2012/10/1 Jack Krupansky > That's "The escape merely..." > > -- Jack Krupansky > > -----Original Message----- From: Jack Krupansky > Sent: Monday, October 01, 2012 9:58 AM > To: java-user@lucene.apache.org > Subject: Re: Searching for a search string containing a literal slash > doesn't work with QueryParser > > > The scape merely assures that the slash will not be parsed as query syntax > and will be passed directly to the analyzer, but the standard analyzer will > in fact always remove it. Maybe you want the white space analyzer or > keyword > analyzer (no characters removed.) > > -- Jack Krupansky > > -----Original Message----- From: Jochen Hebbrecht > Sent: Monday, October 01, 2012 8:59 AM > To: java-user@lucene.apache.org > Subject: Searching for a search string containing a literal slash doesn't > work with QueryParser > > Hi, > > I'm currently trying to search on the following search string in my Lucene > index: "2012/0.124.323". > The java code to search for ('value' is my search string) > > ---- > QueryParser queryParser = new QueryParser(Version.LUCENE_36, field, new > StandardAnalyzer(Version.**LUCENE_36)); > queryParser.**setAllowLeadingWildcard(true); > return queryParser.parse(value); > ---- > > This returns a query result: "2012" "0.124.323". QueryParser is replacing > the forward slash by a space. > I tried escaping the "/" with a backslash "\", but this doesn't work > either. > > Maybe required to fully understand my scenario. I have the following import > XML: > > --- > ... > Vervaldag > 17/07/12 > 09/07/12 > 2012/0.124.323 > Kapitaals > ... > --- > > I get all TEXT values with an XPath expression and I index them as: > > --- > XPathExpression expr = xpath.compile("//TEXT"); > Object result = expr.evaluate(document, XPathConstants.NODESET); > NodeList nodes = (NodeList) result; > for (int i = 0; i < nodes.getLength(); i++) { > doc.add(new org.apache.lucene.document.**Field("IMAGE", > nodes.item(i).getFirstChild().**getNodeValue(), Store.NO, > Index.ANALYZED)); > } > --- > > I'm using the StandardAnalyzer. > > What is the best way to solve my issue? Do I need to switch from Analyzer? > Do I have to use something else then QueryParser? ... > I also want to support searching on 2012/0.*, so I cannot only use > TermQuery ... > > Kind regards, > Jochen > > > ------------------------------**------------------------------**--------- > To unsubscribe, e-mail: java-user-unsubscribe@lucene.**apache.org > For additional commands, e-mail: java-user-help@lucene.apache.**org > > ------------------------------**------------------------------**--------- > To unsubscribe, e-mail: java-user-unsubscribe@lucene.**apache.org > For additional commands, e-mail: java-user-help@lucene.apache.**org > > --047d7b5db12c550aa504cb004ced--