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 Andy Newby <an...@gmail.com> on 2011/03/10 11:25:01 UTC

Possible to sort in .xml file?

Hi,

I'm trying to setup Solr so that we can "sort" using:

document_views asc,score

...is this possible via the solrconfig.xml/schema.xml file?

I know its possible to do via adding sort=xxxx , but the Perl module
(WebService::Solr) doesn't seem to offer the option to pass in this value :(

TIA
-- 
Andy Newby
andy@ultranerds.com

Re: Possible to sort in .xml file?

Posted by Markus Jelsma <ma...@openindex.io>.
No, look for request handlers.

  <requestHandler name="search" class="solr.SearchHandler" default="true">
    <!-- default values for query parameters can be specified, these
         will be overridden by parameters in the request
      -->
     <lst name="defaults">
       <str name="echoParams">explicit</str>
       <int name="rows">10</int>
     </lst>
    <!-- In addition to defaults, "appends" params can be specified
         to identify values which should be appended to the list of
         multi-val params from the query (or the existing "defaults").
      -->
    <!-- In this example, the param "fq=instock:true" would be appended to
         any query time fq params the user may specify, as a mechanism for
         partitioning the index, independent of any user selected filtering
         that may also be desired (perhaps as a result of faceted searching).

         NOTE: there is *absolutely* nothing a client can do to prevent these
         "appends" values from being used, so don't use this mechanism
         unless you are sure you always want it.
      -->
    <!--
       <lst name="appends">
         <str name="fq">inStock:true</str>
       </lst>
      -->


etc... You can add any valid parameter there as default.

http://svn.apache.org/repos/asf/lucene/dev/trunk/solr/example/solr/conf/solrconfig.xml

On Thursday 10 March 2011 11:34:47 Andy Newby wrote:
> Hi,
> 
> Thanks for the quick reply!
> 
> I did a quick look in the solrconfig.xml file, but can't see anything about
> "sort", appart from:
> 
>    <!-- An optimization that attempts to use a filter to satisfy a search.
>          If the requested sort does not include score, then the filterCache
>          will be checked for a filter matching the query. If found, the
> filter
>          will be used as the source of document ids, and then the sort will
> be
>          applied to that.
>     <useFilterForSortedQuery>true</useFilterForSortedQuery>
>    -->
> 
> 
> TIA
> 
> Andy
> 
> On Thu, Mar 10, 2011 at 10:33 AM, Markus Jelsma
> 
> <ma...@openindex.io>wrote:
> > Is there no generic parameter store in the Solr module you can use for
> > passing
> > the sort parameter? If not, you can define your sort parameter as default
> > in
> > the request handler you use in solrconfig. See the shipped config for
> > examples.
> > 
> > On Thursday 10 March 2011 11:25:01 Andy Newby wrote:
> > > Hi,
> > > 
> > > I'm trying to setup Solr so that we can "sort" using:
> > > 
> > > document_views asc,score
> > > 
> > > ...is this possible via the solrconfig.xml/schema.xml file?
> > > 
> > > I know its possible to do via adding sort=xxxx , but the Perl module
> > > (WebService::Solr) doesn't seem to offer the option to pass in this
> > > value
> > > 
> > > :(
> > > 
> > > TIA
> > 
> > --
> > Markus Jelsma - CTO - Openindex
> > http://www.linkedin.com/in/markus17
> > 050-8536620 / 06-50258350

-- 
Markus Jelsma - CTO - Openindex
http://www.linkedin.com/in/markus17
050-8536620 / 06-50258350

Re: Possible to sort in .xml file?

Posted by Markus Jelsma <ma...@openindex.io>.
Is there no generic parameter store in the Solr module you can use for passing 
the sort parameter? If not, you can define your sort parameter as default in 
the request handler you use in solrconfig. See the shipped config for 
examples.

On Thursday 10 March 2011 11:25:01 Andy Newby wrote:
> Hi,
> 
> I'm trying to setup Solr so that we can "sort" using:
> 
> document_views asc,score
> 
> ...is this possible via the solrconfig.xml/schema.xml file?
> 
> I know its possible to do via adding sort=xxxx , but the Perl module
> (WebService::Solr) doesn't seem to offer the option to pass in this value
> :(
> 
> TIA

-- 
Markus Jelsma - CTO - Openindex
http://www.linkedin.com/in/markus17
050-8536620 / 06-50258350

Re: Possible to sort in .xml file?

Posted by Andy Newby <an...@gmail.com>.
Hi,

Ah cool - missed that bit! Will give that a go (as it will be handy for
passing along other paramaters too)

Cheers

Andy


On Thu, Mar 10, 2011 at 9:13 PM, Chris Hostetter
<ho...@fucit.org>wrote:

>
> : I know its possible to do via adding sort=xxxx , but the Perl module
> : (WebService::Solr) doesn't seem to offer the option to pass in this value
> :(
>
> according to the docs, you can pass any query params you want to the sort
> method...
>
>
> http://search.cpan.org/~bricas/WebService-Solr-0.11/lib/WebService/Solr.pm#search%28_$query,_\%options_%29
>
> >> All key-value pairs supplied in \%options are serialzied in the request
> >> URL.
>
>
> -Hoss
>



-- 
Andy Newby
andy@ultranerds.com

Re: Possible to sort in .xml file?

Posted by Chris Hostetter <ho...@fucit.org>.
: I know its possible to do via adding sort=xxxx , but the Perl module
: (WebService::Solr) doesn't seem to offer the option to pass in this value :(

according to the docs, you can pass any query params you want to the sort 
method...

http://search.cpan.org/~bricas/WebService-Solr-0.11/lib/WebService/Solr.pm#search%28_$query,_\%options_%29

>> All key-value pairs supplied in \%options are serialzied in the request 
>> URL.


-Hoss