Hi,
I actually did something similar on http://researchwatch.net/
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) = entityTransform.transformQuery(queryString)

      rb.setQueryString(transformedQuery)
      rb.rsp.add("clearboxExplain", explainMap)
    }
  }


@tommychheng
Programmer and UC Irvine Graduate Student
Find a great grad school based on research interests: http://gradschoolnow.com


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

Reply via email to