Re: Get results in multiple orders (multiple boosts)

2017-08-23 Thread Susheel Kumar
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.



*:*
explicit
json
true
_text_

*:*

{!query defType=func v=$f_category} desc




category:{!query defType=func v=$f_category}






{!func}
if(exists(query(category_i:9500)),$f_9500,$f_1100)

{!func}
if(exists(query(source_i:5)),100,if(exists(query(source_i:9)),90,if(exists(query(source_i:7)),80)))
{!func}
if(exists(query(source_i:5)),70,if(exists(query(source_i:9)),60,if(exists(query(source_i:7)),50)))





On Wed, Aug 23, 2017 at 9:10 AM, Susheel Kumar 
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  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
>>  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 
>> >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
>>
>
>


Re: Get results in multiple orders (multiple boosts)

2017-08-23 Thread Susheel Kumar
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  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
>  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 
> >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
>


Re: Get results in multiple orders (multiple boosts)

2017-08-22 Thread Rick Leir
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 
 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 
>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 

Re: Get results in multiple orders (multiple boosts)

2017-08-21 Thread Luca Dall'Osto
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  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

   

Re: Get results in multiple orders (multiple boosts)

2017-08-18 Thread Rick Leir
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 

Re: Get results in multiple orders (multiple boosts)

2017-08-18 Thread Walter Underwood
Why do you want to do this in Solr? This would be pretty easy in SQL. If you 
want to sort, use a relational database.

wunder
Walter Underwood
wun...@wunderwood.org
http://observer.wunderwood.org/  (my blog)


> On Aug 18, 2017, at 2:52 AM, Luca Dall'Osto  
> wrote:
> 
> Hello Tom,
> thanks for you reply.
> As say in last email, I made the custom function in JS.I posted in pastebin 
> right now: https://pastebin.com/faXNi0fR
> 
> 
> What I have to do is create the same function in Solr... I will take a look 
> to your link and try to create the custom function.
> Thanks
> 
> 
> Luca
> 
> 
> 
> 
>On Friday, August 18, 2017 10:58 AM, Tom Evans  
> wrote:
> 
> 
> On Fri, Aug 18, 2017 at 8:21 AM, Luca Dall'Osto
>  wrote:
>> 
>> Yes, of course, and excuse me for the misunderstanding.
>> 
>> 
>> In my scenario I have to display a list with hundreds of documents.
>> An user can show this documents in a particular order, this order is decided 
>> by user in a settings view.
>> 
>> 
>> Order levels are for example:
>> 1) Order by category, as most important.
>> 2) Order by source, as second level.
>> 3) Order by date (ascending or descending).
>> 4) Order by title (ascending or descending).
>> 
>> 
>> For category order, in settings view, user has an box with a list of all 
>> categories available for him/her.
>> User drag&drop elements of the list to set in the favorite order.
>> Same thing for sources.
>> 
> 
> Solr can only sort by indexed fields, it needs to be able to compare
> one document to another document, and the only information available
> at that point are the indexed fields.
> 
> This would be untenable in your scenario, because you cannot add a
> category..sort_order field to every document for every user.
> 
> If this custom sorting is a hard requirement, the only feasible
> solution I see is to write a custom sorting plugin, that provides a
> function that you can sort on. This blog post describes how this can
> be achieved:
> 
> https://medium.com/culture-wavelabs/sorting-based-on-a-custom-function-in-solr-c94ddae99a12
> 
> I would imagine that you would need one sort function, maybe called
> usersortorder(), to which you would provide the users preferred sort
> ordering (which you would retrieve from wherever you store such
> information) and the field that you want sorted. It would look
> something like this:
> 
> usersortorder("category_id", "3,5,1,7,2,12,14,58") DESC,
> usersortorder("source_id", "5,2,1,4,3") DESC, date DESC, title DESC
> 
> Cheers
> 
> Tom
> 
> 



Re: Get results in multiple orders (multiple boosts)

2017-08-18 Thread Luca Dall'Osto
Hello Tom,
thanks for you reply.
As say in last email, I made the custom function in JS.I posted in pastebin 
right now: https://pastebin.com/faXNi0fR


What I have to do is create the same function in Solr... I will take a look to 
your link and try to create the custom function.
Thanks


Luca


 

On Friday, August 18, 2017 10:58 AM, Tom Evans  
wrote:
 

 On Fri, Aug 18, 2017 at 8:21 AM, Luca Dall'Osto
 wrote:
>
> Yes, of course, and excuse me for the misunderstanding.
>
>
> In my scenario I have to display a list with hundreds of documents.
> An user can show this documents in a particular order, this order is decided 
> by user in a settings view.
>
>
> Order levels are for example:
> 1) Order by category, as most important.
> 2) Order by source, as second level.
> 3) Order by date (ascending or descending).
> 4) Order by title (ascending or descending).
>
>
> For category order, in settings view, user has an box with a list of all 
> categories available for him/her.
> User drag&drop elements of the list to set in the favorite order.
> Same thing for sources.
>

Solr can only sort by indexed fields, it needs to be able to compare
one document to another document, and the only information available
at that point are the indexed fields.

This would be untenable in your scenario, because you cannot add a
category..sort_order field to every document for every user.

If this custom sorting is a hard requirement, the only feasible
solution I see is to write a custom sorting plugin, that provides a
function that you can sort on. This blog post describes how this can
be achieved:

https://medium.com/culture-wavelabs/sorting-based-on-a-custom-function-in-solr-c94ddae99a12

I would imagine that you would need one sort function, maybe called
usersortorder(), to which you would provide the users preferred sort
ordering (which you would retrieve from wherever you store such
information) and the field that you want sorted. It would look
something like this:

usersortorder("category_id", "3,5,1,7,2,12,14,58") DESC,
usersortorder("source_id", "5,2,1,4,3") DESC, date DESC, title DESC

Cheers

Tom


   

Re: Get results in multiple orders (multiple boosts)

2017-08-18 Thread Tom Evans
On Fri, Aug 18, 2017 at 8:21 AM, Luca Dall'Osto
 wrote:
>
> Yes, of course, and excuse me for the misunderstanding.
>
>
> In my scenario I have to display a list with hundreds of documents.
> An user can show this documents in a particular order, this order is decided 
> by user in a settings view.
>
>
> Order levels are for example:
> 1) Order by category, as most important.
> 2) Order by source, as second level.
> 3) Order by date (ascending or descending).
> 4) Order by title (ascending or descending).
>
>
> For category order, in settings view, user has an box with a list of all 
> categories available for him/her.
> User drag&drop elements of the list to set in the favorite order.
> Same thing for sources.
>

Solr can only sort by indexed fields, it needs to be able to compare
one document to another document, and the only information available
at that point are the indexed fields.

This would be untenable in your scenario, because you cannot add a
category..sort_order field to every document for every user.

If this custom sorting is a hard requirement, the only feasible
solution I see is to write a custom sorting plugin, that provides a
function that you can sort on. This blog post describes how this can
be achieved:

https://medium.com/culture-wavelabs/sorting-based-on-a-custom-function-in-solr-c94ddae99a12

I would imagine that you would need one sort function, maybe called
usersortorder(), to which you would provide the users preferred sort
ordering (which you would retrieve from wherever you store such
information) and the field that you want sorted. It would look
something like this:

