Return-Path: Delivered-To: apmail-lucene-java-dev-archive@www.apache.org Received: (qmail 83707 invoked from network); 8 Feb 2010 09:58:30 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 8 Feb 2010 09:58:30 -0000 Received: (qmail 54567 invoked by uid 500); 8 Feb 2010 09:58:29 -0000 Delivered-To: apmail-lucene-java-dev-archive@lucene.apache.org Received: (qmail 54485 invoked by uid 500); 8 Feb 2010 09:58:29 -0000 Mailing-List: contact java-dev-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: java-dev@lucene.apache.org Delivered-To: mailing list java-dev@lucene.apache.org Received: (qmail 54477 invoked by uid 99); 8 Feb 2010 09:58:29 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 08 Feb 2010 09:58:29 +0000 X-ASF-Spam-Status: No, hits=1.2 required=10.0 tests=SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: local policy) Received: from [85.25.71.29] (HELO mail.troja.net) (85.25.71.29) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 08 Feb 2010 09:58:19 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.troja.net (Postfix) with ESMTP id 98AAD45FD0E; Mon, 8 Feb 2010 10:57:57 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at mail.troja.net Received: from mail.troja.net ([127.0.0.1]) by localhost (megaira.troja.net [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id IUZO1Itlwc-S; Mon, 8 Feb 2010 10:57:47 +0100 (CET) Received: from VEGA (unknown [134.102.249.78]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by mail.troja.net (Postfix) with ESMTPSA id 69DAB45FD04; Mon, 8 Feb 2010 10:57:47 +0100 (CET) From: "Uwe Schindler" To: , References: <50e5f6251002070933p4f9e6150t27ef86fd36ea59c2@mail.gmail.com> <000601caa81e$7dfdc9f0$79f95dd0$@de> <8f0ad1f31002071033q1fe3ec9exe3cc8a94756413b5@mail.gmail.com> <50e5f6251002071117u4e994a85m3865cc87305798bf@mail.gmail.com> In-Reply-To: Subject: RE: Having a default constructor in Analyzers Date: Mon, 8 Feb 2010 10:57:47 +0100 Message-ID: <001b01caa8a5$2b672290$823567b0$@de> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Office Outlook 12.0 Thread-index: AcqoLK7orLVT+wCPRZmSTIj70DD2NgAdccxg Content-language: de Simon: > Sanne, I would recommend you building a Factory pattern around you > Analyzers / TokenStreams similar to what solr does. That way you can > load you own "default ctor" interface via reflection and obtain you > analyzers from those factories. That makes more sense anyway as you > only load the factory via reflection an not the analyzers. As far as I see, Hibernate uses Solr Factories. On the other hand, you = can instead of creating your own SolrAnalyzer also use a "standard" one = from Lucene (you can do this in Solr, too): http://docs.jboss.org/hibernate/stable/search/reference/en/html_single/#a= nalyzer In my opinion, the Factory pattern is ok for own analyzer definitions. = For reusing "standard" analyzers like "StandardAnalyzer" or = "TurkishAnalyzer", the ideal case is to use the reflection code I = proposed before. This code works for all language-based analyzers having = a standard ctor or Version ctor. Solr will also handle this = reflection-based instantiation with optional Version parameter in = future, too (Eric Hatcher pointed that out to me, when working on = SOLR-1677: "Another comment on this... Solr supports using an Analyzer = also, but only ones with zero-arg constructors. It would be nice if this = Version support also allowed for Analyzers (say SmartChineseAnalyzer) to = be used also directly. I don't think this patch accounts for this case, = does it?"). As Hibernate also uses the factory pattern for custom analyzers, as soon = as https://issues.apache.org/jira/browse/SOLR-1677 is in, the version = problem for those should be solved, too (as you can specify the = parameter to each component). But Hibernate should also think about a = global default Version (like Solr via CoreAware or like that), that is = used as a default param to all Tokenizers/TokenFilters and when = reflection-based Anaylzer subclass instantiation is used. By the way, hibernate's reuse of Solr's schema is one argument of Hoss, = not to make it CoreAware. Uwe --------------------------------------------------------------------- To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org For additional commands, e-mail: java-dev-help@lucene.apache.org