You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Aditya R <ad...@gmail.com> on 2009/07/09 07:22:45 UTC

Using IN to retrieve data after lucene search.

Hi all,

I am new to lucene. In my sample application I have used lucene to index my
17 field db table. I have stored only the primary key of the table in lucene
index and indexed other 16 fields, without storing them. The primary keys of
the searched keyword is then retrieved. The primary key string is then
queried in the database like this 
 'String quer="from Doctors where id IN "+primaryKeys;'  , where
'primaryKeys' will be something like this (23,32,44,56).
Is this the right way to use lucene? Or do you suggest me to store all the
fields in the lucene index and retrieve them.

Thanks,
Aditya
-- 
View this message in context: http://www.nabble.com/Using-IN-to-retrieve-data-after-lucene-search.-tp24404198p24404198.html
Sent from the Lucene - Java Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Re: Using IN to retrieve data after lucene search.

Posted by KK <di...@gmail.com>.
store a field only if you want to retrieve the corresponding values i.e you
want them to be part of the search result, if you just want to use them to
search and you are not bothered about pulling the matched data out of the
index, there is no need to putting extra burden by storing them as well, in
this case indexing is enough,
as per your requirement I think just indexing is good enough...as you are
pulling the data from db...have a look here,

http://stackoverflow.com/questions/650643/lucene-indexing-store-and-indexing-modes-explained

for a all other details related to Lucene indexing you might go thru this as
well,

http://www.lucidimagination.com/blog/2009/03/18/exploring-lucenes-indexing-code-part-2/

HTH,
KK

On Thu, Jul 9, 2009 at 10:52 AM, Aditya R <ad...@gmail.com> wrote:

>
> Hi all,
>
> I am new to lucene. In my sample application I have used lucene to index my
> 17 field db table. I have stored only the primary key of the table in
> lucene
> index and indexed other 16 fields, without storing them. The primary keys
> of
> the searched keyword is then retrieved. The primary key string is then
> queried in the database like this
>  'String quer="from Doctors where id IN "+primaryKeys;'  , where
> 'primaryKeys' will be something like this (23,32,44,56).
> Is this the right way to use lucene? Or do you suggest me to store all the
> fields in the lucene index and retrieve them.
>
> Thanks,
> Aditya
> --
> View this message in context:
> http://www.nabble.com/Using-IN-to-retrieve-data-after-lucene-search.-tp24404198p24404198.html
> Sent from the Lucene - Java Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>

Re: Using IN to retrieve data after lucene search.

Posted by Erick Erickson <er...@gmail.com>.
It depends (tm). How much data are we talking about here?I dislike having to
have two data sources for a running app
just because it's more complicated, so my first try would
be to store all the data in the index and try it. A several
Gigabyte index is not a problem at all (depending upon
how you use it, that is).

But note that storing data doesn't impact searching speed
as much as you'd think, indexing and storing are orthogonal,
and you only access the stored data when you get the
document, not when searching.

But none of this matters if you have to go to the database
anyway. If you can *completely* satisfy the search by
storing the entire table in the index, I'd just try that first.

Best
Erick

On Thu, Jul 9, 2009 at 1:22 AM, Aditya R <ad...@gmail.com> wrote:

>
> Hi all,
>
> I am new to lucene. In my sample application I have used lucene to index my
> 17 field db table. I have stored only the primary key of the table in
> lucene
> index and indexed other 16 fields, without storing them. The primary keys
> of
> the searched keyword is then retrieved. The primary key string is then
> queried in the database like this
>  'String quer="from Doctors where id IN "+primaryKeys;'  , where
> 'primaryKeys' will be something like this (23,32,44,56).
> Is this the right way to use lucene? Or do you suggest me to store all the
> fields in the lucene index and retrieve them.
>
> Thanks,
> Aditya
> --
> View this message in context:
> http://www.nabble.com/Using-IN-to-retrieve-data-after-lucene-search.-tp24404198p24404198.html
> Sent from the Lucene - Java Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>