lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gudumba l <gudumba.sm...@gmail.com>
Subject query parsing ( expansion ) in solr
Date Tue, 22 Dec 2009 19:27:10 GMT
Hello All,
            I have been trying to find out the right place to parse
the query submitted. To be brief, I need to expand the query. For
example.. let the query be
       city:paris
then I would like to expand the query as .. follows
    city:paris OR place:paris OR town:paris .

     I guess the synonym support is provided only for values but not
field names.

1) I could write a custom query parser which directly modifies input
query string and then pass it to some default parser provided in solr.
But it becomes more complex when its a complicated query and also I
think it is not wise to write , because solr may provide few more
search operators in the future. keeping that in mind I dont feel its
going to be alright to follow this approach.

2) I could first pass the incoming query string to a default parser
provided by Solr and then retrieve all the Terms ( and then add
synonym terms ) using by calling Query.extractTerms() ..on the
returned Query object but I am unable to get how to point out
relations among the Terms like.. whether its Term1 OR Term2 AND Term3,
  or   Term1 AND Term2 AND Term3 .. or something else.

     Can you please suggest me the right way of doing it.
Thanks.

Mime
View raw message