Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Possible bug in .Boost() or am I using it incorrectly?
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  22 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Tobias Sebring  
View profile  
 More options Aug 2 2012, 7:45 pm
From: Tobias Sebring <tsebr...@gmail.com>
Date: Thu, 2 Aug 2012 16:45:44 -0700 (PDT)
Local: Thurs, Aug 2 2012 7:45 pm
Subject: Possible bug in .Boost() or am I using it incorrectly?

This is the index:
public class Data_Search : AbstractIndexCreationTask<Data,
Data_Search.Result>
{
public class Result
{
public string Text;
public string Texts;

}

public Data_Search()
{
Map = d => from d in data
select new
{
d.Text,
Texts = new object[] { d.Text, d.Variants.Select(x => x.Text) },
d.Type

};

Index(x => x.Text, FieldIndexing.Analyzed);
Index(x => x.Texts, FieldIndexing.Analyzed);

Analyze(x => x.Text, typeof(SimpleAnalyzer).FullName);
Analyze(x => x.Texts, typeof(SimpleAnalyzer).FullName);

}
}

This is the query I'm using:
var q = session.Advanced.LuceneQuery<Data, Data_Search>()
.UsingDefaultOperator(QueryOperator.And)
.OpenSubclause()
 .Search("Text", text)
 //.Boost(1.5m)
 .OrElse()
 .Search("Texts", text)
.CloseSubclause()
.AndAlso()
.OpenSubclause()
 .WhereEquals(x => x.Type, type1)
.OrElse()
.WhereEquals(x => x.Type, type2)
.CloseSubclause()
.ToList();

As soon as I uncomment //.Boost(1.5m) the query will no longer return any
results. This is true irregardless of where i put it and also true when I
set the same boost on both sides of the OrElse. The only boost value that
works is 1m and I suspect that is due to it being the default value.

This is on 1.2.2051-Unstable.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Tobias Sebring  
View profile  
 More options Aug 2 2012, 7:53 pm
From: Tobias Sebring <tsebr...@gmail.com>
Date: Thu, 2 Aug 2012 16:53:36 -0700 (PDT)
Local: Thurs, Aug 2 2012 7:53 pm
Subject: Re: Possible bug in .Boost() or am I using it incorrectly?
Some additional info: This only seems to happen when no results are
found for .Search("Text", text) but results are found
for .OrElse().Search("Texts", text).

On Aug 3, 1:45 am, Tobias Sebring <tsebr...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Oren Eini (Ayende Rahien)  
View profile  
 More options Aug 3 2012, 1:44 am
From: "Oren Eini (Ayende Rahien)" <aye...@ayende.com>
Date: Fri, 3 Aug 2012 08:44:03 +0300
Local: Fri, Aug 3 2012 1:44 am
Subject: Re: [RavenDB] Re: Possible bug in .Boost() or am I using it incorrectly?

Can you create a failing test?


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Tobias Sebring  
View profile  
 More options Aug 3 2012, 4:37 am
From: Tobias Sebring <tsebr...@gmail.com>
Date: Fri, 3 Aug 2012 01:37:43 -0700 (PDT)
Local: Fri, Aug 3 2012 4:37 am
Subject: Re: Possible bug in .Boost() or am I using it incorrectly?
Here is a complete repro on 1.2.2055-Unstable:
https://dl.dropbox.com/u/6420016/DataQuery.zip

Query 1 will succeed due to .Boost(1m) (1m being key)
Query 2 will fail due to .Boost(1.5m) and matching on .OrElse
Query 3 will succeed even though .Boost(1.5m) due to matching
on .Where before .OrElse

I added another weird case in there which I would be happy if you
could have a look at. When using .OrElse.Not.Where(x => x.Type, type)
no match will be returned even though there is one document in the
index that should match this case. The code utilizes a workaround
which only works when there are two Types: .OrElse.Where(x => x.Type,
type == DataType.Type1 ? DataType.Type2 : DataType.Type1).

On Aug 3, 7:44 am, "Oren Eini (Ayende Rahien)" <aye...@ayende.com>
wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Oren Eini (Ayende Rahien)  
View profile  
 More options Aug 3 2012, 4:46 am
