Return-Path: Delivered-To: apmail-lucene-java-user-archive@www.apache.org Received: (qmail 84241 invoked from network); 15 Feb 2007 09:21:51 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 15 Feb 2007 09:21:51 -0000 Received: (qmail 96320 invoked by uid 500); 15 Feb 2007 09:21:52 -0000 Delivered-To: apmail-lucene-java-user-archive@lucene.apache.org Received: (qmail 96294 invoked by uid 500); 15 Feb 2007 09:21:51 -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 96283 invoked by uid 99); 15 Feb 2007 09:21:51 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 15 Feb 2007 01:21:51 -0800 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: local policy) Received: from [84.96.21.10] (HELO trinity.anyware-tech.com) (84.96.21.10) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 15 Feb 2007 01:21:41 -0800 Received: from localhost (localhost [127.0.0.1]) by trinity.anyware-tech.com (Postfix) with ESMTP id A508D40960B for ; Thu, 15 Feb 2007 10:21:18 +0100 (CET) Received: from trinity.anyware-tech.com ([127.0.0.1]) by localhost (trinity.anyware-tech.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 08962-04 for ; Thu, 15 Feb 2007 10:21:08 +0100 (CET) Received: from bumbo.anyware (bumbo.anyware [10.0.3.29]) by trinity.anyware-tech.com (Postfix) with ESMTP id 3B77740949B for ; Thu, 15 Feb 2007 10:21:08 +0100 (CET) From: Nicolas =?iso-8859-1?q?Lalev=E9e?= Organization: Anyware Technologies To: java-user@lucene.apache.org Subject: Decorating a Query Date: Thu, 15 Feb 2007 10:21:06 +0100 User-Agent: KMail/1.9.5 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Message-Id: <200702151021.06794.nicolas.lalevee@anyware-tech.com> X-Virus-Scanned: Debian amavisd-new at anyware-tech.com X-Virus-Checked: Checked by ClamAV on apache.org Hi, I wanted to implement my own query, query wich will be specific to my=20 application. The query I want to implement is in fact just a combinaison of= =20 sevral already implemented queries. So acheive this, I do this kind of=20 things : public class MyQuery extends Query { private Query query; public MyQuery(String foo) { query =3D new TermQuery("myfield", foo); } public Weight weight(Searcher searcher) throws IOException { return query.weight(searcher); } public String toString(String field) { return foo; } } But I have an issue with that kind of queries : I cannot implement=20 createWeight() as I cannot access this function on the underlying query. So= =20 the Query's function is used with raise a UnsupportedOperationException. Fo= r=20 basic search.search(query), it works. But when I want to filter it : query =3D new FilteredQuery(query, filter); search.search(query); This raise the UnsupportedOperationException. I just see two options there. * make my own interface which is a factory of query. But I lost the=20 flexibility of extending Query. Even if I want to do a little term query, I= =20 will have to make a factory of this term query. * patch Lucene to make createWeight() public any other advise ? cheers, Nicolas =2D-=20 Nicolas LALEV=C9E Solutions & Technologies ANYWARE TECHNOLOGIES Tel : +33 (0)5 61 00 52 90 =46ax : +33 (0)5 61 00 51 46 http://www.anyware-tech.com --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org For additional commands, e-mail: java-user-help@lucene.apache.org