usersortorder("category_id", "3,5,1,7,2,12,14,58") DESC,
usersortorder("source_id", "5,2,1,4,3") DESC, date DESC, title DESC

Cheers

Tom


Re: Get results in multiple orders (multiple boosts)

2017-08-18 Thread Luca Dall'Osto
wser, then construct the query as necessary to do your
>>sorting. Cheers -- Rick
>>
>>On August 4, 2017 5:32:31 AM EDT, Luca Dall'Osto
>> wrote:
>>>Hello,
>>>sorry for the late, I was out of my home.
>>>
>>>
>>>In response to Rick: 
>>>I can't do that because: 
>>>1) each user should have multiple sort (for example user "A" can sort
>>>by date and then by category and then by name ...) .
>>>2) the sort is not natural sort: user has a custom order for a field
>>>(for example sorting category field of user "A" could be category 10
>>at
>>>position 1, category 2 at position 2, category 9500 at position 3,
>>>category 40 at position 5 ...).
>>>
>>>
>>>In response to Susheel:have you done an example? 
>>>
>>>Thanks for your response.
>>>
>>>Luca
>>>
>>> 
>>>
>>>On Thursday, July 20, 2017 4:10 AM, Susheel Kumar
>>> wrote:
>>> 
>>>
>>> Let me try to put an example for custom sort.
>>>
>>>On Wed, Jul 19, 2017 at 6:34 AM, Rick Leir 
>wrote:
>>>
>>>> Luca,
>>>> You can pass a sort parameter in the query. User A could
>>>sort=date%20desc
>>>> and user b could sort=foofield%20asc.
>>>>
>>>> Maybe query functions can also help with this. Cheers -- Rick
>>>>
>>>> On July 19, 2017 4:39:59 AM EDT, Luca Dall'Osto
>>>>  wrote:
>>>> >Hello,The problem of build an index is that each user has a custom
>>>> >source order and category order: are not static orders (for
>example
>>>> >user X could have category:5 as most important category but user Y
>>>> >could have category:9 as most important).
>>>> >Has anyone ever written a custom sort function in solr?Maybe a
>link
>>>of
>>>> >a tutorial or an example could be very helpful. Thanks
>>>> >
>>>> >Luca
>>>> >
>>>> >On Tuesday, July 18, 2017 4:18 PM, alessandro.benedetti
>>>> > wrote:
>>>> >
>>>> >
>>>> >"I have different "sort preferences", so I can't build a index and
>>>use
>>>> >for
>>>> >sorting.Maybe I have to sort by category then by source and by
>>>language
>>>> >or
>>>> >by source, then by category and by date"
>>>> >
>>>> >I would like to focus on this bit.
>>>> >It is ok to go for a custom function and sort at query time, but I
>>>am
>>>> >curious to explore why an index time solution should not be ok.
>>>> >You can have these distinct fields :
>>>> >source_priority
>>>> >language_priority
>>>> >category_priority
>>>> >ect
>>>> >
>>>> >This values can be assigned at the documents at indexing time (
>>>using
>>>> >for
>>>> >example a custom update request processor).
>>>> >Then at query time you can easily sort on those values in a multi
>>>> >layered
>>>> >approach :
>>>> >sort:source_priority desc, category_priority  desc
>>>> >Of course, if the priority for a source changes quite often or if
>>>it's
>>>> >user
>>>> >dependent, a query time solution would be preferred.
>>>> >
>>>> >
>>>> >
>>>> >
>>>> >
>>>> >-
>>>> >---
>>>> >Alessandro Benedetti
>>>> >Search Consultant, R&D Software Engineer, Director
>>>> >Sease Ltd. - www.sease.io
>>>> >--
>>>> >View this message in context:
>>>> >http://lucene.472066.n3.nabble.com/Get-results-in-
>>>> multiple-orders-multiple-boosts-tp4346304p4346559.html
>>>> >Sent from the Solr - User mailing list archive at Nabble.com.
>>>> >
>>>> >
>>>> >
>>>>
>>>> --
>>>> Sorry for being brief. Alternate email is rickleir at yahoo dot com
>>>
>>>
>>>  
>>
>>-- 
>>Sorry for being brief. Alternate email is rickleir at yahoo dot com
>>
>>  
>
>-- 
>Sorry for being brief. Alternate email is rickleir at yahoo dot com
>
>  

-- 
Sorry for being brief. Alternate email is rickleir at yahoo dot com

   

Re: Get results in multiple orders (multiple boosts)

2017-08-16 Thread Rick Leir
Luca
Can you give me an example? If category_id is 9500, what would you want to sort 
on? -- Rick

On August 16, 2017 5:19:56 AM EDT, Luca Dall'Osto 
 wrote:
>Hello Rick,
>I have no algorithm: user choose the order of the categories, and the
>sources, For example:
>
>
>For Category:
>- at position 0 category_id 9500.
>- at position 1 category_id 10.
>- at position 2 category_ud 555.
>(etc...)
>
>
>For Source:
>
>- at position 0 source_id 12.
>- at position 1 source_id 30.
>
>- at position 2 source_id 3.
>
>(etc...)
>
>
>After that, user decide what kind of sort apply.
>For example: fist by DATE, then by CATEGORY, then by SOURCE and then by
>NAME.
>I have 1 array with all category Ids with correct order decided by user
>and another one with source Ids in correct order decided by user.
>Then I have another array that specify the sort type (like example,
>user should ask documents ordered by DATE first, then by CATEGORY,
>etc... )
>Natural sort order could be fine only for DATE and NAME, but for
>CATEGORY and SOURCE I have to use the array with ids sorted by user.
>Thanks!
>
>Luca 
>
>On Tuesday, August 8, 2017 6:54 PM, Rick Leir 
>wrote:
> 
>
> Luca,
>What is the algorithm for the custom sort order?  -- Rick
>
>On August 7, 2017 6:38:49 AM EDT, Luca Dall'Osto
> wrote:
>>Hello Rick,
>>thanks for your answer.
>>Yes, I compose solr query from frontend request, but I'm not able to
>>sort by a custom order, only by natural order (for example:
>>sort=category desc, source desc, /*...*/ ).
>>How do you set a custom sort order in solr?
>>Thanks
>>
>>Luca
>>
>>
>> 
>>
>>On Friday, August 4, 2017 7:41 PM, Rick Leir 
>>wrote:
>> 
>>
>> Luca
>>I hope you have a web app in front of Solr. It could accept parameters
>>from the browser, then construct the query as necessary to do your
>>sorting. Cheers -- Rick
>>
>>On August 4, 2017 5:32:31 AM EDT, Luca Dall'Osto
>> wrote:
>>>Hello,
>>>sorry for the late, I was out of my home.
>>>
>>>
>>>In response to Rick: 
>>>I can't do that because: 
>>>1) each user should have multiple sort (for example user "A" can sort
>>>by date and then by category and then by name ...) .
>>>2) the sort is not natural sort: user has a custom order for a field
>>>(for example sorting category field of user "A" could be category 10
>>at
>>>position 1, category 2 at position 2, category 9500 at position 3,
>>>category 40 at position 5 ...).
>>>
>>>
>>>In response to Susheel:have you done an example? 
>>>
>>>Thanks for your response.
>>>
>>>Luca
>>>
>>> 
>>>
>>>On Thursday, July 20, 2017 4:10 AM, Susheel Kumar
>>> wrote:
>>> 
>>>
>>> Let me try to put an example for custom sort.
>>>
>>>On Wed, Jul 19, 2017 at 6:34 AM, Rick Leir 
>wrote:
>>>
>>>> Luca,
>>>> You can pass a sort parameter in the query. User A could
>>>sort=date%20desc
>>>> and user b could sort=foofield%20asc.
>>>>
>>>> Maybe query functions can also help with this. Cheers -- Rick
>>>>
>>>> On July 19, 2017 4:39:59 AM EDT, Luca Dall'Osto
>>>>  wrote:
>>>> >Hello,The problem of build an index is that each user has a custom
>>>> >source order and category order: are not static orders (for
>example
>>>> >user X could have category:5 as most important category but user Y
>>>> >could have category:9 as most important).
>>>> >Has anyone ever written a custom sort function in solr?Maybe a
>link
>>>of
>>>> >a tutorial or an example could be very helpful. Thanks
>>>> >
>>>> >Luca
>>>> >
>>>> >On Tuesday, July 18, 2017 4:18 PM, alessandro.benedetti
>>>> > wrote:
>>>> >
>>>> >
>>>> >"I have different "sort preferences", so I can't build a index and
>>>use
>>>> >for
>>>> >sorting.Maybe I have to sort by category then by source and by
>>>language
>>>> >or
>>>> >by source, then by category and by date"
>>>> >
>>>> >I would like to focus on this bit.
>>>> >It is ok to go for a custom function and sort at query time, but I
>>>am
>>>> >curious to explore why an in

