lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steven Rowe <>
Subject Re: Rewrite one phrase to another in search query
Date Wed, 27 Jun 2007 15:07:00 GMT
Hi Aliaksandr,

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".

Section 4.6 of Gospodnetić & Hatcher's excellent _Lucene_in_Action_[1]
describes a SynonymAnalyzer class, intended for use at indexing time
(AFACT, however, their approach does not address multi-word synonyms).
Although a query-time analyzer is not directly discussed, they do say
(on p. 134):

   The awkwardly named PhrasePrefixQuery (see section 5.2)
   is one option to consider, perhaps created through an
   overridden QueryParser.getFieldQuery method; this is a
   possible option to explore if you wish to implement
   synonym injection at query time.



Steve Rowe
Center for Natural Language Processing

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message