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 ahammad <ah...@gmail.com> on 2009/07/29 16:09:16 UTC

Question about formatting the results returned from Solr

Hi all,

Not sure how good my title is, but here is a (hopefully) better explanation
on what I mean.

I am indexing a set of articles from a DB. Each article has an author. The
author is saved in then the DB as an author ID, which is a number.

There is another table in the DB with more relevant information about the
author. Basically it has columns like:

id, firstname, lastname, email, userid

I set up the DIH so that it returns the userid, and it works fine:

<arr name="author">
   <str>jdoe</str>
   <str>msmith</str>
</arr>

Would it be possible to return all of the information about the author
(first name, ...) as a subset of the results above?

Here is what I mean:

<arr name="author">
   <arr name="jdoe">
      <str name="firstName">John</str>
      <str name="lastName">Doe</str>
      <str name="email">jdoe@doe.com</str>
   </arr>
   ...
</arr>

Something similar to that at least...

Not sure how descriptive I was, but any pointers would be highly
appreciated.

Cheers

-- 
View this message in context: http://www.nabble.com/Question-about-formatting-the-results-returned-from-Solr-tp24719831p24719831.html
Sent from the Solr - User mailing list archive at Nabble.com.


Re: Question about formatting the results returned from Solr

Posted by Avlesh Singh <av...@gmail.com>.
>
> instead they should be sent to separate fields
> author_fname
> author_lname
> author_email
>

or, a dynamic field called author_* (I am assuming all of the author fields
to be of the same type).

And if you use SolrJ, you can transform this info into a data structure like
"Map<String, String> authorInfo", where the keys would be "firstName",
"lastName", "email" etc. Look for more here -
http://issues.apache.org/jira/browse/SOLR-1129

Cheers
Avlesh

2009/7/30 Noble Paul നോബിള്‍ नोब्ळ् <no...@corp.aol.com>

> apparently all the dat ais going to one field 'author'
>
> instead they should be sent to separate fields
> author_fname
> author_lname
> author_email
>
> so you would get details like
>
>     <str name="author_fname">John</str>
>     <str name="author_lname">Doe</str>
>     <str name="author_email">jdoe@doe.com</str>
>
>
>
> On Wed, Jul 29, 2009 at 7:39 PM, ahammad<ah...@gmail.com> wrote:
> >
> > Hi all,
> >
> > Not sure how good my title is, but here is a (hopefully) better
> explanation
> > on what I mean.
> >
> > I am indexing a set of articles from a DB. Each article has an author.
> The
> > author is saved in then the DB as an author ID, which is a number.
> >
> > There is another table in the DB with more relevant information about the
> > author. Basically it has columns like:
> >
> > id, firstname, lastname, email, userid
> >
> > I set up the DIH so that it returns the userid, and it works fine:
> >
> > <arr name="author">
> >   <str>jdoe</str>
> >   <str>msmith</str>
> > </arr>
> >
> > Would it be possible to return all of the information about the author
> > (first name, ...) as a subset of the results above?
> >
> > Here is what I mean:
> >
> > <arr name="author">
> >   <arr name="jdoe">
> >      <str name="firstName">John</str>
> >      <str name="lastName">Doe</str>
> >      <str name="email">jdoe@doe.com</str>
> >   </arr>
> >   ...
> > </arr>
> >
> > Something similar to that at least...
> >
> > Not sure how descriptive I was, but any pointers would be highly
> > appreciated.
> >
> > Cheers
> >
> > --
> > View this message in context:
> http://www.nabble.com/Question-about-formatting-the-results-returned-from-Solr-tp24719831p24719831.html
> > Sent from the Solr - User mailing list archive at Nabble.com.
> >
> >
>
>
>
> --
> -----------------------------------------------------
> Noble Paul | Principal Engineer| AOL | http://aol.com
>

Re: Question about formatting the results returned from Solr

Posted by ahammad <ah...@gmail.com>.
Yes, I get that.

The problem arises when you have multiple authors. How can I know which
first name goes with which user id etc...

Cheers


