metadata (Temp-Index-Score) when using SelectFields<T>()

214 views
Skip to first unread message

balazs

unread,
Aug 14, 2012, 9:32:45 PM8/14/12
to rav...@googlegroups.com
Is it possible to get the Temp-Index-Score when SelectFields()?  I'm getting null back at moment.  I'm guessing this may be related to this previous post.
Is the story basically that, shy of having the query return RavenJObject and getting the score from the accompanying metadata, it's not possible to get at this value on the client when using Map/Reduce, TransformResults, SelectFields, or As?  Is there any way to actually get this value within TransformResults (I'm guessing not)?

Oren Eini (Ayende Rahien)

unread,
Aug 15, 2012, 7:42:20 AM8/15/12
to rav...@googlegroups.com
This actually should be available in the transform results, I think.
And if you really care for this, you can probably do this in a listener on the client side, I think.

Balazs Czifra

unread,
Aug 15, 2012, 8:45:50 AM8/15/12
to rav...@googlegroups.com

By 'should' do you mean it is something that you think ravendb already implements (if so, how do I get at it in transformresults) , or  do you mean that it would ideally implement this In the future?

Oren Eini (Ayende Rahien)

unread,
Aug 15, 2012, 8:49:49 AM8/15/12
to rav...@googlegroups.com
In TransformResults, you can get it via:

from result in results
select new 
{
    Score = result["@metadata"]["Temp-Index-Score"]

Balazs Czifra

unread,
Aug 15, 2012, 8:52:24 AM8/15/12
to rav...@googlegroups.com

THANKS!

Oren Eini (Ayende Rahien)

unread,
Aug 15, 2012, 9:50:53 AM8/15/12
to rav...@googlegroups.com
Wait, does this work?

Balazs Czifra

unread,
Aug 15, 2012, 10:07:00 AM8/15/12
to rav...@googlegroups.com
Unfortunately it doesn't seem to.  My index is a multi-map index with a reduce and a transform.  In my transform I tried to say LuceneScore = result["@metadata"]["Temp-Index-Score"] but the compiler complains that it "cannot apply indexing" to the type emitted by my reduce.

balazs

unread,
Aug 15, 2012, 11:42:42 AM8/15/12
to rav...@googlegroups.com
I've also tried using an IDocumentVersionListener, but the DocumentToEntity() method never seems to get hit.  I'm guessing that could be because the index returns a projection and thus bypasses the document-to-entity logic.  So, I can't seem to grab the metadata in transformresults, and I can't seem to grab in the listener.  Any other ideas?

balazs

unread,
Aug 15, 2012, 3:27:32 PM8/15/12
to rav...@googlegroups.com
This doesn't work in TransformResults:

Score = result["@metadata"]["Temp-Index-Score"] }

However, this does:
Score = MetadataFor(result)["Temp-Index-Score"]

Hopefully this helps anybody else trying to do something similar.

Oren Eini (Ayende Rahien)

unread,
Aug 16, 2012, 12:36:51 AM8/16/12
to rav...@googlegroups.com
try:

AsDocument(result)["@metadata"]["Temp-Index-Score"] 
Reply all
Reply to author
Forward
0 new messages