Hello,

according to the description ConstantScoreQuery should return constant score 
for each document matching the supplied filter.
The score should equal the query boost.
However I always get score equal 1.0.

I tried to investigate a little bit and I found a place where the score gets 
overwritten - from the query boost value to 1.0:
it's the method ConstantWeight::normalize (constantscorequery.cpp(92)). This 
method is called from Query::weight(Searcher* searcher) method
and gets as a parameter a norm.

The norm is if using the default similarity 1/sqrt(sumOfSquaredWeights ) which 
is for ConstantScoreQuery
1/sqrt(queryWeight * queryWeight ) = 1 / queryWeight.
So queryWeight is normalized with 1 / queryWeight and it gives 1.

So the question is, why do you normalize CONSTANT score? Shouldn't it be just 
always the same value?

By the way the class ConstantWeight is somehow strange:
- in constructor you initialize the queryWeight with 0 and not the boost factor 
of the parent query.
- the queryWeight is ALWAYS initialized with boost factor of the parent query 
during the sumOfSquaredWeights call, so unless you call this method
  getValue returns 0, after the sumOfSquaredWeights call it returns different 
value.

Jiri

PS: I compared the ConstantScoreQuery implementation with the newest java 
lucene version - and it seems to be the same... 
So am I using the ConstantScoreQuery in a bad way?




-----Original Message-----
From: Itamar Syn-Hershko [mailto:ita...@code972.com] 
Sent: Wednesday, August 04, 2010 1:22 PM
To: clucene-developers@lists.sourceforge.net
Subject: Re: [CLucene-dev] Query Interface, MultiPhraseQuery, Array

Hi,

To the best of my knowledge no one is actively working on any of those 
items at the moment, although some has shown interest in SpanQueries. If 
someone does - please let us all know.

So if you implement any of them and can contribute back this will really 
help.

Re #3 - you are right, I originally implemented it as a while loop and 
in commit ac29f3cbc it was converted to for. This was also spotted by 
Veit. I fixed and committed to master. If there are tests in Java for 
this class that weren't ported yet to cl_test, I strongly suggest to 
port them to verify this fix seals all leaks from this class.

Re #4 - there isn't one, but it shouldn't be too difficult to add one, 
or you can use ValueArray and delete or decref them yourself. We are 
about to finish work on the smart_pointers branch, which does 
refcounting more efficiently using Boost. If you can work with that 
instead and provide feedback, that would be even better.

What do you mean by "the Array implementation does hardly allow reusing 
already allocated arrays"?

Itamar.

