From dev-return-322178-archive-asf-public=cust-asf.ponee.io@lucene.apache.org Tue May 15 03:51:05 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 49472180627 for ; Tue, 15 May 2018 03:51:05 +0200 (CEST) Received: (qmail 62091 invoked by uid 500); 15 May 2018 01:51:03 -0000 Mailing-List: contact dev-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@lucene.apache.org Delivered-To: mailing list dev@lucene.apache.org Received: (qmail 62080 invoked by uid 99); 15 May 2018 01:51:03 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 15 May 2018 01:51:03 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id 579BB1807F4 for ; Tue, 15 May 2018 01:51:03 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -109.511 X-Spam-Level: X-Spam-Status: No, score=-109.511 tagged_above=-999 required=6.31 tests=[ENV_AND_HDR_SPF_MATCH=-0.5, KAM_ASCII_DIVIDERS=0.8, RCVD_IN_DNSWL_MED=-2.3, SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-0.01, USER_IN_DEF_SPF_WL=-7.5, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id d-wy1h7Q-eRo for ; Tue, 15 May 2018 01:51:02 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTP id 343105FB9D for ; Tue, 15 May 2018 01:51:01 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 5FB28E0161 for ; Tue, 15 May 2018 01:51:00 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 21C73217A0 for ; Tue, 15 May 2018 01:51:00 +0000 (UTC) Date: Tue, 15 May 2018 01:51:00 +0000 (UTC) From: "Steve Rowe (JIRA)" To: dev@lucene.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Comment Edited] (LUCENE-8273) Add a ConditionalTokenFilter MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/LUCENE-8273?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16475166#comment-16475166 ] Steve Rowe edited comment on LUCENE-8273 at 5/15/18 1:50 AM: ------------------------------------------------------------- I stumbled on what looks like a {{ProtectedTermFilter}} bug when a wrapped filter is a filtering token filter, and the content to be analyzed contains at least one non-protected term prior to a protected term; in this case protection fails: {code:java|title=TestProtectedTermFilter.java} public void testWrappedFilteringTokenFilter() throws IOException { CharArraySet protectedTerms = new CharArraySet(5, true); protectedTerms.add("foobar"); TokenStream stream = whitespaceMockTokenizer("foobar abc"); stream = new ProtectedTermFilter(protectedTerms, stream, in -> new LengthFilter(in, 1, 4)); assertTokenStreamContents(stream, new String[]{ "foobar", "abc" }); // succeeds stream = whitespaceMockTokenizer("wuthering foobar abc"); stream = new ProtectedTermFilter(protectedTerms, stream, in -> new LengthFilter(in, 1, 4)); assertTokenStreamContents(stream, new String[]{ "foobar", "abc" }); // fails @ term 0: Actual: abc } {code} I haven't yet figured out what the problem is. Alan, do you understand what's happening here? was (Author: steve_rowe): I stumbled on what looks like a {{ProtectedTermFilter}} bug when a wrapped filter is a filtering token filter, and the content to be analyzed contains at least one non-protected term prior to a protected term; in this case protection fails: {code:java|title=TestProtectedTerm.java} public void testWrappedFilteringTokenFilter() throws IOException { CharArraySet protectedTerms = new CharArraySet(5, true); protectedTerms.add("foobar"); TokenStream stream = whitespaceMockTokenizer("foobar abc"); stream = new ProtectedTermFilter(protectedTerms, stream, in -> new LengthFilter(in, 1, 4)); assertTokenStreamContents(stream, new String[]{ "foobar", "abc" }); // succeeds stream = whitespaceMockTokenizer("wuthering foobar abc"); stream = new ProtectedTermFilter(protectedTerms, stream, in -> new LengthFilter(in, 1, 4)); assertTokenStreamContents(stream, new String[]{ "foobar", "abc" }); // fails @ term 0: Actual: abc } {code} I haven't yet figured out what the problem is. Alan, do you understand what's happening here? > Add a ConditionalTokenFilter > ---------------------------- > > Key: LUCENE-8273 > URL: https://issues.apache.org/jira/browse/LUCENE-8273 > Project: Lucene - Core > Issue Type: New Feature > Reporter: Alan Woodward > Assignee: Alan Woodward > Priority: Major > Fix For: 7.4 > > Attachments: LUCENE-8273-part2.patch, LUCENE-8273.patch, LUCENE-8273.patch, LUCENE-8273.patch, LUCENE-8273.patch, LUCENE-8273.patch, LUCENE-8273.patch, LUCENE-8273.patch, LUCENE-8273.patch > > > Spinoff of LUCENE-8265. It would be useful to be able to wrap a TokenFilter in such a way that it could optionally be bypassed based on the current state of the TokenStream. This could be used to, for example, only apply WordDelimiterFilter to terms that contain hyphens. -- This message was sent by Atlassian JIRA (v7.6.3#76005) --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org For additional commands, e-mail: dev-help@lucene.apache.org