You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Dave Schneider <da...@cyc.com> on 2007/09/14 15:59:49 UTC

multiple Tokens in a Tokengroup not matching

Hi,

I've inherited some Lucene 1.9.1 code, and have run into the following 
problem:

I have a TokenGroup with multiple tokens in it, and a query that should 
match against multiple tokens (e.g. X and Y) in the TokenGroup.  
However, when I look in the Hit that results, I see that one of the 
Tokens in the TokenGroup has a weight of 1.0, while all the rest have a 
weight of 0.  If I run a search with just X in the query, it matches the 
TokenGroup, and when I run a search with just Y in the query, it also 
matches the TokenGroup, just as I'd expect.  But a query that includes 
both X and Y looks like only X matches.  I need to see that both X and Y 
matched in order to get my highlighting to work correctly.

Can anyone provide any hints as to what might be going on here, and what 
I might do to fix it?  We have a vague suspicion that it's related to 
the weight on the matching token being 1.0 that's causing Lucene to not 
both with any other tokens (because the weight for the TokenGroup is 
already as high as it can be), but it's just a suspicion.

Thanks,

Dave Schneider


Re: multiple Tokens in a Tokengroup not matching

Posted by Erick Erickson <er...@gmail.com>.
I really can't tell much from your e-mail. What I'd recommend is
that you get a copy of Luke and examine your index (including
your query and it's results). Also, try query.toString() to see what
the actual query submitted to Lucene is, that may give you some
clues as to what's going on.

If the results make no sense, think about posting the results of
the toString and/or the Luke explain to  the list and I suspect
you'll get a more helpful response.

Imagine that you had been given your e-mail while knowing nothing
about the application. There's not much "there" there <G>. More
detail would help us give you a more helpful response....

That said, it's tough getting a bunch of code dropped on  your
head and being told "fix it". Been there, done that. Not much fun.

Best
Erick


On 9/14/07, Dave Schneider <da...@cyc.com> wrote:
>
> Hi,
>
> I've inherited some Lucene 1.9.1 code, and have run into the following
> problem:
>
> I have a TokenGroup with multiple tokens in it, and a query that should
> match against multiple tokens (e.g. X and Y) in the TokenGroup.
> However, when I look in the Hit that results, I see that one of the
> Tokens in the TokenGroup has a weight of 1.0, while all the rest have a
> weight of 0.  If I run a search with just X in the query, it matches the
> TokenGroup, and when I run a search with just Y in the query, it also
> matches the TokenGroup, just as I'd expect.  But a query that includes
> both X and Y looks like only X matches.  I need to see that both X and Y
> matched in order to get my highlighting to work correctly.
>
> Can anyone provide any hints as to what might be going on here, and what
> I might do to fix it?  We have a vague suspicion that it's related to
> the weight on the matching token being 1.0 that's causing Lucene to not
> both with any other tokens (because the weight for the TokenGroup is
> already as high as it can be), but it's just a suspicion.
>
> Thanks,
>
> Dave Schneider
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>