lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Susheel Kumar <susheel2...@gmail.com>
Subject Re: Get results in multiple orders (multiple boosts)
Date Wed, 23 Aug 2017 13:26:42 GMT
This is just an dummy code to show you how you can add a request handler in
solrconfig and utilise that to sort by custom field based on your
criteria.  You can do lot here like using pow function etc. and create more
local params etc based on your need.

<requestHandler name="/customsort" class="solr.SearchHandler">
    <lst name="defaults">
        <str name="q">*:*</str>
        <str name="echoParams">explicit</str>
        <str name="wt">json</str>
        <str name="indent">true</str>
        <str name="df">_text_</str>

        <str name="srchKey">*:*</str>

        <str name="sort">{!query defType=func v=$f_category} desc</str>

    </lst>
    <lst name="appends">

        <str name="fl">category:{!query defType=func v=$f_category}</str>
    </lst>



    <lst name="invariants">

        <str name="f_category">{!func}
if(exists(query(category_i:9500)),$f_9500,$f_1100)</str>

        <str name="f_9500">{!func}
if(exists(query(source_i:5)),100,if(exists(query(source_i:9)),90,if(exists(query(source_i:7)),80)))</str>
        <str name="f_1100">{!func}
if(exists(query(source_i:5)),70,if(exists(query(source_i:9)),60,if(exists(query(source_i:7)),50)))</str>

    </lst>

</requestHandler>

On Wed, Aug 23, 2017 at 9:10 AM, Susheel Kumar <susheel2777@gmail.com>
wrote:

> Hi Luca,
>
> Sorry, I was out.  Let me try to put some dummy code as an example. Will
> be putting it shortly.
>
> Thnx
>
> On Tue, Aug 22, 2017 at 6:08 AM, Rick Leir <rleir@leirtech.com> wrote:
>
>> Luca,
>> Did you say _slower_ mySQL? It is blazing fast, I used it with over 10m
>> records and no appreciable latency. The underlying InnoDB is excellent.
>> Design your schema using mySQLworkbench. Cheers -- Rick
>>
>> On August 22, 2017 2:16:07 AM EDT, Luca Dall'Osto
>> <tenaciousd93@yahoo.it.INVALID> wrote:
>> >Hello,
>> >thank you for your responses.
>> >Ok, therefore I have to archive this problem with no appropriate
>> >solution in Solr, and try to do it with a relation-based DB such as
>> >mySQL or Postgres.
>> >Build the custom sort function could be a valid solution instead of use
>> >the slower mySQL or try Postgres (I never used Postgres) or I have to
>> >forgot it?
>> >Thanks!
>> >
>> >
>> >Luca
>> >
>> >
>> >On Saturday, August 19, 2017 1:02 AM, Rick Leir <rleir@leirtech.com>
>> >wrote:
>> >
>> >
>> > Luca
>> >Walter has got the best word on this, you should use SQL for sorting
>> >(maybe mySQL or Postgres). If you also need searching, you can create a
>> >Solr index by ingesting from the SQL database. The Solr index would be
>> >just used for searching. Cheers -- Rick
>> >--
>> >Sorry for being brief. Alternate email is rickleir at yahoo dot com
>> >
>> >
>>
>> --
>> Sorry for being brief. Alternate email is rickleir at yahoo dot com
>>
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message