Re: Get results in multiple orders (multiple boosts)

2017-08-16 Thread Luca Dall'Osto
Hello Rick,
I have no algorithm: user choose the order of the categories, and the sources, 
For example:


For Category:
- at position 0 category_id 9500.
- at position 1 category_id 10.
- at position 2 category_ud 555.
(etc...)


For Source:

- at position 0 source_id 12.
- at position 1 source_id 30.

- at position 2 source_id 3.

(etc...)


After that, user decide what kind of sort apply.
For example: fist by DATE, then by CATEGORY, then by SOURCE and then by NAME.
I have 1 array with all category Ids with correct order decided by user and 
another one with source Ids in correct order decided by user.
Then I have another array that specify the sort type (like example, user should 
ask documents ordered by DATE first, then by CATEGORY, etc... )
Natural sort order could be fine only for DATE and NAME, but for CATEGORY and 
SOURCE I have to use the array with ids sorted by user.
Thanks!

Luca 

On Tuesday, August 8, 2017 6:54 PM, Rick Leir  wrote:
 

 Luca,
What is the algorithm for the custom sort order?  -- Rick

On August 7, 2017 6:38:49 AM EDT, Luca Dall'Osto 
 wrote:
>Hello Rick,
>thanks for your answer.
>Yes, I compose solr query from frontend request, but I'm not able to
>sort by a custom order, only by natural order (for example:
>sort=category desc, source desc, /*...*/ ).
>How do you set a custom sort order in solr?
>Thanks
>
>Luca
>
>
> 
>
>On Friday, August 4, 2017 7:41 PM, Rick Leir 
>wrote:
> 
>
> Luca
>I hope you have a web app in front of Solr. It could accept parameters
>from the browser, then construct the query as necessary to do your
>sorting. Cheers -- Rick
>
>On August 4, 2017 5:32:31 AM EDT, Luca Dall'Osto
> wrote:
>>Hello,
>>sorry for the late, I was out of my home.
>>
>>
>>In response to Rick: 
>>I can't do that because: 
>>1) each user should have multiple sort (for example user "A" can sort
>>by date and then by category and then by name ...) .
>>2) the sort is not natural sort: user has a custom order for a field
>>(for example sorting category field of user "A" could be category 10
>at
>>position 1, category 2 at position 2, category 9500 at position 3,
>>category 40 at position 5 ...).
>>
>>
>>In response to Susheel:have you done an example? 
>>
>>Thanks for your response.
>>
>>Luca
>>
>> 
>>
>>On Thursday, July 20, 2017 4:10 AM, Susheel Kumar
>> wrote:
>> 
>>
>> Let me try to put an example for custom sort.
>>
>>On Wed, Jul 19, 2017 at 6:34 AM, Rick Leir  wrote:
>>
>>> Luca,
>>> You can pass a sort parameter in the query. User A could
>>sort=date%20desc
>>> and user b could sort=foofield%20asc.
>>>
>>> Maybe query functions can also help with this. Cheers -- Rick
>>>
>>> On July 19, 2017 4:39:59 AM EDT, Luca Dall'Osto
>>>  wrote:
>>> >Hello,The problem of build an index is that each user has a custom
>>> >source order and category order: are not static orders (for example
>>> >user X could have category:5 as most important category but user Y
>>> >could have category:9 as most important).
>>> >Has anyone ever written a custom sort function in solr?Maybe a link
>>of
>>> >a tutorial or an example could be very helpful. Thanks
>>> >
>>> >Luca
>>> >
>>> >On Tuesday, July 18, 2017 4:18 PM, alessandro.benedetti
>>> > wrote:
>>> >
>>> >
>>> >"I have different "sort preferences", so I can't build a index and
>>use
>>> >for
>>> >sorting.Maybe I have to sort by category then by source and by
>>language
>>> >or
>>> >by source, then by category and by date"
>>> >
>>> >I would like to focus on this bit.
>>> >It is ok to go for a custom function and sort at query time, but I
>>am
>>> >curious to explore why an index time solution should not be ok.
>>> >You can have these distinct fields :
>>> >source_priority
>>> >language_priority
>>> >category_priority
>>> >ect
>>> >
>>> >This values can be assigned at the documents at indexing time (
>>using
>>> >for
>>> >example a custom update request processor).
>>> >Then at query time you can easily sort on those values in a multi
>>> >layered
>>> >approach :
>>> >sort:source_priority desc, category_priority  desc
>>> >Of course, if the priority for a source changes quite often or if
>>it's
>>> >user
>>> >dependent, a query time solution would be preferred.
>>> >
>>> >
>>> >
>>> >
>>> >
>>> >-
>>> >---
>>> >Alessandro Benedetti
>>> >Search Consultant, R&D Software Engineer, Director
>>> >Sease Ltd. - www.sease.io
>>> >--
>>> >View this message in context:
>>> >http://lucene.472066.n3.nabble.com/Get-results-in-
>>> multiple-orders-multiple-boosts-tp4346304p4346559.html
>>> >Sent from the Solr - User mailing list archive at Nabble.com.
>>> >
>>> >
>>> >
>>>
>>> --
>>> Sorry for being brief. Alternate email is rickleir at yahoo dot com
>>
>>
>>  
>
>-- 
>Sorry for being brief. Alternate email is rickleir at yahoo dot com
>
>  

-- 
Sorry for being brief. Alternate email is rickleir at yahoo dot com

   

Re: Get results in multiple orders (multiple boosts)

2017-08-08 Thread Rick Leir
Luca,
What is the algorithm for the custom sort order?  -- Rick

On August 7, 2017 6:38:49 AM EDT, Luca Dall'Osto 
 wrote:
