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 <fatmanc...@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 <
> mkhlud...@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 <fatmanc...@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>
> >  <mkhlud...@griddynamics.com>
> >
>



-- 
Sincerely yours
Mikhail Khludnev
Principal Engineer,
Grid Dynamics

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

Reply via email to