Return-Path: Delivered-To: apmail-lucene-java-user-archive@www.apache.org Received: (qmail 25445 invoked from network); 29 Jun 2007 00:48:49 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 29 Jun 2007 00:48:49 -0000 Received: (qmail 16246 invoked by uid 500); 29 Jun 2007 00:48:46 -0000 Delivered-To: apmail-lucene-java-user-archive@lucene.apache.org Received: (qmail 16192 invoked by uid 500); 29 Jun 2007 00:48:46 -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 16181 invoked by uid 99); 29 Jun 2007 00:48:45 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 28 Jun 2007 17:48:45 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: domain of markrmiller@gmail.com designates 66.249.82.237 as permitted sender) Received: from [66.249.82.237] (HELO wx-out-0506.google.com) (66.249.82.237) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 28 Jun 2007 17:48:40 -0700 Received: by wx-out-0506.google.com with SMTP id i28so585484wxd for ; Thu, 28 Jun 2007 17:48:20 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:user-agent:mime-version:to:subject:references:in-reply-to:content-type:content-transfer-encoding; b=ThKlmVwH/PjMkF/Z1STReoTwlNUPBq21J2GqN8HEvqQ2xbHpTaaGzHs683KUpIVWyTW+4ATckOCckoYywz3YjEv2Plh/QPc0kCUX1hE3SIpIk1C7CJWpagnL733lonSIs9tS1bYG1Pz/QB4yvwl13KB5XjU3Sd5HUdi/6jSLx5g= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:user-agent:mime-version:to:subject:references:in-reply-to:content-type:content-transfer-encoding; b=DcsK7WsKxzpuVc+dHGmZe9ObTFQ6635gHtpn+ozIZL6Q4TFyoOL/blZujOXxM9r4Cz/eQhG0AYkkAoD87IZQMTx3F5u2QCgx54ibp0G+llU7tL1PCx9i+IRSkXxK/3yW6yFhd41aqXLajulsICHH+MwZohnrbpYdlEh6Os7UsW8= Received: by 10.70.45.10 with SMTP id s10mr49644wxs.1183078099922; Thu, 28 Jun 2007 17:48:19 -0700 (PDT) Received: from ?192.168.1.100? ( [216.66.114.204]) by mx.google.com with ESMTP id o29sm5154897elf.2007.06.28.17.48.18 (version=SSLv3 cipher=RC4-MD5); Thu, 28 Jun 2007 17:48:18 -0700 (PDT) Message-ID: <46845683.2060604@gmail.com> Date: Thu, 28 Jun 2007 20:46:59 -0400 From: Mark Miller User-Agent: Thunderbird 2.0.0.4 (Windows/20070604) MIME-Version: 1.0 To: java-user@lucene.apache.org Subject: Re: Rewrite one phrase to another in search query References: <5751da780706270738j19fdcb0cx4013844720e47275@mail.gmail.com> In-Reply-To: <5751da780706270738j19fdcb0cx4013844720e47275@mail.gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org You might try my Query Parser, Qsol. http://myhardshadow.com/qsol.php There is a find/replace feature that will do what you want. FindReplace takes the find string, the replace string, boolean for case sensitive, boolean to indicate the replacement will act as an operator (allows for correct default space operator functionality). - Mark Example Code: QsolParser parser = ParserFactory.getInstance(new QsolConfiguration()) .getParser(false); parser.addFindReplace(new FindReplace("\"the old fast razor\"", "tofr", true, false)); parser.addFindReplace(new FindReplace("tofr", "\"the old fast razor\"", true, false)); example = "test(\"the old fast razor\" & mark)"; expected = "+test:tofr +test:mark"; assertEquals(expected, parse(example)); Parse Method: Query result = null; try { result = parser.parse("field", query, analyzer); } catch (EmptyQueryException e) { return ""; } catch (QsolSyntaxException e) { throw new RuntimeException(e); } return result.toString(); Aliaksandr Radzivanovich wrote: > What if I need to search for synonyms, but synonyms can be expanded to > phrases of several words? > For example, user enters query "tcp", then my application should also > find documents containing phrase "Transmission Control Protocol". And > conversely, user enters "Transmission Control Protocol", then my > application should also find documents with word "tcp". > > It seems like Lucene does not support this scenario out of the box. > Then where to look for the solution? What Lucene > extensions/classes/interfaces should I investigate? > > Thanks. > > --------------------------------------------------------------------- > 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