>Hello Rick,
>thanks for your answer.
>Yes, I compose solr query from frontend request, but I'm not able to
>sort by a custom order, only by natural order (for example:
>sort=category desc, source desc, /*...*/ ).
>How do you set a custom sort order in solr?
>Thanks
>
>Luca
>
>
> 
>
>On Friday, August 4, 2017 7:41 PM, Rick Leir 
>wrote:
> 
>
> Luca
>I hope you have a web app in front of Solr. It could accept parameters
>from the browser, then construct the query as necessary to do your
>sorting. Cheers -- Rick
>
>On August 4, 2017 5:32:31 AM EDT, Luca Dall'Osto
> wrote:
>>Hello,
>>sorry for the late, I was out of my home.
>>
>>
>>In response to Rick: 
>>I can't do that because: 
>>1) each user should have multiple sort (for example user "A" can sort
>>by date and then by category and then by name ...) .
>>2) the sort is not natural sort: user has a custom order for a field
>>(for example sorting category field of user "A" could be category 10
>at
>>position 1, category 2 at position 2, category 9500 at position 3,
>>category 40 at position 5 ...).
>>
>>
>>In response to Susheel:have you done an example? 
>>
>>Thanks for your response.
>>
>>Luca
>>
>> 
>>
>>On Thursday, July 20, 2017 4:10 AM, Susheel Kumar
>> wrote:
>> 
>>
>> Let me try to put an example for custom sort.
>>
>>On Wed, Jul 19, 2017 at 6:34 AM, Rick Leir  wrote:
>>
>>> Luca,
>>> You can pass a sort parameter in the query. User A could
>>sort=date%20desc
>>> and user b could sort=foofield%20asc.
>>>
>>> Maybe query functions can also help with this. Cheers -- Rick
>>>
>>> On July 19, 2017 4:39:59 AM EDT, Luca Dall'Osto
>>>  wrote:
>>> >Hello,The problem of build an index is that each user has a custom
>>> >source order and category order: are not static orders (for example
>>> >user X could have category:5 as most important category but user Y
>>> >could have category:9 as most important).
>>> >Has anyone ever written a custom sort function in solr?Maybe a link
>>of
>>> >a tutorial or an example could be very helpful. Thanks
>>> >
>>> >Luca
>>> >
>>> >On Tuesday, July 18, 2017 4:18 PM, alessandro.benedetti
>>> > wrote:
>>> >
>>> >
>>> >"I have different "sort preferences", so I can't build a index and
>>use
>>> >for
>>> >sorting.Maybe I have to sort by category then by source and by
>>language
>>> >or
>>> >by source, then by category and by date"
>>> >
>>> >I would like to focus on this bit.
>>> >It is ok to go for a custom function and sort at query time, but I
>>am
>>> >curious to explore why an index time solution should not be ok.
>>> >You can have these distinct fields :
>>> >source_priority
>>> >language_priority
>>> >category_priority
>>> >ect
>>> >
>>> >This values can be assigned at the documents at indexing time (
>>using
>>> >for
>>> >example a custom update request processor).
>>> >Then at query time you can easily sort on those values in a multi
>>> >layered
>>> >approach :
>>> >sort:source_priority desc, category_priority  desc
>>> >Of course, if the priority for a source changes quite often or if
>>it's
>>> >user
>>> >dependent, a query time solution would be preferred.
>>> >
>>> >
>>> >
>>> >
>>> >
>>> >-
>>> >---
>>> >Alessandro Benedetti
>>> >Search Consultant, R&D Software Engineer, Director
>>> >Sease Ltd. - www.sease.io
>>> >--
>>> >View this message in context:
>>> >http://lucene.472066.n3.nabble.com/Get-results-in-
>>> multiple-orders-multiple-boosts-tp4346304p4346559.html
>>> >Sent from the Solr - User mailing list archive at Nabble.com.
>>> >
>>> >
>>> >
>>>
>>> --
>>> Sorry for being brief. Alternate email is rickleir at yahoo dot com
>>
>>
>>  
>
>-- 
>Sorry for being brief. Alternate email is rickleir at yahoo dot com
>
>   

-- 
Sorry for being brief. Alternate email is rickleir at yahoo dot com 

Re: Get results in multiple orders (multiple boosts)

2017-08-07 Thread Luca Dall'Osto
Hello Rick,
thanks for your answer.
Yes, I compose solr query from frontend request, but I'm not able to sort by a 
custom order, only by natural order (for example: sort=category desc, source 
desc, /*...*/ ).
How do you set a custom sort order in solr?
Thanks

Luca


 

On Friday, August 4, 2017 7:41 PM, Rick Leir  wrote:
 

 Luca
I hope you have a web app in front of Solr. It could accept parameters from the 
browser, then construct the query as necessary to do your sorting. Cheers -- 
Rick

On August 4, 2017 5:32:31 AM EDT, Luca Dall'Osto 
 wrote:
>Hello,
>sorry for the late, I was out of my home.
>
>
>In response to Rick: 
>I can't do that because: 
>1) each user should have multiple sort (for example user "A" can sort
>by date and then by category and then by name ...) .
>2) the sort is not natural sort: user has a custom order for a field
>(for example sorting category field of user "A" could be category 10 at
>position 1, category 2 at position 2, category 9500 at position 3,
>category 40 at position 5 ...).
>
>
>In response to Susheel:have you done an example? 
>
>Thanks for your response.
>
>Luca
>
> 
>
>On Thursday, July 20, 2017 4:10 AM, Susheel Kumar
> wrote:
> 
>
> Let me try to put an example for custom sort.
>
>On Wed, Jul 19, 2017 at 6:34 AM, Rick Leir  wrote:
>
>> Luca,
>> You can pass a sort parameter in the query. User A could
>sort=date%20desc
>> and user b could sort=foofield%20asc.
>>
>> Maybe query functions can also help with this. Cheers -- Rick
>>
>> On July 19, 2017 4:39:59 AM EDT, Luca Dall'Osto
>>  wrote:
>> >Hello,The problem of build an index is that each user has a custom
>> >source order and category order: are not static orders (for example
>> >user X could have category:5 as most important category but user Y
>> >could have category:9 as most important).
>> >Has anyone ever written a custom sort function in solr?Maybe a link
>of
>> >a tutorial or an example could be very helpful. Thanks
>> >
>> >Luca
>> >
>> >On Tuesday, July 18, 2017 4:18 PM, alessandro.benedetti
>> > wrote:
>> >
>> >
>> >"I have different "sort preferences", so I can't build a index and
>use
>> >for
>> >sorting.Maybe I have to sort by category then by source and by
>language
>> >or
>> >by source, then by category and by date"
>> >
>> >I would like to focus on this bit.
>> >It is ok to go for a custom function and sort at query time, but I
>am
>> >curious to explore why an index time solution should not be ok.
>> >You can have these distinct fields :
>> >source_priority
>> >language_priority
>> >category_priority
>> >ect
>> >
>> >This values can be assigned at the documents at indexing time (
>using
>> >for
>> >example a custom update request processor).
>> >Then at query time you can easily sort on those values in a multi
>> >layered
>> >approach :
>> >sort:source_priority desc, category_priority  desc
>> >Of course, if the priority for a source changes quite often or if
>it's
>> >user
>> >dependent, a query time solution would be preferred.
>> >
>> >
>> >
>> >
>> >
>> >-
>> >---
>> >Alessandro Benedetti
>> >Search Consultant, R&D Software Engineer, Director
>> >Sease Ltd. - www.sease.io
>> >--
>> >View this message in context:
>> >http://lucene.472066.n3.nabble.com/Get-results-in-
>> multiple-orders-multiple-boosts-tp4346304p4346559.html
>> >Sent from the Solr - User mailing list archive at Nabble.com.
>> >
>> >
>> >
>>
>> --
>> Sorry for being brief. Alternate email is rickleir at yahoo dot com
>
>
>  