Noble Paul നോബിള്‍  नोब्ळ्-2 wrote:
> 
> apparently all the dat ais going to one field 'author'
> 
> instead they should be sent to separate fields
> author_fname
> author_lname
> author_email
> 
> so you would get details like
> 
>      <str name="author_fname">John</str>
>      <str name="author_lname">Doe</str>
>      <str name="author_email">jdoe@doe.com</str>
> 
> 
> 
> On Wed, Jul 29, 2009 at 7:39 PM, ahammad<ah...@gmail.com> wrote:
>>
>> Hi all,
>>
>> Not sure how good my title is, but here is a (hopefully) better
>> explanation
>> on what I mean.
>>
>> I am indexing a set of articles from a DB. Each article has an author.
>> The
>> author is saved in then the DB as an author ID, which is a number.
>>
>> There is another table in the DB with more relevant information about the
>> author. Basically it has columns like:
>>
>> id, firstname, lastname, email, userid
>>
>> I set up the DIH so that it returns the userid, and it works fine:
>>
>> <arr name="author">
>>   <str>jdoe</str>
>>   <str>msmith</str>
>> </arr>
>>
>> Would it be possible to return all of the information about the author
>> (first name, ...) as a subset of the results above?
>>
>> Here is what I mean:
>>
>> <arr name="author">
>>   <arr name="jdoe">
>>      <str name="firstName">John</str>
>>      <str name="lastName">Doe</str>
>>      <str name="email">jdoe@doe.com</str>
>>   </arr>
>>   ...
>> </arr>
>>
>> Something similar to that at least...
>>
>> Not sure how descriptive I was, but any pointers would be highly
>> appreciated.
>>
>> Cheers
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Question-about-formatting-the-results-returned-from-Solr-tp24719831p24719831.html
>> Sent from the Solr - User mailing list archive at Nabble.com.
>>
>>
> 
> 
> 
> -- 
> -----------------------------------------------------
> Noble Paul | Principal Engineer| AOL | http://aol.com
> 
> 

-- 
View this message in context: http://www.nabble.com/Question-about-formatting-the-results-returned-from-Solr-tp24719831p24737962.html
Sent from the Solr - User mailing list archive at Nabble.com.


Re: Question about formatting the results returned from Solr

Posted by Noble Paul നോബിള്‍ नोब्ळ् <no...@corp.aol.com>.
apparently all the dat ais going to one field 'author'

instead they should be sent to separate fields
author_fname
author_lname
author_email

so you would get details like

     <str name="author_fname">John</str>
     <str name="author_lname">Doe</str>
     <str name="author_email">jdoe@doe.com</str>



On Wed, Jul 29, 2009 at 7:39 PM, ahammad<ah...@gmail.com> wrote:
>
> Hi all,
>
> Not sure how good my title is, but here is a (hopefully) better explanation
> on what I mean.
>
> I am indexing a set of articles from a DB. Each article has an author. The
> author is saved in then the DB as an author ID, which is a number.
>
> There is another table in the DB with more relevant information about the
> author. Basically it has columns like:
>
> id, firstname, lastname, email, userid
>
> I set up the DIH so that it returns the userid, and it works fine:
>
> <arr name="author">
>   <str>jdoe</str>
>   <str>msmith</str>
> </arr>
>
> Would it be possible to return all of the information about the author
> (first name, ...) as a subset of the results above?
>
> Here is what I mean:
>
> <arr name="author">
>   <arr name="jdoe">
>      <str name="firstName">John</str>
>      <str name="lastName">Doe</str>
>      <str name="email">jdoe@doe.com</str>
>   </arr>
>   ...
> </arr>
>
> Something similar to that at least...
>
> Not sure how descriptive I was, but any pointers would be highly
> appreciated.
>
> Cheers
>
> --
> View this message in context: http://www.nabble.com/Question-about-formatting-the-results-returned-from-Solr-tp24719831p24719831.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>
>



-- 
-----------------------------------------------------
Noble Paul | Principal Engineer| AOL | http://aol.com