lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tommy Chheng <>
Subject Re: Query modification
Date Fri, 02 Jul 2010 22:18:35 GMT
I actually did something similar on
if you search for "stanford university solar", it will process the query 
by tagging the stanford university to the organization field.

I created a querycomponent class and altered the query string like 
this(in scala but translatable to java easily):
   override def prepare(rb: ResponseBuilder){
     val params: SolrParams = rb.req.getParams

     if(params.getBool(COMPONENT_NAME, false)){
       val queryString = params.get("q").trim //rb.getQueryString()
       val entityTransform = new ClearboxEntityDetection
       val (transformedQuery, explainMap) = 

       rb.rsp.add("clearboxExplain", explainMap)

Programmer and UC Irvine Graduate Student
Find a great grad school based on research interests:

On 7/2/10 3:12 PM, osocurious2 wrote:
> If I wanted to intercept a query and turn
>      q=romantic italian restaurant in seattle
> into
>      q=romantic tag:restaurant city:seattle cuisine:italian
> would I subclass QueryComponent, modify the query, and pass it to super? Or
> is there a standard way already to do this?
> What about changing it to
>     q=romantic city:seattle cuisine:italian&fq=type:restaurant
> would that be the same process, or is there a nuance to modifying a query
> into a query+filterQuery?
> Ken

View raw message