On 4/8/2010 12:45 PM, Šplíchal Jiří wrote:
> Hello,
>
> I'm creating queries in our software, and I came across following issues:
> 1) The java 2.3.2 query interface contains a method
>     public void extractTerms(Set terms)
>     which is missing in the current version of CLucene. I think that it would 
> be very useful
>     while creating MultiPraseQueries based on wildcard queries, range queries 
> or other subqueries
>     that produce more than one Term (some of our stemmer may produce more 
> than one stem, searching
>     for thesaurus similar etc.)
>     Is anybody working on this functionality?
> 2) We would also need the span queries - so, same question arises - is 
> anybody working on this functionality?
> 3) I looked over the MultiPhraseQuery very shortly and I just came across 
> this piece of code, that seems
>     to me to be strange (But I haven't not test it yet). On the 5. line you 
> call ++j, bud this index is being
>     increased on the line 3 too - it this really intended that you free only 
> every second Term?
>
>     MultiPhraseQuery::~MultiPhraseQuery(){
>           for (size_t i = 0; i<  termArrays->size(); i++){
>                 for ( size_t j=0;j<termArrays->at(i)->length;j++ ) {
>                       _CLLDECDELETE(termArrays->at(i)->values[j]);
>                       ++j;
>                  }
>                 _CLDELETE(termArrays->at(i));
>           }
>           _CLLDELETE(termArrays);
>           _CLLDELETE(positions);
>           _CLDELETE_CARRAY(field);
>     }
>
> 4) Last question - is there any CL_NS(util)::BaseArray implementation for 
> refcounted objects?
>     Btw. the Array implementation does hardly allow reusing already allocated 
> arrays.
>
> Jiri
>
>
> -----Original Message-----
> From: Kostka Bořivoj [mailto:kos...@tovek.cz]
> Sent: Monday, July 26, 2010 2:52 PM
> To: clucene-developers@lists.sourceforge.net
> Subject: [CLucene-dev] Exception during thread finish
>
> I run the IndexSearcher::_search method from separate thread (different from 
> thread where IndexSearcher is created and deleted).
> When the thread finishes, I get exceptionin mutex_thread::lock() The reason 
> is _internal is already deleted (contains 0xdddddddd).
>
> Any idea what could be wrong?
>
> Borek
>
> Call stack:
>
> clucene-sharedd.dll!lucene::util::mutex_thread::lock()  Line 50 + 0x5 bytes   
> C++
> clucene-sharedd.dll!lucene::util::mutexGuard::mutexGuard(lucene::util::mutex_thread&
>   rMutex={...})  Line 248 C++
> clucene-cored.dll!lucene::util::_ThreadLocal::setNull()  Line 139 + 0x15 
> bytes        C++
> clucene-cored.dll!lucene::util::ThreadLocals::UnregisterThread()  Line 232    
> C++
> clucene-cored.dll!lucene::util::_ThreadLocal::UnregisterCurrentThread()  Line 
> 210     C++
> clucene-cored.dll!DllMain(unsigned short hinstDLL=0, unsigned long 
> fdwReason=3, void * __formal=0x00000000)  Line 37  C++
> clucene-cored.dll!__DllMainCRTStartup(void * hDllHandle=0x01010000, unsigned 
> long dwReason=3, void * lpreserved=0x00000000)  Line 498 + 0x11 bytes    C
> clucene-cored.dll!_DllMainCRTStartup(void * hDllHandle=0x01010000, unsigned 
> long dwReason=3, void * lpreserved=0x00000000)  Line 462 + 0x11 bytes     C
> ntdll.dll!_ldrpcallinitrout...@16()  + 0x14 bytes     
> ntdll.dll!_ldrshutdownthr...@0()  + 0xed bytes        
> kernel32.dll!_exitthr...@4()  + 0x3e bytes    
> msvcr80d.dll!_endthreadex(unsigned int retcode=0)  Line 414   C
> msvcr80d.dll!_callthreadstartex()  Line 348 + 0x15 bytes      C
> msvcr80d.dll!_threadstartex(void * ptd=0x0164fc80)  Line 331  C
> kernel32.dll!_basethreadst...@8()  + 0x37 bytes       
>
> ------------------------------------------------------------------------------
> The Palm PDK Hot Apps Program offers developers who use the
> Plug-In Development Kit to bring their C/C++ apps to Palm for a share
> of $1 Million in cash or HP Products. Visit us here for more details:
> http://ad.doubleclick.net/clk;226879339;13503038;l?
> http://clk.atdmt.com/CRS/go/247765532/direct/01/
> _______________________________________________
> CLucene-developers mailing list
> CLucene-developers@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/clucene-developers
>
> ------------------------------------------------------------------------------
> The Palm PDK Hot Apps Program offers developers who use the
> Plug-In Development Kit to bring their C/C++ apps to Palm for a share
> of $1 Million in cash or HP Products. Visit us here for more details:
> http://p.sf.net/sfu/dev2dev-palm
> _______________________________________________
> CLucene-developers mailing list
> CLucene-developers@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/clucene-developers
>
>
>    

------------------------------------------------------------------------------
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share
of $1 Million in cash or HP Products. Visit us here for more details:
http://p.sf.net/sfu/dev2dev-palm
_______________________________________________
CLucene-developers mailing list
CLucene-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/clucene-developers

------------------------------------------------------------------------------
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share
of $1 Million in cash or HP Products. Visit us here for more details:
http://p.sf.net/sfu/dev2dev-palm
_______________________________________________
CLucene-developers mailing list
CLucene-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/clucene-developers

Reply via email to