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 David Palaitis <so...@gmail.com> on 2009/06/07 20:50:02 UTC

searchcomponent howto ...

I'm trying to write a very simple SearchComponent that performs a simple
operation on the query string before passing through to QueryComponent.

The EncodingSearchComponent will perform something like the following
Base64(MD5(querystring))

Re: searchcomponent howto ...

Posted by DJP <so...@gmail.com>.
thanks. that's what I was looking for.



On Mon, Jun 22, 2009 at 4:15 PM, Chris Hostetter
<ho...@fucit.org>wrote:

> : and then ask,
> :    - how can i set the value of query so that it is reflected in the 'q'
> : node of the search results e.g. <str name="q">solr</str>.
> : the example 'process' method above works, but the original query is still
> : written to the search results page.
>
> if you're talking about the param values that get written out in the
> header section, those always contain the "original" params (either form
> the URL, or from defaults in configs ... I don't think you can modify
> those easily.
>
> your component can always add the your new "q" value to the response as a
> new object (with whatever name you want), and your client code can get at
> it that way.
>
>
> -Hoss
>
>

Re: searchcomponent howto ...

Posted by Chris Hostetter <ho...@fucit.org>.
: and then ask,
:    - how can i set the value of query so that it is reflected in the 'q'
: node of the search results e.g. <str name="q">solr</str>.
: the example 'process' method above works, but the original query is still
: written to the search results page.

if you're talking about the param values that get written out in the 
header section, those always contain the "original" params (either form 
the URL, or from defaults in configs ... I don't think you can modify 
those easily.

your component can always add the your new "q" value to the response as a 
new object (with whatever name you want), and your client code can get at 
it that way.


-Hoss


Re: searchcomponent howto ...

Posted by DJP <so...@gmail.com>.
sorry. my 'tab' character is linked to 'send'. i meant to include this bit
of source....

@Override
        public void process(ResponseBuilder rb) throws IOException {
                SolrQueryRequest request = rb.req;
                SolrParams params = request.getParams();
                String qs = rb.getQueryString();
                String defType = params.get(QueryParsing.DEFTYPE);
                defType = defType==null ? QParserPlugin.DEFAULT_QTYPE :
defType;

                try {
                      QParser parser =
QParser.getParser(encoder.process(rb.getQueryString()), defType, request);
                      rb.setQuery( parser.getQuery() );
                      rb.setQparser(parser);
                } catch (ParseException e) {
                      throw new
SolrException(SolrException.ErrorCode.BAD_REQUEST, e);
                }
        }

and then ask,
   - how can i set the value of query so that it is reflected in the 'q'
node of the search results e.g. <str name="q">solr</str>.
the example 'process' method above works, but the original query is still
written to the search results page.



On Mon, Jun 8, 2009 at 9:08 AM, Grant Ingersoll <gs...@apache.org> wrote:

> Is there a question here?
>
>
> On Jun 7, 2009, at 2:50 PM, David Palaitis wrote:
>
>  I'm trying to write a very simple SearchComponent that performs a simple
>> operation on the query string before passing through to QueryComponent.
>>
>> The EncodingSearchComponent will perform something like the following
>> Base64(MD5(querystring))
>>
>
> --------------------------
> Grant Ingersoll
> http://www.lucidimagination.com/
>
> Search the Lucene ecosystem (Lucene/Solr/Nutch/Mahout/Tika/Droids) using
> Solr/Lucene:
> http://www.lucidimagination.com/search
>
>

Re: searchcomponent howto ...

Posted by Grant Ingersoll <gs...@apache.org>.
Is there a question here?

On Jun 7, 2009, at 2:50 PM, David Palaitis wrote:

> I'm trying to write a very simple SearchComponent that performs a  
> simple
> operation on the query string before passing through to  
> QueryComponent.
>
> The EncodingSearchComponent will perform something like the following
> Base64(MD5(querystring))

--------------------------
Grant Ingersoll
http://www.lucidimagination.com/

Search the Lucene ecosystem (Lucene/Solr/Nutch/Mahout/Tika/Droids)  
using Solr/Lucene:
http://www.lucidimagination.com/search