You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Chris Hostetter <ho...@fucit.org> on 2009/04/10 02:03:49 UTC

Re: Querying for multi-word synonyms

: Unfortunately, I have to use SynonymFilter at query time due to the nature
: of the data I'm indexing. At index time, all I have are keywords but at
: query time I will have some semantic markup which allows me to expand into
: synonyms. I am wondering if any progress has been made into making query
: time synonym searching work correctly. If not, does anyone have some ideas
: for alternatives to using SynonymFilter? The only thing I can think of is to
: simply create a custom BooleanQuery for the search and feed the synonyms in
: manually, but then I am missing out on all the functionality of the dismax
: query parser. Any ideas are appreciated, thanks very much.

Fundementally the problem with multi-word query time synonyms is that the 
Analyzer only has a limited mechanism of conveying "structure" back to the 
caller (ie: the QueryParser) ... that mechanism being the "term position" 
-- you can indicate that terms can occupy the same single position, but 
not that sequences of terms can occupy the same position.

you could write a query parser that used nested SpanNearQueries to create 
a directed acyclic graph of terms that you want to match in a sequence, 
where some "branches" of the graph contain more nodes then others, but you 
would need to do the synonym recognition while building up the query (and 
working with the DAG) ... but the current SynonymFilter works as part of 
hte TokenStream.



-Hoss