You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by John <fa...@gmail.com> on 2013/01/17 17:20:35 UTC

Function Query vs. Analyzing results

Hi,

Is there any performance boost when using FunctionQuery over getting all
the documents and analyzing their result fields?

As far as I understand, Function Query does exactly that, for each matched
document it feches the fields you're interested at, and then it calculates
whatever score mechanism you need.

Are there some special configurations that I can use that take make
FunctionQueries faster?

Cheers,
John

Re: Function Query vs. Analyzing results

Posted by Mikhail Khludnev <mk...@griddynamics.com>.
no-no-no. your implementation as slow as result processing, due to using
stored fields.
Fast way is something like
*org.apache.solr.schema.IntField.getValueSource(SchemaField,
QParser)* .
it's worth to check how the standard functions are build - check the static
{} block in org.apache.solr.search.ValueSourceParser
I just googled this tutorial and find it rather useful for you. Feel free
to check.
http://www.solrtutorial.com/custom-solr-functionquery.html


On Thu, Jan 17, 2013 at 8:53 PM, John <fa...@gmail.com> wrote:

> Hi Mikhail,
>
> Thanks for the info.
>
> If my FunctionQuery accesses stored fields like that:
>
> public float floatVal(int docNum) {
>
>   Document doc = null;
>   try { doc = reader.document(docNum); } catch (Exception e) {}
>   return getSimilarityScore(doc);
> }
>
> Is it still the same case? Is there a faster way to access document info?
>
>
> Cheers,
>
> John
>
>
>
>
> On Thu, Jan 17, 2013 at 6:40 PM, Mikhail Khludnev <
> mkhludnev@griddynamics.com> wrote:
>
> > Hello John,
> >
> > > getting all the documents and analyzing their result fields?
> >
> > is almost not ever possible. Lucene stored fields usually are really
> slow.
> >
> > when FunctionQueries is backed of field values it uses Lucene FieldCache,
> > which is array of field values that's damn faster.
> >
> > You are welcome.
> >
> >
> > On Thu, Jan 17, 2013 at 8:20 PM, John <fa...@gmail.com> wrote:
> >
> > > Hi,
> > >
> > > Is there any performance boost when using FunctionQuery over getting
> all
> > > the documents and analyzing their result fields?
> > >
> > > As far as I understand, Function Query does exactly that, for each
> > matched
> > > document it feches the fields you're interested at, and then it
> > calculates
> > > whatever score mechanism you need.
> > >
> > > Are there some special configurations that I can use that take make
> > > FunctionQueries faster?
> > >
> > > Cheers,
> > > John
> > >
> >
> >
> >
> > --
> > Sincerely yours
> > Mikhail Khludnev
> > Principal Engineer,
> > Grid Dynamics
> >
> > <http://www.griddynamics.com>
> >  <mk...@griddynamics.com>
> >
>



-- 
Sincerely yours
Mikhail Khludnev
Principal Engineer,
Grid Dynamics

<http://www.griddynamics.com>
 <mk...@griddynamics.com>

Re: Function Query vs. Analyzing results

Posted by John <fa...@gmail.com>.
Hi Mikhail,

Thanks for the info.

If my FunctionQuery accesses stored fields like that:

public float floatVal(int docNum) {

  Document doc = null;
  try { doc = reader.document(docNum); } catch (Exception e) {}
  return getSimilarityScore(doc);
}

Is it still the same case? Is there a faster way to access document info?


Cheers,

John




On Thu, Jan 17, 2013 at 6:40 PM, Mikhail Khludnev <
mkhludnev@griddynamics.com> wrote:

> Hello John,
>
> > getting all the documents and analyzing their result fields?
>
> is almost not ever possible. Lucene stored fields usually are really slow.
>
> when FunctionQueries is backed of field values it uses Lucene FieldCache,
> which is array of field values that's damn faster.
>
> You are welcome.
>
>
> On Thu, Jan 17, 2013 at 8:20 PM, John <fa...@gmail.com> wrote:
>
> > Hi,
> >
> > Is there any performance boost when using FunctionQuery over getting all
> > the documents and analyzing their result fields?
> >
> > As far as I understand, Function Query does exactly that, for each
> matched
> > document it feches the fields you're interested at, and then it
> calculates
> > whatever score mechanism you need.
> >
> > Are there some special configurations that I can use that take make
> > FunctionQueries faster?
> >
> > Cheers,
> > John
> >
>
>
>
> --
> Sincerely yours
> Mikhail Khludnev
> Principal Engineer,
> Grid Dynamics
>
> <http://www.griddynamics.com>
>  <mk...@griddynamics.com>
>

Re: Function Query vs. Analyzing results

Posted by Mikhail Khludnev <mk...@griddynamics.com>.
Hello John,

> getting all the documents and analyzing their result fields?

is almost not ever possible. Lucene stored fields usually are really slow.

when FunctionQueries is backed of field values it uses Lucene FieldCache,
which is array of field values that's damn faster.

You are welcome.


On Thu, Jan 17, 2013 at 8:20 PM, John <fa...@gmail.com> wrote:

> Hi,
>
> Is there any performance boost when using FunctionQuery over getting all
> the documents and analyzing their result fields?
>
> As far as I understand, Function Query does exactly that, for each matched
> document it feches the fields you're interested at, and then it calculates
> whatever score mechanism you need.
>
> Are there some special configurations that I can use that take make
> FunctionQueries faster?
>
> Cheers,
> John
>



-- 
Sincerely yours
Mikhail Khludnev
Principal Engineer,
Grid Dynamics

<http://www.griddynamics.com>
 <mk...@griddynamics.com>