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 osocurious2 <ke...@realestate.com> on 2010/07/03 00:12:00 UTC
Query modification
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 this message in context: http://lucene.472066.n3.nabble.com/Query-modification-tp939584p939584.html
Sent from the Solr - User mailing list archive at Nabble.com.
Re: Query modification
Posted by Sidharth <si...@gmail.com>.
Hi,
Even I am using the QueryComponent to perform similar modification to the
query. I am modifying the query in the process() method of the Component.
The problem I am facing is that after modifying the query and setting it in
the response builder, I make a call to super.process(rb).
This call is taking around 100ms and is degrading component's performance.
Wanted to know that is process the right place to do it and do we need to
make a call to super.process() method?
Regards,
Sidharth.
--
View this message in context: http://lucene.472066.n3.nabble.com/Query-modification-tp939584p4096753.html
Sent from the Solr - User mailing list archive at Nabble.com.
Re: Query modification
Posted by Chris Hostetter <ho...@fucit.org>.
: So QueryComponent is the place to do this? Are query analyzers already done?
I would actaully suggest doing it in a QParserPlugin, that way it can be
reused in mulitple parsing sitautions and the stock search behavior of
QueryComponent (including distributed search) can function as is.
: Would I have access to stems, synonyms, tokens, etc of the query?
those concepts only make sense in the context of analysis -- in either the
QueryComponent or a QParser you have access to the query string and you
can do whatever analysis you want on it (with the full IndexSchema at your
disposal)
-Hoss
Re: Query modification
Posted by osocurious2 <ke...@realestate.com>.
So QueryComponent is the place to do this? Are query analyzers already done?
Would I have access to stems, synonyms, tokens, etc of the query?
--
View this message in context: http://lucene.472066.n3.nabble.com/Query-modification-tp939584p940941.html
Sent from the Solr - User mailing list archive at Nabble.com.
Re: Query modification
Posted by Tommy Chheng <to...@gmail.com>.
i tried openNLP but found it's not very good for search queries
because it uses grammar features like capitalization.
i coded up a bayesian model with mutual information to model dependence
between terms. ex. grouping "stanford university" together in the query
"stanford university solar"
@tommychheng
Programmer and UC Irvine Graduate Student
Find a great grad school based on research interests: http://gradschoolnow.com
On 7/2/10 3:26 PM, caman wrote:
> And what did you use for entity detection?
>
> GATE,openNLP?
>
> Do you mind sharing that please?
>
>
>
> From: Tommy Chheng-2 [via Lucene]
> [mailto:ml-node+939600-682384129-124354@n3.nabble.com]
> Sent: Friday, July 02, 2010 3:20 PM
> To: caman
> Subject: Re: Query modification
>
>
>
> 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<http://gradschoolnow.com?by-user=t>
>
>
> 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 message @
> http://lucene.472066.n3.nabble.com/Query-modification-tp939584p939600.html
> To start a new topic under Solr - User, email
> ml-node+472068-464289649-124354@n3.nabble.com
> To unsubscribe from Solr - User, click
> < (link removed)
> GZvcnRoZW90aGVyc3R1ZmZAZ21haWwuY29tfDQ3MjA2OHwtOTM0OTI1NzEx> here.
>
>
>
>
RE: Query modification
Posted by caman <ab...@gmail.com>.
And what did you use for entity detection?
GATE,openNLP?
Do you mind sharing that please?
From: Tommy Chheng-2 [via Lucene]
[mailto:ml-node+939600-682384129-124354@n3.nabble.com]
Sent: Friday, July 02, 2010 3:20 PM
To: caman
Subject: Re: Query modification
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 <http://gradschoolnow.com?by-user=t>
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 message @
http://lucene.472066.n3.nabble.com/Query-modification-tp939584p939600.html
To start a new topic under Solr - User, email
ml-node+472068-464289649-124354@n3.nabble.com
To unsubscribe from Solr - User, click
< (link removed)
GZvcnRoZW90aGVyc3R1ZmZAZ21haWwuY29tfDQ3MjA2OHwtOTM0OTI1NzEx> here.
--
View this message in context: http://lucene.472066.n3.nabble.com/Query-modification-tp939584p939614.html
Sent from the Solr - User mailing list archive at Nabble.com.
Re: Query modification
Posted by Tommy Chheng <to...@gmail.com>.
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
>