From: "Oren Eini (Ayende Rahien)" <aye...@ayende.com>
Date: Fri, 3 Aug 2012 11:46:31 +0300
Local: Fri, Aug 3 2012 4:46 am
Subject: Re: [RavenDB] Re: Possible bug in .Boost() or am I using it incorrectly?

When running this, I get:

Initializing...
Deleting previously inserted documents...
Importing data...
Data import completed...
Waiting for non-stale index and querying...

.Boost(1m): This query will succeed...
Query returned 1 results...

Changed to .Boost(1.5m): This query will fail...
Query returned 1 results...

.Boost(1.5m) but this time we match on .Search("Text", name): This query
will su
cceed...
Query returned 1 results...

Which seems to be fine.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Tobias Sebring  
View profile  
 More options Aug 3 2012, 5:08 am
From: Tobias Sebring <tsebr...@gmail.com>
Date: Fri, 3 Aug 2012 02:08:52 -0700 (PDT)
Local: Fri, Aug 3 2012 5:08 am
Subject: Re: Possible bug in .Boost() or am I using it incorrectly?
That is odd. I have run this query many-many times and the second
query have never been successful. I just ran it again on a fresh
ravendb and it fails every time.

Any idea what could be causing this and/or what parameters in my
environment that is not part of the solution could play a part in the
causing the query to fail?

On Aug 3, 10:46 am, "Oren Eini (Ayende Rahien)" <aye...@ayende.com>
wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Oren Eini (Ayende Rahien)  
View profile  
 More options Aug 3 2012, 5:11 am
From: "Oren Eini (Ayende Rahien)" <aye...@ayende.com>
Date: Fri, 3 Aug 2012 12:11:14 +0300
Local: Fri, Aug 3 2012 5:11 am
Subject: Re: [RavenDB] Re: Possible bug in .Boost() or am I using it incorrectly?

You don't have WaitForNonStaleResults there, it might be that


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Tobias Sebring  
View profile  
 More options Aug 3 2012, 5:19 am
From: Tobias Sebring <tsebr...@gmail.com>
Date: Fri, 3 Aug 2012 02:19:38 -0700 (PDT)
Local: Fri, Aug 3 2012 5:19 am
Subject: Re: Possible bug in .Boost() or am I using it incorrectly?
This line is used for each of the querys:
var datas = q.WaitForNonStaleResults().ToList();

Do I need to put it further up in the query expression? The code where
I initially experienced this issue is fully indexed with not a single
stale index and no write operations after initial import.

Could it be a culture issue or such?

On Aug 3, 11:11 am, "Oren Eini (Ayende Rahien)" <aye...@ayende.com>
wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Oren Eini (Ayende Rahien)  
View profile  
 More options Aug 3 2012, 5:23 am
From: "Oren Eini (Ayende Rahien)" <aye...@ayende.com>
Date: Fri, 3 Aug 2012 12:23:40 +0300
Local: Fri, Aug 3 2012 5:23 am
Subject: Re: [RavenDB] Re: Possible bug in .Boost() or am I using it incorrectly?

inline

On Fri, Aug 3, 2012 at 12:19 PM, Tobias Sebring <tsebr...@gmail.com> wrote:
> This line is used for each of the querys:
> var datas = q.WaitForNonStaleResults().ToList();

> No, it doesn't matter
> Do I need to put it further up in the query expression? The code where
> I initially experienced this issue is fully indexed with not a single
> stale index and no write operations after initial import.

> Could it be a culture issue or such?

I don't believe so.
And 2055 is very recent.

Just to be sure, what _is_ your culture settings?


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Tobias Sebring  
View profile  
 More options Aug 3 2012, 5:25 am
From: Tobias Sebring <tsebr...@gmail.com>
Date: Fri, 3 Aug 2012 02:25:18 -0700 (PDT)
Local: Fri, Aug 3 2012 5:25 am
Subject: Re: Possible bug in .Boost() or am I using it incorrectly?
Yep. It's the culture on my maching. Add this at the top of the main
function and the second query will fail:
Thread.CurrentThread.CurrentCulture = new CultureInfo("sv-SE");

On Aug 3, 11:19 am, Tobias Sebring <tsebr...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Tobias Sebring  
View profile  
 More options Aug 3 2012, 5:34 am