-- 
Sorry for being brief. Alternate email is rickleir at yahoo dot com

   

Re: Get results in multiple orders (multiple boosts)

2017-08-04 Thread Rick Leir
Luca
I hope you have a web app in front of Solr. It could accept parameters from the 
browser, then construct the query as necessary to do your sorting. Cheers -- 
Rick

On August 4, 2017 5:32:31 AM EDT, Luca Dall'Osto 
 wrote:
>Hello,
>sorry for the late, I was out of my home.
>
>
>In response to Rick: 
>I can't do that because: 
>1) each user should have multiple sort (for example user "A" can sort
>by date and then by category and then by name ...) .
>2) the sort is not natural sort: user has a custom order for a field
>(for example sorting category field of user "A" could be category 10 at
>position 1, category 2 at position 2, category 9500 at position 3,
>category 40 at position 5 ...).
>
>
>In response to Susheel:have you done an example? 
>
>Thanks for your response.
>
>Luca
>
> 
>
>On Thursday, July 20, 2017 4:10 AM, Susheel Kumar
> wrote:
> 
>
> Let me try to put an example for custom sort.
>
>On Wed, Jul 19, 2017 at 6:34 AM, Rick Leir  wrote:
>
>> Luca,
>> You can pass a sort parameter in the query. User A could
>sort=date%20desc
>> and user b could sort=foofield%20asc.
>>
>> Maybe query functions can also help with this. Cheers -- Rick
>>
>> On July 19, 2017 4:39:59 AM EDT, Luca Dall'Osto
>>  wrote:
>> >Hello,The problem of build an index is that each user has a custom
>> >source order and category order: are not static orders (for example
>> >user X could have category:5 as most important category but user Y
>> >could have category:9 as most important).
>> >Has anyone ever written a custom sort function in solr?Maybe a link
>of
>> >a tutorial or an example could be very helpful. Thanks
>> >
>> >Luca
>> >
>> >On Tuesday, July 18, 2017 4:18 PM, alessandro.benedetti
>> > wrote:
>> >
>> >
>> >"I have different "sort preferences", so I can't build a index and
>use
>> >for
>> >sorting.Maybe I have to sort by category then by source and by
>language
>> >or
>> >by source, then by category and by date"
>> >
>> >I would like to focus on this bit.
>> >It is ok to go for a custom function and sort at query time, but I
>am
>> >curious to explore why an index time solution should not be ok.
>> >You can have these distinct fields :
>> >source_priority
>> >language_priority
>> >category_priority
>> >ect
>> >
>> >This values can be assigned at the documents at indexing time (
>using
>> >for
>> >example a custom update request processor).
>> >Then at query time you can easily sort on those values in a multi
>> >layered
>> >approach :
>> >sort:source_priority desc, category_priority  desc
>> >Of course, if the priority for a source changes quite often or if
>it's
>> >user
>> >dependent, a query time solution would be preferred.
>> >
>> >
>> >
>> >
>> >
>> >-
>> >---
>> >Alessandro Benedetti
>> >Search Consultant, R&D Software Engineer, Director
>> >Sease Ltd. - www.sease.io
>> >--
>> >View this message in context:
>> >http://lucene.472066.n3.nabble.com/Get-results-in-
>> multiple-orders-multiple-boosts-tp4346304p4346559.html
>> >Sent from the Solr - User mailing list archive at Nabble.com.
>> >
>> >
>> >
>>
>> --
>> Sorry for being brief. Alternate email is rickleir at yahoo dot com
>
>
>   

-- 
Sorry for being brief. Alternate email is rickleir at yahoo dot com 

Re: Get results in multiple orders (multiple boosts)

2017-08-04 Thread Luca Dall'Osto
Hello,
sorry for the late, I was out of my home.


In response to Rick: 
I can't do that because: 
1) each user should have multiple sort (for example user "A" can sort by date 
and then by category and then by name ...) .
2) the sort is not natural sort: user has a custom order for a field (for 
example sorting category field of user "A" could be category 10 at position 1, 
category 2 at position 2, category 9500 at position 3, category 40 at position 
5 ...).


In response to Susheel:have you done an example? 

Thanks for your response.

Luca

 

On Thursday, July 20, 2017 4:10 AM, Susheel Kumar  
wrote:
 

 Let me try to put an example for custom sort.

On Wed, Jul 19, 2017 at 6:34 AM, Rick Leir  wrote:

> Luca,
> You can pass a sort parameter in the query. User A could sort=date%20desc
> and user b could sort=foofield%20asc.
>
> Maybe query functions can also help with this. Cheers -- Rick
>
> On July 19, 2017 4:39:59 AM EDT, Luca Dall'Osto
>  wrote:
> >Hello,The problem of build an index is that each user has a custom
> >source order and category order: are not static orders (for example
> >user X could have category:5 as most important category but user Y
> >could have category:9 as most important).
> >Has anyone ever written a custom sort function in solr?Maybe a link of
> >a tutorial or an example could be very helpful. Thanks
> >
> >Luca
> >
> >On Tuesday, July 18, 2017 4:18 PM, alessandro.benedetti
> > wrote:
> >
> >
> >"I have different "sort preferences", so I can't build a index and use
> >for
> >sorting.Maybe I have to sort by category then by source and by language
> >or
> >by source, then by category and by date"
> >
> >I would like to focus on this bit.
> >It is ok to go for a custom function and sort at query time, but I am
> >curious to explore why an index time solution should not be ok.
> >You can have these distinct fields :
> >source_priority
> >language_priority
> >category_priority
> >ect
> >
> >This values can be assigned at the documents at indexing time ( using
> >for
> >example a custom update request processor).
> >Then at query time you can easily sort on those values in a multi
> >layered
> >approach :
> >sort:source_priority desc, category_priority  desc
> >Of course, if the priority for a source changes quite often or if it's
> >user
> >dependent, a query time solution would be preferred.
> >
> >
> >
> >
> >
> >-
> >---
> >Alessandro Benedetti
> >Search Consultant, R&D Software Engineer, Director
> >Sease Ltd. - www.sease.io
> >--
> >View this message in context:
> >http://lucene.472066.n3.nabble.com/Get-results-in-
> multiple-orders-multiple-boosts-tp4346304p4346559.html
> >Sent from the Solr - User mailing list archive at Nabble.com.
> >
> >
> >
>
> --
> Sorry for being brief. Alternate email is rickleir at yahoo dot com


   

Re: Get results in multiple orders (multiple boosts)

2017-07-19 Thread Susheel Kumar
Let me try to put an example for custom sort.

On Wed, Jul 19, 2017 at 6:34 AM, Rick Leir  wrote:

