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 Jason Toy <ja...@gmail.com> on 2011/12/05 21:39:46 UTC

Re: joins and filter queries effecting scoring

Martijn,

I'm just seeing this reply today, please excuse the late reply.  
I tried your suggestion, it I do get results back, but I get back a list of Users when I instead am trying to get back a list of Posts.

Is it not possible to arbitrarily sort by either side of the join in solr?



> Have your tried using the join in the fq instead of the q?
> Like this (assuming user_id_i is a field in the post document type and
> self_id_i a field in the user document type):
> q=posts_text:"hello"&fq={!join from=self_id_i
> to=user_id_i}is_active_boolean:true
> 
> In this example the fq produces a docset that contains all user
> documents that are active. This docset is used as filter during the
> execution of the main query (q param),
> so it only returns posts with the contain the text hello for active users.
> 
> Martijn
> 
> On 28 October 2011 01:57, Jason Toy <ja...@gmail.com> wrote:
>> Does anyone have any idea on this issue?
>> 
>> On Tue, Oct 25, 2011 at 11:40 AM, Jason Toy <ja...@gmail.com> wrote:
>> 
>>> Hi Yonik,
>>> 
>>> Without a Join I would normally query user docs with:
>>> q=data_text:"test"&fq=is_active_boolean:true
>>> 
>>> With joining users with posts, I get no no results:
>>> q={!join from=self_id_i
>>> to=user_id_i}data_text:"test"&fq=is_active_boolean:true&fq=posts_text:"hello"
>>> 
>>> 
>>> 
>>> I am able to use this query, but it gives me the results in an order that I
>>> dont want(nor do I understand its order):
>>> q={!join from=self_id_i to=user_id_i}data_text:"test" AND
>>> is_active_boolean:true&fq=posts_text:"hello"
>>> 
>>> I want the order to be the same as I would get from my original
>>> "q=data_text:"test"&fq=is_active_boolean:true", but with the ability to join
>>> with the Posts docs.
>>> 
>>> 
>>> 
>>> 
>>> 
>>> On Tue, Oct 25, 2011 at 11:30 AM, Yonik Seeley <yonik@lucidimagination.com
>>>> wrote:
>>> 
>>>> Can you give an example of the request (URL) you are sending to Solr?
>>>> 
>>>> -Yonik
>>>> http://www.lucidimagination.com
>>>> 
>>>> 
>>>> 
>>>> On Mon, Oct 24, 2011 at 3:31 PM, Jason Toy <ja...@gmail.com> wrote:
>>>>> I have 2 types of docs, users and posts.
>>>>> I want to view all the docs that belong to certain users by joining
>>>> posts
>>>>> and users together.  I have to filter the users with a filter query of
>>>>> "is_active_boolean:true" so that the score is not effected,but since I
>>>> do a
>>>>> join, I have to move the filter query to the query parameter so that I
>>>> can
>>>>> get the filter applied. The problem is that since the is_active_boolean
>>>> is
>>>>> moved to the query, the score is affected which returns back an order
>>>> that I
>>>>> don't want.
>>>>>  If I leave the is_active_boolean:true in the fq paramater, I get no
>>>>> results back.
>>>>> 
>>>>> My question is how can I apply a filter query to users so that the score
>>>> is
>>>>> not effected?
>>>>> 
>>>> 
>>> 
>>> 
>>> 
>>> --
>>> - sent from my mobile
>>> 
>>> 
>>> 
>> 
>> 
>> --
>> - sent from my mobile
>> 
> 
> 
> 
> -- 
> Met vriendelijke groet,
> 
> Martijn van Groningen