Return-Path: Delivered-To: apmail-lucene-java-user-archive@www.apache.org Received: (qmail 85655 invoked from network); 1 Jun 2007 06:12:23 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 1 Jun 2007 06:12:23 -0000 Received: (qmail 52048 invoked by uid 500); 1 Jun 2007 06:12:21 -0000 Delivered-To: apmail-lucene-java-user-archive@lucene.apache.org Received: (qmail 51847 invoked by uid 500); 1 Jun 2007 06:12:20 -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 51836 invoked by uid 99); 1 Jun 2007 06:12:20 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 31 May 2007 23:12:20 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: domain of lists@nabble.com designates 216.139.236.158 as permitted sender) Received: from [216.139.236.158] (HELO kuber.nabble.com) (216.139.236.158) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 31 May 2007 23:12:13 -0700 Received: from isper.nabble.com ([192.168.236.156]) by kuber.nabble.com with esmtp (Exim 4.63) (envelope-from ) id 1Hu0Mb-0000AV-3E for java-user@lucene.apache.org; Thu, 31 May 2007 23:11:53 -0700 Message-ID: <10907265.post@talk.nabble.com> Date: Thu, 31 May 2007 23:11:53 -0700 (PDT) From: Vaasu To: java-user@lucene.apache.org Subject: Re: Creating parser query "by hand" In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Nabble-From: srinivasay@aztecsoft.com References: <43130817.2020706@fischer.name> X-Virus-Checked: Checked by ClamAV on apache.org Hi, I am working on search using lucene2.0.0. My requirement is to construct a lucene query in the form of string (+contents:java programming +author:xxx) and then this is used to construct lucene query so that it can be searched using lucene searcher. I want to know, how to convert String query into lucene Query? so that it can be searchable. is this possible? I will be thankful if you can send any samples for this. Thanks, Vaasu. Erik Hatcher wrote: > > On Aug 29, 2005, at 9:05 AM, Markus Fischer wrote: >> I currently pass the search tokens as Vector to my query function >> and construct the string to pass to the QueryParse.parse() by hand. >> >> StringBuffer qStr = new StringBuffer(); >> qStr.append("title:" + queryString.trim() + "^7 "); >> [...] >> >> and this append for every field I want to search in. >> >> When I started with lucene I had found a site saying that the >> performance would be better to craft the query token by hand and >> not having QueryParse.parse() parse my string again when I've >> already everything to built the tokens myself. >> >> Unfortuantely I can't find this site again and I can't find an >> example on how it works to actually create the tokens myself and >> pass them to the searcher. >> >> Any help would be appriciated. > > Whether you parse or not in this case depends on whether the tokens > in the Vector are exactly the tokens you indexed or not. If they > are, then you could create a BooleanQuery, construct a TermQuery for > each token and add it to the BooleanQuery. Eliminating the use of > QueryParser when not needed may not be a performance booster, but it > certainly eliminates a source of confusion or unexpected queries > because of QP morphing them via parsing and analysis. > > Erik > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org > For additional commands, e-mail: java-user-help@lucene.apache.org > > > -- View this message in context: http://www.nabble.com/Creating-parser-query-%22by-hand%22-tf261639.html#a10907265 Sent from the Lucene - Java Users mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org For additional commands, e-mail: java-user-help@lucene.apache.org