From: Tobias Sebring <tsebr...@gmail.com>
Date: Fri, 3 Aug 2012 02:34:17 -0700 (PDT)
Local: Fri, Aug 3 2012 5:34 am
Subject: Re: Possible bug in .Boost() or am I using it incorrectly?
I don't think the culture should be relevant in my code but I may be
wrong? If I run the second query trying to match a English string that
I also added to .Secondary on the document - it will still fail.

I had a friend run the same project on his manching with the same
result. Our default culture (sv-SE) will cause the second query to
fail, but changing the default culture for the thread to en-US causes
the second query to succeed.

On Aug 3, 11:25 am, Tobias Sebring <tsebr...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Oren Eini (Ayende Rahien)  
View profile  
 More options Aug 3 2012, 11:52 am
From: "Oren Eini (Ayende Rahien)" <aye...@ayende.com>
Date: Fri, 3 Aug 2012 18:52:33 +0300
Local: Fri, Aug 3 2012 11:52 am
Subject: Re: [RavenDB] Re: Possible bug in .Boost() or am I using it incorrectly?

No, it isn't relevant.
That is a bug, I'll fix it.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Tobias Sebring  
View profile  
 More options Aug 3 2012, 12:33 pm
From: Tobias Sebring <tsebr...@gmail.com>
Date: Fri, 3 Aug 2012 09:33:06 -0700 (PDT)
Local: Fri, Aug 3 2012 12:33 pm
Subject: Re: Possible bug in .Boost() or am I using it incorrectly?
I mentioned another problem I'm having with the repro code in
that .OrElse.Not.Where(x => x.Type, type) never returns any results.
I'm using .WhereEquals(x => x.Type, type == DataType.Type1 ?
DataType.Type2 : DataType.Type1) to work around this fact.

Do you know if this is another bug or if I'm using .Not.WhereEquals
incorrectly?

The repro contains code to test this and you may
uncomment .Not.WhereEquals in each of the queries to reproduce the
issue:
.Not.WhereEquals(x => x.Type, type) //this does not work (why?)
//.WhereEquals(x => x.Type, type == DataType.Type1 ? DataType.Type2 :
DataType.Type1)

On Aug 3, 5:52 pm, "Oren Eini (Ayende Rahien)" <aye...@ayende.com>
wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Oren Eini (Ayende Rahien)  
View profile  
 More options Aug 3 2012, 12:34 pm
From: "Oren Eini (Ayende Rahien)" <aye...@ayende.com>
Date: Fri, 3 Aug 2012 19:34:56 +0300
Local: Fri, Aug 3 2012 12:34 pm
Subject: Re: [RavenDB] Re: Possible bug in .Boost() or am I using it incorrectly?

I can't follow this in pieces, can you show a full example?


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Oren Eini (Ayende Rahien)  
View profile  
 More options Aug 3 2012, 12:35 pm
From: "Oren Eini (Ayende Rahien)" <aye...@ayende.com>
Date: Fri, 3 Aug 2012 19:35:10 +0300
Local: Fri, Aug 3 2012 12:35 pm
Subject: Re: [RavenDB] Re: Possible bug in .Boost() or am I using it incorrectly?

Note that in order for NOT to work, you need to have a positive side as well

On Fri, Aug 3, 2012 at 7:34 PM, Oren Eini (Ayende Rahien) <aye...@ayende.com


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Tobias Sebring  
View profile  
 More options Aug 3 2012, 1:22 pm
From: Tobias Sebring <tsebr...@gmail.com>
Date: Fri, 3 Aug 2012 10:22:10 -0700 (PDT)
Local: Fri, Aug 3 2012 1:22 pm
Subject: Re: Possible bug in .Boost() or am I using it incorrectly?
Parameters:
Documents = [
        { Text = "test", Type = Type1 }
];

name = "test";
type = Type2;

Query:
var q = session.Advanced.LuceneQuery<Data, Data_Search>()
        .UsingDefaultOperator(QueryOperator.And)
        .OpenSubclause()
                .Search("Text", name)
                .Boost(2m)
                .OrElse()
                .Search("Texts", name)
        .CloseSubclause()
        .OpenSubclause()
                .WhereEquals(x => x.Type, type)
                .Boost(1.5m)
                .OrElse()
                .Not.WhereEquals(x => x.Type, type)
        .CloseSubclause();
        .WaitForNonStaleResults()
        .ToList();

