access document by primary key

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

access document by primary key

onlinespending@gmail.com
what's the quickest and most efficient way to access a doc by its primary
key? suppose I already know a document's unique id and simply want to fetch
it without issuing a sophisticated query.

Thanks,
Ben
Reply | Threaded
Open this post in threaded view
|

Re: access document by primary key

Yonik Seeley-2-2
On Fri, Mar 11, 2011 at 5:58 PM, [hidden email]
<[hidden email]> wrote:
> what's the quickest and most efficient way to access a doc by its primary
> key? suppose I already know a document's unique id and simply want to fetch
> it without issuing a sophisticated query.

Bypassing the normal lucene query parser does give a speed up.

If you're id field is of type string, try the "raw" query parser, or
if you're on trunk, try the "term" query parser for other field types
(like numerics) that need a translation from external to internal
format.

Example: q={!raw f=id}MYDOCUMENTID

-Yonik
http://lucidimagination.com
Reply | Threaded
Open this post in threaded view
|

Re: access document by primary key

Tomás Fernández Löbbe
Is this still true? Assuming that I know that there hasn't been updates or
that I don't care to see a different version of the document, are the term
QP or the raw QP faster than the real-time get handler?

On Fri, Mar 11, 2011 at 3:12 PM, Yonik Seeley <[hidden email]>wrote:

> On Fri, Mar 11, 2011 at 5:58 PM, [hidden email]
> <[hidden email]> wrote:
> > what's the quickest and most efficient way to access a doc by its primary
> > key? suppose I already know a document's unique id and simply want to
> fetch
> > it without issuing a sophisticated query.
>
> Bypassing the normal lucene query parser does give a speed up.
>
> If you're id field is of type string, try the "raw" query parser, or
> if you're on trunk, try the "term" query parser for other field types
> (like numerics) that need a translation from external to internal
> format.
>
> Example: q={!raw f=id}MYDOCUMENTID
>
> -Yonik
> http://lucidimagination.com
>
Reply | Threaded
Open this post in threaded view
|

Re: access document by primary key

Yonik Seeley-2-2
On Thu, May 3, 2012 at 3:01 PM, Tomás Fernández Löbbe
<[hidden email]> wrote:
> Is this still true? Assuming that I know that there hasn't been updates or
> that I don't care to see a different version of the document, are the term
> QP or the raw QP faster than the real-time get handler?

Sort of different things... query parsers only parse queries, not execute them.
If you're looking for documents by ID though, the realtime-get hander
should be the fastest, esp in a distributed setup.

-Yonik
lucenerevolution.com - Lucene/Solr Open Source Search Conference.
Boston May 7-10