> Luca,
> You can pass a sort parameter in the query. User A could sort=date%20desc
> and user b could sort=foofield%20asc.
>
> Maybe query functions can also help with this. Cheers -- Rick
>
> On July 19, 2017 4:39:59 AM EDT, Luca Dall'Osto
>  wrote:
> >Hello,The problem of build an index is that each user has a custom
> >source order and category order: are not static orders (for example
> >user X could have category:5 as most important category but user Y
> >could have category:9 as most important).
> >Has anyone ever written a custom sort function in solr?Maybe a link of
> >a tutorial or an example could be very helpful. Thanks
> >
> >Luca
> >
> >On Tuesday, July 18, 2017 4:18 PM, alessandro.benedetti
> > wrote:
> >
> >
> >"I have different "sort preferences", so I can't build a index and use
> >for
> >sorting.Maybe I have to sort by category then by source and by language
> >or
> >by source, then by category and by date"
> >
> >I would like to focus on this bit.
> >It is ok to go for a custom function and sort at query time, but I am
> >curious to explore why an index time solution should not be ok.
> >You can have these distinct fields :
> >source_priority
> >language_priority
> >category_priority
> >ect
> >
> >This values can be assigned at the documents at indexing time ( using
> >for
> >example a custom update request processor).
> >Then at query time you can easily sort on those values in a multi
> >layered
> >approach :
> >sort:source_priority desc, category_priority  desc
> >Of course, if the priority for a source changes quite often or if it's
> >user
> >dependent, a query time solution would be preferred.
> >
> >
> >
> >
> >
> >-
> >---
> >Alessandro Benedetti
> >Search Consultant, R&D Software Engineer, Director
> >Sease Ltd. - www.sease.io
> >--
> >View this message in context:
> >http://lucene.472066.n3.nabble.com/Get-results-in-
> multiple-orders-multiple-boosts-tp4346304p4346559.html
> >Sent from the Solr - User mailing list archive at Nabble.com.
> >
> >
> >
>
> --
> Sorry for being brief. Alternate email is rickleir at yahoo dot com


Re: Get results in multiple orders (multiple boosts)

2017-07-19 Thread Rick Leir
Luca,
You can pass a sort parameter in the query. User A could sort=date%20desc and 
user b could sort=foofield%20asc. 

Maybe query functions can also help with this. Cheers -- Rick

On July 19, 2017 4:39:59 AM EDT, Luca Dall'Osto  
wrote:
>Hello,The problem of build an index is that each user has a custom
>source order and category order: are not static orders (for example
>user X could have category:5 as most important category but user Y
>could have category:9 as most important).
>Has anyone ever written a custom sort function in solr?Maybe a link of
>a tutorial or an example could be very helpful. Thanks 
>
>Luca
>
>On Tuesday, July 18, 2017 4:18 PM, alessandro.benedetti
> wrote:
> 
>
>"I have different "sort preferences", so I can't build a index and use
>for
>sorting.Maybe I have to sort by category then by source and by language
>or
>by source, then by category and by date"
>
>I would like to focus on this bit.
>It is ok to go for a custom function and sort at query time, but I am
>curious to explore why an index time solution should not be ok.
>You can have these distinct fields :
>source_priority
>language_priority
>category_priority 
>ect
>
>This values can be assigned at the documents at indexing time ( using
>for
>example a custom update request processor).
>Then at query time you can easily sort on those values in a multi
>layered
>approach :
>sort:source_priority desc, category_priority  desc
>Of course, if the priority for a source changes quite often or if it's
>user
>dependent, a query time solution would be preferred.
>
>
>
>
>
>-
>---
>Alessandro Benedetti
>Search Consultant, R&D Software Engineer, Director
>Sease Ltd. - www.sease.io
>--
>View this message in context:
>http://lucene.472066.n3.nabble.com/Get-results-in-multiple-orders-multiple-boosts-tp4346304p4346559.html
>Sent from the Solr - User mailing list archive at Nabble.com.
>
>
>   

-- 
Sorry for being brief. Alternate email is rickleir at yahoo dot com 

Re: Get results in multiple orders (multiple boosts)

2017-07-19 Thread Luca Dall'Osto
Hello,The problem of build an index is that each user has a custom source order 
and category order: are not static orders (for example user X could have 
category:5 as most important category but user Y could have category:9 as most 
important).
Has anyone ever written a custom sort function in solr?Maybe a link of a 
tutorial or an example could be very helpful. Thanks 

Luca

On Tuesday, July 18, 2017 4:18 PM, alessandro.benedetti 
 wrote:
 

 "I have different "sort preferences", so I can't build a index and use for
sorting.Maybe I have to sort by category then by source and by language or
by source, then by category and by date"

I would like to focus on this bit.
It is ok to go for a custom function and sort at query time, but I am
curious to explore why an index time solution should not be ok.
You can have these distinct fields :
source_priority
language_priority
category_priority 
ect

This values can be assigned at the documents at indexing time ( using for
example a custom update request processor).
Then at query time you can easily sort on those values in a multi layered
approach :
sort:source_priority desc, category_priority  desc
Of course, if the priority for a source changes quite often or if it's user
dependent, a query time solution would be preferred.





-
---
Alessandro Benedetti
Search Consultant, R&D Software Engineer, Director
Sease Ltd. - www.sease.io
--
View this message in context: 
http://lucene.472066.n3.nabble.com/Get-results-in-multiple-orders-multiple-boosts-tp4346304p4346559.html
Sent from the Solr - User mailing list archive at Nabble.com.


   

Re: Get results in multiple orders (multiple boosts)

2017-07-18 Thread alessandro.benedetti
"I have different "sort preferences", so I can't build a index and use for
sorting.Maybe I have to sort by category then by source and by language or
by source, then by category and by date"

I would like to focus on this bit.
It is ok to go for a custom function and sort at query time, but I am
curious to explore why an index time solution should not be ok.
You can have these distinct fields :
source_priority
language_priority
category_priority 
ect

This values can be assigned at the documents at indexing time ( using for
example a custom update request processor).
Then at query time you can easily sort on those values in a multi layered
approach :
sort:source_priority desc, category_priority  desc
Of course, if the priority for a source changes quite often or if it's user
dependent, a query time solution would be preferred.





-
---
Alessandro Benedetti
Search Consultant, R&D Software Engineer, Director
Sease Ltd. - www.sease.io
--
View this message in context: 
http://lucene.472066.n3.nabble.com/Get-results-in-multiple-orders-multiple-boosts-tp4346304p4346559.html
Sent from the Solr - User mailing list archive at Nabble.com.


Re: Get results in multiple orders (multiple boosts)

2017-07-18 Thread Susheel Kumar
As Eric suggested, its possible by sorting using custom function. You may
have to use if, sum and exists function etc. to come up with custom score
field and sort using this field. The if condition would check for the
conditions mentioned and keep adding the score etc.

Thanks,
Susheel

On Tue, Jul 18, 2017 at 6:23 AM, Luca Dall'Osto <
tenacious...@yahoo.it.invalid> wrote:

