lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Matheis <matheis.ste...@googlemail.com>
Subject Re: DIH serialize
Date Tue, 25 Jan 2011 09:13:18 GMT
Rich,

i played around for a few minutes with Script-Transformers, but i have not
enough knowledge to get anything done right know :/
My Idea was: looping over the given row, which should be a Java HashMap or
something like that? and do sth like this (pseudo-code):

var row_data = []
for( var key in row )
{
  row_data.push( '"' + key + '" : '" + row[key] + '"' );
}
row.put( 'whatever_field', '{' + row_data.join( ',' ) + '}' );

Which should result in a json-object like {'key1':'value1', 'key2':'value2'}
- and that should be okay to work with?

Regards
Stefan

On Mon, Jan 24, 2011 at 7:53 PM, Papp Richard <ccode002@gmail.com> wrote:

> Hi Stefan,
>
>  yes, this is exactly what I intend - I don't want to search in this field
> - just quicly return me the result in a serialized form (the search
> criteria
> is on other fields). Well, if I could serialize the data exactly as like
> the
> PHP serialize() does I would be maximally satisfied, but any other form in
> which I could compact the data easily into one field I would be pleased.
>  Can anyone help me? I guess the <script> is quite a good way, but I don't
> know which function should I use there to compact the data to be easily
> usable in PHP. Or any other method?
>
> thanks,
>  Rich
>
> -----Original Message-----
> From: Stefan Matheis [mailto:matheis.stefan@googlemail.com]
> Sent: Monday, January 24, 2011 18:23
> To: solr-user@lucene.apache.org
> Subject: Re: DIH serialize
>
> Hi Rich,
>
> i'm a bit confused after reading your post .. what exactly you wanna try to
> achieve? Serializing (like http://php.net/serialize) your complete row
> into
> one field? Don't wanna search in them, just store and deliver them in your
> results? Does that make sense? Sounds a bit strange :)
>
> Regards
> Stefan
>
> On Mon, Jan 24, 2011 at 10:03 AM, Papp Richard <ccode002@gmail.com> wrote:
>
> > Hi Dennis,
> >
> >  thank you for your answer, but didn't understand why you say it doesn't
> > need serialization. I'm with the option "C".
> >  but the main question is, how to put into one field a result of many
> > fields: "SELECT * FROM".
> >
> > thanks,
> >  Rich
> >
> > -----Original Message-----
> > From: Dennis Gearon [mailto:gearond@sbcglobal.net]
> > Sent: Monday, January 24, 2011 02:07
> > To: solr-user@lucene.apache.org
> > Subject: Re: DIH serialize
> >
> > Depends on your process chain to the eventual viewer/consumer of the
> data.
> >
> > The questions to ask are:
> >  A/ Is the data IN Solr going to be viewed or processed in its original
> > form:
> >      -->set stored = 'true'
> >     --->no serialization needed.
> >  B/ If it's going to be anayzed and searched for separate from any other
> > field,
> >
> >      the analyzing will put it into  an unreadable form. If you need to
> see
> > it,
> > then
> >     --->set indexed="true" and stored="true"
> >     --->no serializaton needed.   C/ If it's NOT going to be viewed AS
> IS,
> > and
> > it's not going to be searched for AS IS,
> >       (i.e. other columns will be how the data is found), and you have
> > another,
> >
> >       serialzable format:
> >       -->set indexed="false" and stored="true"
> >       -->serialize AS PER THE INTENDED APPLICATION,
> >           not sure that Solr can do that at all.
> >  C/ If it's NOT going to be viewed AS IS, and it's not going to be
> searched
> > for
> > AS IS,
> >       (i.e. other columns will be how the data is found), and you have
> > another,
> >
> >       serialzable format:
> >       -->set indexed="false" and stored="true"
> >       -->serialize AS PER THE INTENDED APPLICATION,
> >           not sure that Solr can do that at all.
> >  D/ If it's NOT going to be viewed AS IS, BUT it's going to be searched
> for
> > AS
> > IS,
> >       (this column will be how the data is found), and you have another,
> >       serialzable format:
> >       -->you need to put it into TWO columns
> >       -->A SERIALIZED FIELD
> >       -->set indexed="false" and stored="true"
> >
> >      -->>AN UNSERIALIZED FIELD
> >       -->set indexed="false" and stored="true"
> >       -->serialize AS PER THE INTENDED APPLICATION,
> >           not sure that Solr can do that at all.
> >
> > Hope that helps!
> >
> >
> > Dennis Gearon
> >
> >
> > Signature Warning
> > ----------------
> > It is always a good idea to learn from your own mistakes. It is usually a
> > better
> > idea to learn from others' mistakes, so you do not have to make them
> > yourself.
> > from 'http://blogs.techrepublic.com.com/security/?p=4501&tag=nl.e036'
> >
> >
> > EARTH has a Right To Life,
> > otherwise we all die.
> >
> >
> >
> > ----- Original Message ----
> > From: Papp Richard <ccode002@gmail.com>
> > To: solr-user@lucene.apache.org
> > Sent: Sun, January 23, 2011 2:02:05 PM
> > Subject: DIH serialize
> >
> > Hi all,
> >
> >
> >
> >  I wasted the last few hours trying to serialize some column values (from
> > mysql) into a Solr column, but I just can't find such a function. I'll
> use
> > the value in PHP - I don't know if it is possible to serialize in PHP
> style
> > at all. This is what I tried and works with a given factor:
> >
> >
> >
> > in schema.xml:
> >
> >   <field name="main_timetable"  type="text"     indexed="false"
> > stored="true"     multiValued="true" />
> >
> >
> >
> > in DIH xml:
> >
> >
> >
> > <dataConfig>
> >
> >  <script><![CDATA[
> >
> >    function my_serialize(row)
> >
> >    {
> >
> >      row.put('main_timetable', row.toString());
> >
> >      return row;
> >
> >    }
> >
> >  ]]></script>
> >
> >
> >
> > .
> >
> >
> >
> >      <entity name="main_timetable" query="
> >
> >        SELECT * FROM shop_time_table stt WHERE stt.shop_id = '${shop.id
> > }';"
> >
> >        transformer="script:my_serialize"
> >
> >        >
> >
> > .
> >
> > >
> >
> >
> >
> >  Can I use java directly in script (<script language="Java">) ?
> >
> >  How could I achieve this? Or any other idea?
> >
> >  I need these values together (from a row) and I need then in PHP to
> handle
> > the result easily.
> >
> >
> >
> > thanks,
> >
> >  Rich
> >
> >
> > __________ Information from ESET NOD32 Antivirus, version of virus
> > signature database 5740 (20101228) __________
> >
> > The message was checked by ESET NOD32 Antivirus.
> >
> > http://www.eset.com
> >
> >
> >
> > __________ Information from ESET NOD32 Antivirus, version of virus
> > signature database 5740 (20101228) __________
> >
> > The message was checked by ESET NOD32 Antivirus.
> >
> > http://www.eset.com
> >
> >
> >
>
>
> __________ Information from ESET NOD32 Antivirus, version of virus
> signature
> database 5740 (20101228) __________
>
> The message was checked by ESET NOD32 Antivirus.
>
> http://www.eset.com
>
>
>
> __________ Information from ESET NOD32 Antivirus, version of virus
> signature
> database 5740 (20101228) __________
>
> The message was checked by ESET NOD32 Antivirus.
>
> http://www.eset.com
>
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message