atom feed1 message in net.sourceforge.lists.exist-open[Exist-open] Score always 1 for Lucen...
FromSent OnAttachments
Joe WicentowskiJan 27, 2012 1:38 pm.zip
Subject:[Exist-open] Score always 1 for Lucene wildcard searches?
From:Joe Wicentowski (joe@gmail.com)
Date:Jan 27, 2012 1:38:23 pm
List:net.sourceforge.lists.exist-open
Attachments:
test.zip - 2k

Hi all,

I noticed something odd: the scores for lucene searches that contains a wildcard are all *1*. A non-wildcard search yields the expected score (something between 0 and 1 like 0.2972674). Below is my test, using eXist 1.5dev trunk (as of today).

Has anyone seen this before? Is this a problem with Lucene? Or something in eXist's implementation of Lucene?

Given /db/test/test.xml:

<root> <p>Hello, my name is Joe</p> <p>Hello</p> </root>

And the index definition /db/system/config/db/test/collection.xconf:

<collection xmlns="http://exist-db.org/collection-config/1.0"> <index> <fulltext default="none" attributes="no"/> <lucene> <text qname="p"/> </lucene> </index> </collection>

This query /db/test/test1.xq:

xquery version "1.0"; <results>{ for $hit in //p[ft:query(., 'Hello')] let $score := ft:score($hit) order by $score return <result score="{$score}"> {$hit} </result> }</results>

Returns these results with variable scores:

<results> <result score="0.2972674"> <p>Hello, my name is Joe</p> </result> <result score="0.5945348"> <p>Hello</p> </result> </results>

But this query /db/test/test2.xq:

xquery version "1.0"; <results>{ for $hit in //p[ft:query(., 'He*')] let $score := ft:score($hit) order by $score return <result score="{$score}"> {$hit} </result> }</results>

Returns these results with score = 1:

<results> <result score="1"> <p>Hello, my name is Joe</p> </result> <result score="1"> <p>Hello</p> </result> </results>

I've attached the test files.

Thanks, Joe

------------------------------------------------------------------------------ Try before you buy = See our experts in action! The most comprehensive online learning library for Microsoft developers is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Metro Style Apps, more. Free future releases when you subscribe now! http://p.sf.net/sfu/learndevnow-dev2