BTW, You will also need to configure your schema.xml to index [and store?] the 
rowtype attribute:

   <field name="rowtype" type="string" indexed="true" stored="true" 
required="true" />

Or alternatively change rowtype to be say rowtype_s to take advantage of Solr's 
dynamic field definitions.

> -----Original Message-----
> From: Neville Burnell [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, 1 October 2008 6:06 PM
> To: solr-user@lucene.apache.org
> Subject: RE: How to select one entity at a time?
> 
> Hi Con,
> 
> what RDBMS are you using?
> 
> This looks like a SQL syntax problem, perhaps the 'literal as column'
> is not right for your setup [while it works for my MS SQL Server].
> 
> An alternative to supplying the "rowtype" attribute as a literal in the
> SQL clause is to use a Solr DIH Template Transformer
> http://wiki.apache.org/solr/DataImportHandler#transformer
> 
> This should allow you to keep the working SQL. For example
> 
> <entity name="user" transformer="TemplateTransformer" query="select *
> from USER">
>       <field column="rowtype" template="user" />
> </entity>
> 
> 
> > -----Original Message-----
> > From: con [mailto:[EMAIL PROTECTED]
> > Sent: Wednesday, 1 October 2008 5:48 PM
> > To: solr-user@lucene.apache.org
> > Subject: RE: How to select one entity at a time?
> >
> >
> > That is exactly what my problem is.:handshake:
> > Thanks for you reply.
> >
> > But I tried your suggestion:
> > Updated the data-config.xml as;
> >
> > <entity name="user" query="select 'user' as rowtype, * from
> > USER"></entity>
> > <entity name="manager" query="select 'manager' as rowtype, * from
> > MANAGERS"></entity>
> >
> > But when I perform the full import itself, it is throwing exception,
> >
> >    SEVERE: Exception while processing: user document :
> > SolrInputDocumnt[{}]
> >     org.apache.solr.handler.dataimport.DataImportHandlerException:
> > Unable to
> > execute
> >     query: select 'user' as rowtype,* from USER Processing Document #
> 1
> >     .......
> > So, as expected, when I go to search it is giving- undefined field
> > rowtype-
> > error.!!!
> > Do I need to update any other files or fields?
> >
> > I am happy that it worked for you...:jumping::jumping:
> > Looking forward for your reply
> > Thanks
> > con
> >
> >
> >
> >
> > Neville Burnell wrote:
> > >
> > > Hi,
> > >
> > >> But while performing a search, if I want to search only the data
> > from
> > >> USER table, how can I acheive it.
> > >
> > > In my app+solr index, we solved this problem by "tagging" entities
> > with a
> > > "rowtype" attribute, something like this:
> > >
> > > <entity name="user" query="select 'user' as rowtype, * from
> > > USER"></entity>
> > > <entity name="manager" query="select 'manager' as rowtype, * from
> > > MANAGERS"></entity>
> > >
> > > Then your 'users' only query becomes something like:
> > >
> > > http://localhost:8983/solr/select/?q=(bob AND
> > > rowtype:user)&version=2.2&start=0&rows=10&indent=on&wt=json
> > >
> > > Hope this helps
> > >
> > >
> > >
> > >> -----Original Message-----
> > >> From: con [mailto:[EMAIL PROTECTED]
> > >> Sent: Wednesday, 1 October 2008 4:54 PM
> > >> To: solr-user@lucene.apache.org
> > >> Subject: Re: How to select one entity at a time?
> > >>
> > >>
> > >> Of course I agree.
> > >> But while performing a search, if I want to search only the data
> > from
> > >> USER
> > >> table, how can I acheive it.
> > >>
> > >> Suppose I have a user name bob in both USER and MANAGER tables. So
> > when
> > >> I
> > >> perform http://localhost:8983/solr/dataimport?command=full-import
> ,
> > all
> > >> the
> > >> USER and MANAGER values will get indexed.
> > >> And when i do a search like,
> > >>
> >
> http://localhost:8983/solr/select/?q=bob&version=2.2&start=0&rows=10&in
> > >> dent=on&wt=json
> > >> it will return all the values indexed from both USER and MANAGER
> > table.
> > >> But I want only the data indexed from either USER table or MANAGER
> > >> table at
> > >> a time based on the end user's choice. How can I achieve it.
> > >>
> > >> Thanks for your reply
> > >> con
> > >>
> > >>
> > >> Noble Paul നോബിള്‍ नोब्ळ् wrote:
> > >> >
> > >> > The entity and the select query has no relationship
> > >> > The entity comes into picture when you do a dataimport
> > >> >
> > >> > eg:
> > >> > http://localhost:8983/solr/dataimport?command=full-
> > import&enity=user
> > >> >
> > >> > This is an indexing operation
> > >> >
> > >> > On Wed, Oct 1, 2008 at 11:26 AM, con <[EMAIL PROTECTED]> wrote:
> > >> >>
> > >> >> Hi guys,
> > >> >> In the URL, http://localhost:8983/solr/select/?q=
> > >> >> XXXX:bob&version=2.2&start=0&rows=10&indent=on&wt=json
> > >> >>
> > >> >> q=XXXX: applies to a field and not to an entity. So If I have 3
> > >> entities
> > >> >> like:
> > >> >>
> > >> >> <dataConfig>
> > >> >>        <dataSource **********/>
> > >> >>                <document>
> > >> >>                        <entity name="user" query="select * from
> > >> USER">
> > >> >>                        </entity>
> > >> >>
> > >> >>                        <entity name="manager" query="select *
> > from
> > >> >> MANAGERS">
> > >> >>                        </entity>
> > >> >>
> > >> >>                        <entity name="both" query="select * from
> > >> >> MANAGERS,USER where MANAGERS.userID= USER .userID">
> > >> >>                        </entity>
> > >> >>                </document>
> > >> >> </dataConfig>
> > >> >>
> > >> >> I cannot invoke the entity, 'user', just like the above url. i
> > went
> > >> >> through
> > >> >> the possible arguments but didnt found a way to invoke an
> entity.
> > Is
> > >> >> there a
> > >> >> way for this purpose.
> > >> >> ragards
> > >> >> con
> > >> >>
> > >> >>
> > >> >>
> > >> >>
> > >> >>
> > >> >>
> > >> >> con wrote:
> > >> >>>
> > >> >>> Thanks Everybody.
> > >> >>> I have went through the wiki and some other docs. Actually I
> > have a
> > >> >>> tight
> > >> >>> schedule and I have to look into various other things along
> with
> > >> this.
> > >> >>> Currently I am looking into rebuilding solr by writing a
> wrapper
> > >> class.
> > >> >>> I will update you with more meaningful questions soon..
> > >> >>> thanks and regards.
> > >> >>> con
> > >> >>>
> > >> >>>
> > >> >>> Norberto Meijome-6 wrote:
> > >> >>>>
> > >> >>>> On Fri, 26 Sep 2008 02:35:18 -0700 (PDT)
> > >> >>>> con <[EMAIL PROTECTED]> wrote:
> > >> >>>>
> > >> >>>>> What you meant is correct only. Please excuse for that I am
> > new
> > >> to
> > >> >>>>> solr.
> > >> >>>>> :-(
> > >> >>>>
> > >> >>>> Con, have a read here :
> > >> >>>>
> > >> >>>> http://www.ibm.com/developerworks/java/library/j-solr1/
> > >> >>>>
> > >> >>>> it helped me pick up the basics a while back. it refers to
> 1.2,
> > >> but the
> > >> >>>> core concepts are relevant to 1.3 too.
> > >> >>>>
> > >> >>>> b
> > >> >>>> _________________________
> > >> >>>> {Beto|Norberto|Numard} Meijome
> > >> >>>>
> > >> >>>> Hildebrant's Principle:
> > >> >>>>         If you don't know where you are going,
> > >> >>>>         any road will get you there.
> > >> >>>>
> > >> >>>> I speak for myself, not my employer. Contents may be hot.
> > Slippery
> > >> when
> > >> >>>> wet. Reading disclaimers makes you go blind. Writing them is
> > >> worse. You
> > >> >>>> have been Warned.
> > >> >>>>
> > >> >>>>
> > >> >>>
> > >> >>>
> > >> >>
> > >> >> --
> > >> >> View this message in context:
> > >> >> http://www.nabble.com/How-to-select-one-entity-at-a-time--
> > >> tp19668759p19754869.html
> > >> >> Sent from the Solr - User mailing list archive at Nabble.com.
> > >> >>
> > >> >>
> > >> >
> > >> >
> > >> >
> > >> > --
> > >> > --Noble Paul
> > >> >
> > >> >
> > >>
> > >> --
> > >> View this message in context: http://www.nabble.com/How-to-select-
> > one-
> > >> entity-at-a-time--tp19668759p19755437.html
> > >> Sent from the Solr - User mailing list archive at Nabble.com.
> > >
> > >
> > >
> >
> > --
> > View this message in context: http://www.nabble.com/How-to-select-
> one-
> > entity-at-a-time--tp19668759p19755987.html
> > Sent from the Solr - User mailing list archive at Nabble.com.

Reply via email to