First subquery will match "test" == "test" on .Search("Text", name).
Second subquery will not match Type1 == Type2 on .WhereEquals(x =>
x.Type, type)
Second subquery should match Type1 != Type2 on .Not.WhereEquals(x =>
x.Type, type) but it does not.

On Aug 3, 6:35 pm, "Oren Eini (Ayende Rahien)" <aye...@ayende.com>
wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Oren Eini (Ayende Rahien)  
View profile  
 More options Aug 3 2012, 4:02 pm
From: "Oren Eini (Ayende Rahien)" <aye...@ayende.com>
Date: Fri, 3 Aug 2012 23:02:53 +0300
Local: Fri, Aug 3 2012 4:02 pm
Subject: Re: [RavenDB] Re: Possible bug in .Boost() or am I using it incorrectly?

This is expected.
Not is based on doing a set not, which means that if the other side is
empty, you get empty result.

You want to express a not like this:

   .OpenSubclause()
                .Where("*:*")
                .AndAlso()
                .Not.WhereEquals(x => x.Type, type)
   .CloseSubclause()

Match everything, except...

...

read more »


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Tobias Sebring  
View profile  
 More options Aug 3 2012, 4:12 pm
From: Tobias Sebring <tsebr...@gmail.com>
Date: Fri, 3 Aug 2012 13:12:21 -0700 (PDT)
Local: Fri, Aug 3 2012 4:12 pm
Subject: Re: Possible bug in .Boost() or am I using it incorrectly?
I see. Do you have any recommendation on how I could set up my query
when I wish to boost the score of one particular type but include all
types in the result?

Match everything but boost score if type equal x.

On Aug 3, 10:02 pm, "Oren Eini (Ayende Rahien)" <aye...@ayende.com>
wrote:

...

read more »


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Oren Eini (Ayende Rahien)  
View profile  
 More options Aug 3 2012, 4:13 pm
From: "Oren Eini (Ayende Rahien)" <aye...@ayende.com>
Date: Fri, 3 Aug 2012 23:13:45 +0300
Local: Fri, Aug 3 2012 4:13 pm
Subject: Re: [RavenDB] Re: Possible bug in .Boost() or am I using it incorrectly?

WhereEquals("Type", "one").Boost(1.5)
.WhereEquals("Type", "two")

Note this assumes default operator of OR

...

read more »


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Tobias Sebring  
View profile  
 More options Aug 3 2012, 4:41 pm
From: Tobias Sebring <tsebr...@gmail.com>
Date: Fri, 3 Aug 2012 13:41:52 -0700 (PDT)
Local: Fri, Aug 3 2012 4:41 pm
Subject: Re: Possible bug in .Boost() or am I using it incorrectly?
This is what I have been doing - but what if Type is an enum that has
five or ten different values?

On Aug 3, 10:13 pm, "Oren Eini (Ayende Rahien)" <aye...@ayende.com>
wrote:

...

read more »


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Oren Eini (Ayende Rahien)  
View profile  
 More options Aug 4 2012, 5:07 am
From: "Oren Eini (Ayende Rahien)" <aye...@ayende.com>
Date: Sat, 4 Aug 2012 12:07:24 +0300
Local: Sat, Aug 4 2012 5:07 am
Subject: Re: [RavenDB] Re: Possible bug in .Boost() or am I using it incorrectly?

And you can for just one of them?
 WhereEquals("Type", "one").Boost(1.5)
 .WhereEquals("Type", "*")

This would match any value.

...

read more »


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Tobias Sebring  
View profile  
 More options Aug 4 2012, 7:36 am
From: Tobias Sebring <tsebr...@gmail.com>
Date: Sat, 4 Aug 2012 04:36:52 -0700 (PDT)
Local: Sat, Aug 4 2012 7:36 am
Subject: Re: Possible bug in .Boost() or am I using it incorrectly?
I'm going to try that. Thanks so much for your help!

On Aug 4, 11:07 am, "Oren Eini (Ayende Rahien)" <aye...@ayende.com>
wrote:

...

read more »


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »