Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Lucene: Java-Dev

CustomScoreQuery Explanation

 

 

Lucene java-dev RSS feed   Index | Next | Previous | View Threaded


mgarski at myspace-inc

Nov 19, 2009, 4:29 PM

Post #1 of 5 (336 views)
Permalink
CustomScoreQuery Explanation

Hi there -



I'm helping out with the Lucene.Net port of 2.9, and when rooting around
in CustomScoreQuery.CustomWeight, I noticed what appears to be an
unnecessary call to doExplain in the explain method.



Current method in trunk:



public Explanation explain(IndexReader reader, int doc) throws
IOException {

Explanation explain = doExplain(reader, doc);

return explain == null ? new Explanation(0.0f, "no matching docs")
: doExplain(reader, doc);

}



Is there a reason it shouldn't be:



public Explanation explain(IndexReader reader, int doc) throws
IOException {

Explanation explain = doExplain(reader, doc);

return explain == null ? new Explanation(0.0f, "no matching docs")
: explain);

}



I might be overlooking something, but it appears to be two calls to
doExplain when only one would suffice.



Michael



Michael Garski

Sr. Search Architect

310.969.7435 (office)

310.251.6355 (mobile)

www.myspace.com/michaelgarski


simon.willnauer at googlemail

Nov 19, 2009, 4:46 PM

Post #2 of 5 (308 views)
Permalink
Re: CustomScoreQuery Explanation [In reply to]

I don't see any reason why doExplain should be called twice. Can you create
an issue in jira please?

Simon

On Nov 20, 2009 1:30 AM, "Michael Garski" <mgarski [at] myspace-inc> wrote:

Hi there –



I’m helping out with the Lucene.Net port of 2.9, and when rooting around in
CustomScoreQuery.CustomWeight, I noticed what appears to be an unnecessary
call to doExplain in the explain method.



Current method in trunk:



*public* Explanation explain(IndexReader reader, *int* doc)
*throws*IOException {

Explanation explain = doExplain(reader, doc);

*return* explain == *null* ? *new* Explanation(0.0f, "no matching
docs") : doExplain(reader, doc);

}



Is there a reason it shouldn’t be:



*public* Explanation explain(IndexReader reader, *int* doc)
*throws*IOException {

Explanation explain = doExplain(reader, doc);

*return* explain == *null* ? *new* Explanation(0.0f, "no matching
docs") : explain);

}



I might be overlooking something, but it appears to be two calls to
doExplain when only one would suffice.



Michael



Michael Garski

Sr. Search Architect

310.969.7435 (office)

310.251.6355 (mobile)

www.myspace.com/michaelgarski


mgarski at myspace-inc

Nov 19, 2009, 4:59 PM

Post #3 of 5 (312 views)
Permalink
RE: CustomScoreQuery Explanation [In reply to]

Will do, along with a patch.



Michael



From: Simon Willnauer [mailto:simon.willnauer [at] googlemail]
Sent: Thursday, November 19, 2009 4:47 PM
To: java-dev [at] lucene
Subject: Re: CustomScoreQuery Explanation



I don't see any reason why doExplain should be called twice. Can you create an issue in jira please?

Simon

On Nov 20, 2009 1:30 AM, "Michael Garski" <mgarski [at] myspace-inc> wrote:

Hi there –



I’m helping out with the Lucene.Net port of 2.9, and when rooting around in CustomScoreQuery.CustomWeight, I noticed what appears to be an unnecessary call to doExplain in the explain method.



Current method in trunk:



public Explanation explain(IndexReader reader, int doc) throws IOException {

Explanation explain = doExplain(reader, doc);

return explain == null ? new Explanation(0.0f, "no matching docs") : doExplain(reader, doc);

}



Is there a reason it shouldn’t be:



public Explanation explain(IndexReader reader, int doc) throws IOException {

Explanation explain = doExplain(reader, doc);

return explain == null ? new Explanation(0.0f, "no matching docs") : explain);

}



I might be overlooking something, but it appears to be two calls to doExplain when only one would suffice.



Michael



Michael Garski

Sr. Search Architect

310.969.7435 (office)

310.251.6355 (mobile)

www.myspace.com/michaelgarski


markrmiller at gmail

Nov 19, 2009, 5:02 PM

Post #4 of 5 (312 views)
Permalink
Re: CustomScoreQuery Explanation [In reply to]

No worries - I think its a bit overkill for the change - I can just pop
it in real quick.

Michael Garski wrote:
>
> Will do, along with a patch.
>
>
>
> Michael
>
>
>
> *From:* Simon Willnauer [mailto:simon.willnauer [at] googlemail]
> *Sent:* Thursday, November 19, 2009 4:47 PM
> *To:* java-dev [at] lucene
> *Subject:* Re: CustomScoreQuery Explanation
>
>
>
> I don't see any reason why doExplain should be called twice. Can you
> create an issue in jira please?
>
> Simon
>
> On Nov 20, 2009 1:30 AM, "Michael Garski" <mgarski [at] myspace-inc
> <mailto:mgarski [at] myspace-inc>> wrote:
>
> Hi there –
>
>
>
> I’m helping out with the Lucene.Net port of 2.9, and when rooting
> around in CustomScoreQuery.CustomWeight, I noticed what appears to
> be an unnecessary call to doExplain in the explain method.
>
>
>
> Current method in trunk:
>
>
>
> *public* Explanation explain(IndexReader reader, *int* doc)
> *throws* IOException {
>
> Explanation explain = doExplain(reader, doc);
>
> *return* explain == *null* ? *new* Explanation(0.0f, "no
> matching docs") : doExplain(reader, doc);
>
> }
>
>
>
> Is there a reason it shouldn’t be:
>
>
>
> *public* Explanation explain(IndexReader reader, *int* doc)
> *throws* IOException {
>
> Explanation explain = doExplain(reader, doc);
>
> *return* explain == *null* ? *new* Explanation(0.0f, "no
> matching docs") : explain);
>
> }
>
>
>
> I might be overlooking something, but it appears to be two calls
> to doExplain when only one would suffice.
>
>
>
> Michael
>
>
>
> Michael Garski
>
> Sr. Search Architect
>
> 310.969.7435 (office)
>
> 310.251.6355 (mobile)
>
> www.myspace.com/michaelgarski <http://www.myspace.com/michaelgarski>
>
>
>


--
- Mark

http://www.lucidimagination.com




---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe [at] lucene
For additional commands, e-mail: java-dev-help [at] lucene


mgarski at myspace-inc

Nov 19, 2009, 5:03 PM

Post #5 of 5 (307 views)
Permalink
RE: CustomScoreQuery Explanation [In reply to]

NP, sounds good.

Michael

-----Original Message-----
From: Mark Miller [mailto:markrmiller [at] gmail]
Sent: Thursday, November 19, 2009 5:02 PM
To: java-dev [at] lucene
Subject: Re: CustomScoreQuery Explanation

No worries - I think its a bit overkill for the change - I can just pop
it in real quick.

Michael Garski wrote:
>
> Will do, along with a patch.
>
>
>
> Michael
>
>
>
> *From:* Simon Willnauer [mailto:simon.willnauer [at] googlemail]
> *Sent:* Thursday, November 19, 2009 4:47 PM
> *To:* java-dev [at] lucene
> *Subject:* Re: CustomScoreQuery Explanation
>
>
>
> I don't see any reason why doExplain should be called twice. Can you
> create an issue in jira please?
>
> Simon
>
> On Nov 20, 2009 1:30 AM, "Michael Garski" <mgarski [at] myspace-inc
> <mailto:mgarski [at] myspace-inc>> wrote:
>
> Hi there –
>
>
>
> I’m helping out with the Lucene.Net port of 2.9, and when rooting
> around in CustomScoreQuery.CustomWeight, I noticed what appears to
> be an unnecessary call to doExplain in the explain method.
>
>
>
> Current method in trunk:
>
>
>
> *public* Explanation explain(IndexReader reader, *int* doc)
> *throws* IOException {
>
> Explanation explain = doExplain(reader, doc);
>
> *return* explain == *null* ? *new* Explanation(0.0f, "no
> matching docs") : doExplain(reader, doc);
>
> }
>
>
>
> Is there a reason it shouldn’t be:
>
>
>
> *public* Explanation explain(IndexReader reader, *int* doc)
> *throws* IOException {
>
> Explanation explain = doExplain(reader, doc);
>
> *return* explain == *null* ? *new* Explanation(0.0f, "no
> matching docs") : explain);
>
> }
>
>
>
> I might be overlooking something, but it appears to be two calls
> to doExplain when only one would suffice.
>
>
>
> Michael
>
>
>
> Michael Garski
>
> Sr. Search Architect
>
> 310.969.7435 (office)
>
> 310.251.6355 (mobile)
>
> www.myspace.com/michaelgarski <http://www.myspace.com/michaelgarski>
>
>
>


--
- Mark

http://www.lucidimagination.com




---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe [at] lucene
For additional commands, e-mail: java-dev-help [at] lucene

Lucene java-dev RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.