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 9B0739716 for ; Tue, 26 Jun 2012 03:14:50 +0000 (UTC) Received: (qmail 28559 invoked by uid 500); 26 Jun 2012 03:14:48 -0000 Delivered-To: apmail-lucene-java-user-archive@lucene.apache.org Received: (qmail 28509 invoked by uid 500); 26 Jun 2012 03:14:47 -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 28494 invoked by uid 99); 26 Jun 2012 03:14:47 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 26 Jun 2012 03:14:47 +0000 X-ASF-Spam-Status: No, hits=0.0 required=5.0 tests=FSL_RCVD_USER,RCVD_IN_DNSWL_NONE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of SRS0=w61RBm=E5=basetechnology.com=jack@yourhostingaccount.com designates 65.254.253.147 as permitted sender) Received: from [65.254.253.147] (HELO mailout18.yourhostingaccount.com) (65.254.253.147) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 26 Jun 2012 03:14:39 +0000 Received: from mailscan11.yourhostingaccount.com ([10.1.15.11] helo=mailscan11.yourhostingaccount.com) by mailout18.yourhostingaccount.com with esmtp (Exim) id 1SjMEN-00013R-5T for java-user@lucene.apache.org; Mon, 25 Jun 2012 23:14:19 -0400 Received: from impout02.yourhostingaccount.com ([10.1.55.2] helo=impout02.yourhostingaccount.com) by mailscan11.yourhostingaccount.com with esmtp (Exim) id 1SjMEM-0001nn-Sz for java-user@lucene.apache.org; Mon, 25 Jun 2012 23:14:18 -0400 Received: from authsmtp10.yourhostingaccount.com ([10.1.18.10]) by impout02.yourhostingaccount.com with NO UCE id SrEJ1j00E0D2B7u01rEJNq; Mon, 25 Jun 2012 23:14:18 -0400 X-Authority-Analysis: v=2.0 cv=DNMNElxb c=1 sm=1 a=sNxxokvI1LyqtxdLLXP0YQ==:17 a=aQzbgH187woA:10 a=3jZET7lWBKwA:10 a=8nJEP1OIZ-IA:10 a=jvYhGVW7AAAA:8 a=MdS5HHncAAAA:8 a=mV9VRH-2AAAA:8 a=_HB2Lj0kSYy9358XACYA:9 a=wPNLvfGTeEIA:10 a=BsA0RV6odtIA:10 a=2gI1vAumJwWs0gD4Ojj1yg==:117 X-EN-OrigOutIP: 10.1.18.10 X-EN-IMPSID: SrEJ1j00E0D2B7u01rEJNq Received: from c-66-41-251-232.hsd1.mn.comcast.net ([66.41.251.232] helo=JackKrupansky) by authsmtp10.yourhostingaccount.com with esmtpa (Exim) id 1SjMEM-0001P0-Db for java-user@lucene.apache.org; Mon, 25 Jun 2012 23:14:18 -0400 Message-ID: From: "Jack Krupansky" To: References: <43423e032b18adec4abbeec663cc5ba5@alphamatrix.org> <6C78E97C707B5B4C8CC61D44F87545862A3778@SUEX10-mbx-03.ad.syr.edu> <2222907.qYrRHbxzSs@linux-1vyr.site> <4630289.dj3glixndt@linux-1vyr.site> In-Reply-To: <4630289.dj3glixndt@linux-1vyr.site> Subject: Re: how to remove the dash Date: Mon, 25 Jun 2012 22:14:15 -0500 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=original Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal Importance: Normal X-Mailer: Microsoft Windows Live Mail 15.4.3555.308 X-MimeOLE: Produced By Microsoft MimeOLE V15.4.3555.308 X-EN-UserInfo: e0a4b55451ed9f27313ebf02e3d4348d:fc4a93e1349e680c52bdd723c0ab3ef6 X-EN-AuthUser: jack@basetechnology.com Sender: "Jack Krupansky" X-EN-OrigIP: 66.41.251.232 X-EN-OrigHost: c-66-41-251-232.hsd1.mn.comcast.net Most query parsers will "parse" a leading hyphen as an operator, so it will never get to the analyzer for any field. Whether white space is permitted between the "-" operator and the following term is dependent on the specific query parser, and not guaranteed. So, "bebidas - agua" is parsed by the query parser the same as "bebidas -agua", which is the "prohibit" operator. This is all as it should be. Generally, all operators, including "+", "-", parentheses, "AND", "OR, etc. need to be escaped if you want them to be passed through to the field analyzers. Operators embedded within terms do not need to be escaped, except for parentheses. So, if you want user input to be treated as raw English text, as opposed to a "structured" query, be sure to filter or escape the user query text before parsing it. Or, consider using a simple term query that does no query "parsing", but does pass the term through the field analyzer for the desired field type. -- Jack Krupansky -----Original Message----- From: listas@alphamatrix.org Sent: Monday, June 25, 2012 4:12 PM To: java-user@lucene.apache.org Subject: Re: how to remove the dash More information... If I change System.out.println("Query: " + query.toString("contents")); to this: System.out.println("Query: " + query.toString()); I get this result: "Query: contents:bebidas -contents:agua" As I already tried many diferent Analyzers and I always get the same result maybe it's a problem on the query parser?? A Segunda, 25 de Junho de 2012 21:10:02 listas@alphamatrix.org escreveu: > You are right... i'am not geting the hyphen inside any token... but it still > used as "prohibit operator". > > This is my output: > Test: bebidas - agua > Query: bebidas -agua > Tokens: > 1: [bebidas:0->7:] > 2: [agua:10->14:] > > Test is the original string. > Thanks --------------------------------------------------------------------- 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