> Hello everyone,thanks for the prompt reply!
> In response to Florian, I can get correct score only when boost for 1
> filed (for example category): the score are correctly increased by the
> factor.But when I try to make a double boost, the score are not great as
> expected (for example, if the greatest boost factor for category is 3 and
> for source is 3,  sometimes I've got documents boosted with category^3 and
> source^1 **before** documents boosted with category^3 and source^3).
> I tired you snippet code "^=[boost]" instead of "^[factor]" but seems not
> work for me: SyntaxError: Cannot parse 'category:9500^': Encountered
> \"\" at line 1 (...)
> In response to Erik, I have different "sort preferences", so I can't build
> a index and use for sorting.Maybe I have to sort by category then by source
> and by language or by source, then by category and by date.The sort
> function that you are talking is a custom sort function of Solr?I build a
> custom PHP method that sort documents queried from Solr and it works good:
> the problem is that if I choose this way I have to get **all** the results
> in a single query and I can't paginate.Today I have millions of record and
> query could be very large, I would like to paginate results.To paginate
> results I need that Solr give me the results query in the correct
> order.Thank you very much
>
> Luca
>
>
>
> On Monday, July 17, 2017 6:04 PM, Erick Erickson <
> erickerick...@gmail.com> wrote:
>
>
>  I don't think boosting is really what you want here. Boosting
> _influences_ the score, it does not impose an ordering.
>
> Sorting _does_ impose an ordering, the question is how to sort and the
> answer depends on how fixed (or not) the sorting criteria are. Do they
> change with different queries? If not, the very simplest thing to do
> is to index a field with a pre-computed sort value. IOW, if your
> ordering is _always_ source 5, 9, 7 index a source_sort field that
> orders things that way and sort on that. Then I'd have a secondary
> sort by score as a tie-breaker.
>
> If that's not the case, perhaps sorting by function (perhaps a custom
> function) would work.
>
> Best,
> Erick
>
> On Mon, Jul 17, 2017 at 4:30 AM, Florian Waltersdorfer
>  wrote:
> > Hi,
> >
> > I am quite the SolR newbie myself, but have you looked at the resulting
> scores, e.g. via fl=*,score (that way, you can see/test how your boosting
> affects the results)?
> > In a similar scenario, I am using fixed value boosts for specific field
> values; "^=[boost]" instead of "^[factor]", for example:
> >
> > category:9500^=20  source:(5^=20 OR 9^=10 OR 7^=5)
> >
> > (Actual fixed values open for experimentation.)
> >
> > Regards,
> > Florian
> >
> > -Ursprüngliche Nachricht-
> > Von: Luca Dall'Osto [mailto:tenacious...@yahoo.it.INVALID]
> > Gesendet: Montag, 17. Juli 2017 12:20
> > An: solr-user@lucene.apache.org
> > Betreff: Get results in multiple orders (multiple boosts)
> >
> > Hello,
> > I'm new in Solr (and in mailing lists..), and I have a question about
> querying contents in multiple custom orders.
> > I 'm trying to query some documents boosted by 2 (or more) fields: I'm
> able to make a search of 2 day and return results boosted by category
> field, like this:
> >
> > ?indent=on
> > &defType=edismax
> > &q=(date:[2017-06-16T00:00:00Z TO 2017-06-18T23:59:59Z])
> > &bq=category:9500^2
> > &bq=category:1100^1
> > &rows=40
> > &wt=jsonThis will return all documents of category 9500 first, and 1100
> in after.Now I would like to get this documents with a second boost based
> on another field, called source.I would like to have documents in this
> order:1) category:9500 AND source:5
> > 2) category:9500 AND source:9
> > 3) category:9500 AND source:7
> > 4) category:1100 AND source:5
> > 5) category:1100 AND source:9
> > 6) category:1100 AND source:7
> > To get this order, I tied with this query:?indent=on &defType=edismax
> &q=(date:[2017-06-16T00:00:00Z TO 2017-06-18T23:59:59Z])
> > &bq=category:9500^2+source:(5^3 OR 9^2 OR 7^1)
> > &bq=category:1100^1+source:(5^3 OR 9^2 OR 7^1)
> > &rows=40
> > &wt=json
> > How can I apply a double boosts to get the documents in my correct
> order? Is boost the correct tool for my purpose?Any help will be greatly
> appreciated. Thanks Luca
>
>
>


Re: Get results in multiple orders (multiple boosts)

2017-07-18 Thread Luca Dall'Osto
Hello everyone,thanks for the prompt reply!
In response to Florian, I can get correct score only when boost for 1 filed 
(for example category): the score are correctly increased by the factor.But 
when I try to make a double boost, the score are not great as expected (for 
example, if the greatest boost factor for category is 3 and for source is 3,  
sometimes I've got documents boosted with category^3 and source^1 **before** 
documents boosted with category^3 and source^3).
I tired you snippet code "^=[boost]" instead of "^[factor]" but seems not work 
for me: SyntaxError: Cannot parse 'category:9500^': Encountered \"\" at 
line 1 (...)
In response to Erik, I have different "sort preferences", so I can't build a 
index and use for sorting.Maybe I have to sort by category then by source and 
by language or by source, then by category and by date.The sort function that 
you are talking is a custom sort function of Solr?I build a custom PHP method 
that sort documents queried from Solr and it works good: the problem is that if 
I choose this way I have to get **all** the results in a single query and I 
can't paginate.Today I have millions of record and query could be very large, I 
would like to paginate results.To paginate results I need that Solr give me the 
results query in the correct order.Thank you very much

Luca

 

On Monday, July 17, 2017 6:04 PM, Erick Erickson  
wrote:
 

 I don't think boosting is really what you want here. Boosting
_influences_ the score, it does not impose an ordering.

Sorting _does_ impose an ordering, the question is how to sort and the
answer depends on how fixed (or not) the sorting criteria are. Do they
change with different queries? If not, the very simplest thing to do
is to index a field with a pre-computed sort value. IOW, if your
ordering is _always_ source 5, 9, 7 index a source_sort field that
orders things that way and sort on that. Then I'd have a secondary
sort by score as a tie-breaker.

If that's not the case, perhaps sorting by function (perhaps a custom
function) would work.

Best,
Erick

On Mon, Jul 17, 2017 at 4:30 AM, Florian Waltersdorfer
 wrote:
> Hi,
>
> I am quite the SolR newbie myself, but have you looked at the resulting 
> scores, e.g. via fl=*,score (that way, you can see/test how your boosting 
> affects the results)?
> In a similar scenario, I am using fixed value boosts for specific field 
> values; "^=[boost]" instead of "^[factor]", for example:
>
> category:9500^=20  source:(5^=20 OR 9^=10 OR 7^=5)
>
> (Actual fixed values open for experimentation.)
>
> Regards,
> Florian
>
> -Ursprüngliche Nachricht-
> Von: Luca Dall'Osto [mailto:tenacious...@yahoo.it.INVALID]
> Gesendet: Montag, 17. Juli 2017 12:20
> An: solr-user@lucene.apache.org
> Betreff: Get results in multiple orders (multiple boosts)
>
> Hello,
> I'm new in Solr (and in mailing lists..), and I have a question about 
> querying contents in multiple custom orders.
> I 'm trying to query some documents boosted by 2 (or more) fields: I'm able 
> to make a search of 2 day and return results boosted by category field, like 
> this:
>
> ?indent=on
> &defType=edismax
> &q=(date:[2017-06-16T00:00:00Z TO 2017-06-18T23:59:59Z])
> &bq=category:9500^2
> &bq=category:1100^1
> &rows=40
> &wt=jsonThis will return all documents of category 9500 first, and 1100 in 
> after.Now I would like to get this documents with a second boost based on 
> another field, called source.I would like to have documents in this order:1) 
> category:9500 AND source:5
> 2) category:9500 AND source:9
> 3) category:9500 AND source:7
> 4) category:1100 AND source:5
> 5) category:1100 AND source:9
> 6) category:1100 AND source:7
> To get this order, I tied with this query:?indent=on &defType=edismax 
> &q=(date:[2017-06-16T00:00:00Z TO 2017-06-18T23:59:59Z])
> &bq=category:9500^2+source:(5^3 OR 9^2 OR 7^1)
> &bq=category:1100^1+source:(5^3 OR 9^2 OR 7^1)
> &rows=40
> &wt=json
> How can I apply a double boosts to get the documents in my correct order? Is 
> boost the correct tool for my purpose?Any help will be greatly appreciated. 
> Thanks Luca

   

