Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id ADD36200C4E for ; Fri, 21 Apr 2017 17:55:08 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id AC7B9160BA2; Fri, 21 Apr 2017 15:55:08 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id F08EF160B97 for ; Fri, 21 Apr 2017 17:55:07 +0200 (CEST) Received: (qmail 70406 invoked by uid 500); 21 Apr 2017 15:55:06 -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 70394 invoked by uid 99); 21 Apr 2017 15:55:06 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 21 Apr 2017 15:55:06 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id 841B41AFBFD for ; Fri, 21 Apr 2017 15:55:05 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 0.379 X-Spam-Level: X-Spam-Status: No, score=0.379 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RCVD_IN_SORBS_SPAM=0.5, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd2-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id sSS5wN472vaq for ; Fri, 21 Apr 2017 15:55:03 +0000 (UTC) Received: from mail-wm0-f42.google.com (mail-wm0-f42.google.com [74.125.82.42]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTPS id 09CD85F485 for ; Fri, 21 Apr 2017 15:55:03 +0000 (UTC) Received: by mail-wm0-f42.google.com with SMTP id o81so19094192wmb.1 for ; Fri, 21 Apr 2017 08:55:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:content-transfer-encoding:mime-version:subject:date:references :to:in-reply-to:message-id; bh=9+9WVAozFjaReSUTyDhTP5NGUpht6s+Ol3jjINUvZYc=; b=kGXQOY7/9CR5GswK1WjiI0jHdxcdCTswGRuG2IMQzUgKZEAKwrbDnBFNRsPi0u5vGq MYDcdFxJFKPRvFTiy+hfjbO/XvjterIIfmVCu6oia6vkzv5OUtD9VX9fjKoMqM/Ul4HS 26hQzJ1B3EdT91taR9gYFeR3bgsysDk0gXFZLr3DPEMwIweIOpKEvl+4s7PEYChjoyTk YQUrYW7ZEJJMYegWi8JtuoqhoGVsBdLjcQcLGw2RnhUptYlHNr/J7SQqqY/w5GFwRnpZ PSi7OGJCM4XQ3i6xNhxzbwzFhR5wcAO35idm0cUG3o2Cqu2jf1PnenniD9FlVj6xBBVC E5fw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:content-transfer-encoding:mime-version :subject:date:references:to:in-reply-to:message-id; bh=9+9WVAozFjaReSUTyDhTP5NGUpht6s+Ol3jjINUvZYc=; b=OZceDYRBsOPJ8iuzu74mQZ/gLrPS2q2nVlvj+h/1FPPIfRrcoWaDwSTbrAFtVJ87ZF Y/1vh84QdlqQWE7BPZcVV4ndiQNJL5A8q3pGEaH3CoxJ4rwsy8cRqUvDluGa+beSnux2 yy0jG42QMTgh94r37arttflJ63f0pte8GSyJz+oUj69qvdLfK3wWFbbbeAJe9umMmuG3 TJpcZGx0YXKyWGJBoyyMmHL2BjqKmgM9QarsQmjPokBYn+Pp4opzD2pFEYIv98XvEsI3 e2tkQyvAx6p7vipQo422VXSnDRxGeJqQSS7Hh5pO3O0IdL9dXS0EcsJCFmUxg8dJGJvU YNpg== X-Gm-Message-State: AN3rC/7jC17uW2ObPk5CkBRHmgYa/fPGWz4hZnMnbLYW3bUn8oibeTj6 KX5+MunbNUBIRlLbbq4= X-Received: by 10.80.148.123 with SMTP id q56mr64354eda.58.1492790102331; Fri, 21 Apr 2017 08:55:02 -0700 (PDT) Received: from [192.168.1.23] ([92.109.70.250]) by smtp.gmail.com with ESMTPSA id e24sm496553edb.20.2017.04.21.08.55.00 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 21 Apr 2017 08:55:00 -0700 (PDT) From: Edoardo Causarano Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Subject: Re: A question over TokenFilters Date: Fri, 21 Apr 2017 17:55:10 +0200 References: <326B6D52-2008-4CE2-982E-2CF4953483F0@gmail.com> <52124279.1413064.1492788731521@mail.yahoo.com> To: java-user@lucene.apache.org In-Reply-To: <52124279.1413064.1492788731521@mail.yahoo.com> Message-Id: X-Mailer: Apple Mail (2.3273) archived-at: Fri, 21 Apr 2017 15:55:08 -0000 Hi, thanks for your reply. In several other implementations I=E2=80=99ve = seen this pattern of using a while(input.incrementToken()) within the = filter=E2=80=99s incrementToken method. Is this approach recommended or = are there hidden traps (eg: memory consumption, dependency on filter = ordering and so on)=20 Best, Edoardo > On 21 Apr 2017, at 17:32, Ahmet Arslan = wrote: >=20 > Hi, > LimitTokenCountFilter is used to index first n tokens. May be it can = inspire you. >=20 > Ahmet > On Friday, April 21, 2017, 6:20:11 PM GMT+3, Edoardo Causarano = wrote: > Hi all. >=20 > I=E2=80=99m relatively new to Lucene, so I have a couple questions = about writing custom filters. >=20 > The way I understand it, one would extend = org.apache.lucene.analysis.TokenFilter and override #incrementToken to = examine the current token provided by a stream token producer. >=20 > I=E2=80=99d like to write some logic that considers the last n seen = tokens therefore I need to access this context as the filter chain is = scanning the stream. >=20 > Can anyone point to an example of such a construct?=20 >=20 > Also, how would I access and update this context keeping = multithreading in mind? Actually, what is the treading model of a = TokenStream, can anyone point out a good summary for it? >=20 > TIA >=20 >=20 > Best, > Edoardo > --------------------------------------------------------------------- > 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