After digging even more I ended up building query parser. Now I am
extending org.apache.solr.search.LuceneQParserPlugin
All looks smooth and working just kinda bugged by INFO debug message
qstr = qstr + "aaaaaaa";//...seems to change really the query
But I am confused by
public QParser createParser(String qstr, SolrParams localParams,
SolrParams params, SolrQueryRequest req)
there is localParams params, qstr, req which all by some
form contains query string. Even if I change them all to modify q and
all....... I still end up having
INFO: [] webapp=/blah-en path=/select/
params={fl=*&q=germany&qt=dismax&rows=43} hits=492 status=0 QTime=516
with q=germany and not q=germanyaaaaaaa
I have no clue if this might have some real impact or just changing qstr
is enough.
Julian Davchev wrote:
> Hi,
> Thanks.
>
> 1. Although I do set q I don't see q overwritten so it's processed with
> new setting though.
> Example I add aaaaaaaa... to the query and here what I debug of q in
> log/catalina.out
>
> Qparam: germanyaaaaaaaaaaaaaaaaaaa
> Jun 26, 2009 10:00:37 AM org.apache.solr.core.SolrCore execute
> INFO: [] webapp=/blah-en path=/select/
> params={fl=*&q=germany&qt=dismax&rows=43} hits=492 status=0 QTime=516
>
>
> From what I see in INFO the q=germany and NOT
> q=germanyaaaaaaaaaaaaaaaaaaa as I would expect. So real query executed
> is still original q.
>
> Is there some other point that I should plug into or another way to set
> the param?
>
> 2. On side note. SearchHandler is too generic as I get stuff like this
> during start of tomcat.
>
> Qparam: static firstSearcher warming query from
> solrconfig.xmlaaaaaaaaaaaaaaaaaaa
>
> which seems like internal queries also pass through
> SearchHandler::handleRequestBody() That is not that great of issue..I
> can just pass extra command and process only those (making sure it's my
> query).
>
>
> I reallize those seems small questions and probably sound stupid but I
> just cannot find manual howto handle those properly.
>
>
> Mark Miller wrote:
>
>> Julian Davchev wrote:
>>
>>> Mark Miller wrote:
>>>
>>>
>>>> Rather than using org.apache.solr.request.SolrParams, try using
>>>> org.apache.solr.common.params.SolrParms.
>>>>
>>>>
>>>>
>>> Thanks that really helped. One final issue to solve. I don't see
>>> SolrParams.set() which I guess is normal but how can I
>>> modify the q param before I pass it further for processing.
>>> Basically I got...
>>>
>>> SolrParams p = req.getParams();
>>> String words = p.get("q");
>>> //do something with words.... //assign
>>> words back to q param so that the processing is on
>>> modified q? What is recommended way to do this?
>>>
>>> Thanks
>>>
>>>
>> You might try:
>>
>> SolrParams p = req.getParams();
>> String words = p.get("q");
>> ModifiableSolrParams newParams = new ModifiableSolrParams(p)
>> newParams.set("q", words + stuff);
>> req.setParams(newParams);
>>
>>
>>
>
>