Re: Get results in multiple orders (multiple boosts)

2017-07-17 Thread Erick Erickson
I don't think boosting is really what you want here. Boosting
_influences_ the score, it does not impose an ordering.

Sorting _does_ impose an ordering, the question is how to sort and the
answer depends on how fixed (or not) the sorting criteria are. Do they
change with different queries? If not, the very simplest thing to do
is to index a field with a pre-computed sort value. IOW, if your
ordering is _always_ source 5, 9, 7 index a source_sort field that
orders things that way and sort on that. Then I'd have a secondary
sort by score as a tie-breaker.

If that's not the case, perhaps sorting by function (perhaps a custom
function) would work.

Best,
Erick

On Mon, Jul 17, 2017 at 4:30 AM, Florian Waltersdorfer
 wrote:
> Hi,
>
> I am quite the SolR newbie myself, but have you looked at the resulting 
> scores, e.g. via fl=*,score (that way, you can see/test how your boosting 
> affects the results)?
> In a similar scenario, I am using fixed value boosts for specific field 
> values; "^=[boost]" instead of "^[factor]", for example:
>
> category:9500^=20  source:(5^=20 OR 9^=10 OR 7^=5)
>
> (Actual fixed values open for experimentation.)
>
> Regards,
> Florian
>
> -Ursprüngliche Nachricht-
> Von: Luca Dall'Osto [mailto:tenacious...@yahoo.it.INVALID]
> Gesendet: Montag, 17. Juli 2017 12:20
> An: solr-user@lucene.apache.org
> Betreff: Get results in multiple orders (multiple boosts)
>
> Hello,
> I'm new in Solr (and in mailing lists..), and I have a question about 
> querying contents in multiple custom orders.
> I 'm trying to query some documents boosted by 2 (or more) fields: I'm able 
> to make a search of 2 day and return results boosted by category field, like 
> this:
>
> ?indent=on
> &defType=edismax
> &q=(date:[2017-06-16T00:00:00Z TO 2017-06-18T23:59:59Z])
> &bq=category:9500^2
> &bq=category:1100^1
> &rows=40
> &wt=jsonThis will return all documents of category 9500 first, and 1100 in 
> after.Now I would like to get this documents with a second boost based on 
> another field, called source.I would like to have documents in this order:1) 
> category:9500 AND source:5
> 2) category:9500 AND source:9
> 3) category:9500 AND source:7
> 4) category:1100 AND source:5
> 5) category:1100 AND source:9
> 6) category:1100 AND source:7
> To get this order, I tied with this query:?indent=on &defType=edismax 
> &q=(date:[2017-06-16T00:00:00Z TO 2017-06-18T23:59:59Z])
> &bq=category:9500^2+source:(5^3 OR 9^2 OR 7^1)
> &bq=category:1100^1+source:(5^3 OR 9^2 OR 7^1)
> &rows=40
> &wt=json
> How can I apply a double boosts to get the documents in my correct order? Is 
> boost the correct tool for my purpose?Any help will be greatly appreciated. 
> Thanks Luca


AW: Get results in multiple orders (multiple boosts)

2017-07-17 Thread Florian Waltersdorfer
Hi,

I am quite the SolR newbie myself, but have you looked at the resulting scores, 
e.g. via fl=*,score (that way, you can see/test how your boosting affects the 
results)?
In a similar scenario, I am using fixed value boosts for specific field values; 
"^=[boost]" instead of "^[factor]", for example:

category:9500^=20  source:(5^=20 OR 9^=10 OR 7^=5)

(Actual fixed values open for experimentation.)

Regards,
Florian

-Ursprüngliche Nachricht-
Von: Luca Dall'Osto [mailto:tenacious...@yahoo.it.INVALID] 
Gesendet: Montag, 17. Juli 2017 12:20
An: solr-user@lucene.apache.org
Betreff: Get results in multiple orders (multiple boosts)

Hello,
I'm new in Solr (and in mailing lists..), and I have a question about querying 
contents in multiple custom orders.
I 'm trying to query some documents boosted by 2 (or more) fields: I'm able to 
make a search of 2 day and return results boosted by category field, like this:

?indent=on
&defType=edismax
&q=(date:[2017-06-16T00:00:00Z TO 2017-06-18T23:59:59Z])
&bq=category:9500^2
&bq=category:1100^1
&rows=40
&wt=jsonThis will return all documents of category 9500 first, and 1100 in 
after.Now I would like to get this documents with a second boost based on 
another field, called source.I would like to have documents in this order:1) 
category:9500 AND source:5
2) category:9500 AND source:9
3) category:9500 AND source:7
4) category:1100 AND source:5
5) category:1100 AND source:9
6) category:1100 AND source:7
To get this order, I tied with this query:?indent=on &defType=edismax 
&q=(date:[2017-06-16T00:00:00Z TO 2017-06-18T23:59:59Z])
&bq=category:9500^2+source:(5^3 OR 9^2 OR 7^1)
&bq=category:1100^1+source:(5^3 OR 9^2 OR 7^1)
&rows=40
&wt=json
How can I apply a double boosts to get the documents in my correct order? Is 
boost the correct tool for my purpose?Any help will be greatly appreciated. 
Thanks Luca


Get results in multiple orders (multiple boosts)

2017-07-17 Thread Luca Dall'Osto
Hello,
I'm new in Solr (and in mailing lists..), and I have a question about querying 
contents in multiple custom orders.
I 'm trying to query some documents boosted by 2 (or more) fields: I'm able to 
make a search of 2 day and return results boosted by category field, like this:

?indent=on
&defType=edismax
&q=(date:[2017-06-16T00:00:00Z TO 2017-06-18T23:59:59Z]) 
&bq=category:9500^2
&bq=category:1100^1
&rows=40
&wt=jsonThis will return all documents of category 9500 first, and 1100 in 
after.Now I would like to get this documents with a second boost based on 
another field, called source.I would like to have documents in this order:1) 
category:9500 AND source:5
2) category:9500 AND source:9
3) category:9500 AND source:7
4) category:1100 AND source:5
5) category:1100 AND source:9
6) category:1100 AND source:7
To get this order, I tied with this query:?indent=on
&defType=edismax
&q=(date:[2017-06-16T00:00:00Z TO 2017-06-18T23:59:59Z]) 
&bq=category:9500^2+source:(5^3 OR 9^2 OR 7^1)
&bq=category:1100^1+source:(5^3 OR 9^2 OR 7^1)
&rows=40
&wt=json
How can I apply a double boosts to get the documents in my correct order? Is 
boost the correct tool for my purpose?Any help will be greatly appreciated. 
Thanks
Luca