AW: Nested entities not imported / do not show up in search?

2015-10-19 Thread Matthias Fischer
Ok, thanks for your advice so far. I can import companies with their nested 
entities (business branches) now. But I wonder whether there is a way to query 
for company name patterns and get the business branches nested inside the 
respective companies. Using the following query I only get the companies 
without their nested entities:
http://localhost:8983/solr/jcg/select?q=firma_namenszeile_1%3AMu*=xml=true

I can use the firma_ebi_nr (the company id) and get the associated branches by 
issueing the following query:
http://localhost:8983/solr/jcg/select?q={!child%20of=%22firma_ebi_nr:123123%22}firma_ebi_nr:123123
This results in a flat list of associated business branches. However I would 
like to search a company by name and in the result I would like to see all 
associated business branches nested inside the respective company.
Is this possible or do I need to issue the second query above for each company 
search result in order to get the nested entities?

Example of what I would like to achieve:

http://localhost:8983/solr/jcg/select?q=firma_namenszeile_1%3AMust*=xml=true



0
1

firma_namenszeile_1:Must*
true
xml




123123
Musterfirma
ac8d5627-b17a--8926-8d5a80680ee4
1515205299087081472



6


43000


43900


 
 



Is this possible? Or maybe there is a better way than nested enties? An 
alternative I could think of is to join companies and branches in the JDBC 
import. But this would result in duplicate companies in the search result (one 
for each associated branch). My goal is to have a suggest field where the user 
can type a company name pattern and gets a list of matching companies including 
the associated branches. Any suggestions?

Kind regards,
Matthias

-Ursprüngliche Nachricht-
Von: Andrea Gazzarini [mailto:a.gazzar...@gmail.com] 
Gesendet: Freitag, 16. Oktober 2015 17:24
An: solr-user@lucene.apache.org
Betreff: Re: Nested entities not imported / do not show up in search?

Hi Matthias,
I guess the company.id field is not unique so you need a "compound"
uniqueKey on Solr, which is not strctly possible. As consequence of that
(company) UUID is probably created before the index phase by an 
UpdateRequestProcessor [1] so you should check your solrconfig.xml and, if I'm 
right, check if the same strategy could be used for the nested entities.

Andrea

[1]
http://lucene.apache.org/solr/5_2_1/solr-core/org/apache/solr/update/processor/UUIDUpdateProcessorFactory.html

2015-10-16 17:11 GMT+02:00 Matthias Fischer <matthias.fisc...@doubleslash.de
>:

> Thank you, Andrea, for answering so quickly.
>
> However I got further errors. I also had to change 
> "firma_ebi_nr" to "id". 
> But it still does not work properly. It seems that an id is auto 
> generated for the company documents but not for the nested ones (the business 
> branches).
> Any ideas how to fix this?
>
> 2015-10-16 12:49:29.650 WARN  (Thread-17) [   x:jcg] o.a.s.h.d.SolrWriter
> Error creating document :
> SolrInputDocument(
> fields: [firma_ebi_nr=317709682, firma_namenszeile_1=Example 
> Company, id=3c7f7421-9d51-4056-a2a0-eebab87a546a, 
> _version_=1515192078460518400, _root_=3c7f7421-9d51-4056-a2a0-eebab87a546a],
> children: [
>SolrInputDocument(fields: [branche_ebc_code=7, 
> _root_=3c7f7421-9d51-4056-a2a0-eebab87a546a]),
>SolrInputDocument(fields: [branche_ebc_code=47000, 
> _root_=3c7f7421-9d51-4056-a2a0-eebab87a546a]),
>SolrInputDocument(fields: [branche_ebc_code=47700, 
> _root_=3c7f7421-9d51-4056-a2a0-eebab87a546a]),
>SolrInputDocument(fields: [branche_ebc_code=47790, 
> _root_=3c7f7421-9d51-4056-a2a0-eebab87a546a]),
>SolrInputDocument(fields: [branche_ebc_code=47791,
> _root_=3c7f7421-9d51-4056-a2a0-eebab87a546a])])
> org.apache.solr.common.SolrException: [doc=null] missing required field: id
> at
> org.apache.solr.update.DocumentBuilder.toDocument(DocumentBuilder.java:198)
> at
> org.apache.solr.update.AddUpdateCommand$1.next(AddUpdateCommand.java:191)
> at
> org.apache.solr.update.AddUpdateCommand$1.next(AddUpdateCommand.java:166)
> at
> org.apache.lucene.index.DocumentsWriterPerThread.updateDocuments(DocumentsWriterPerThread.java:259)
> at
> org.apache.lucene.index.DocumentsWriter.updateDocuments(DocumentsWriter.java:413)
> at
> org.apache.lucene.index.IndexWriter.updateDocuments(IndexWriter.java:1316)
> at
> org.apache.solr.update.DirectUpdateHandler2.addDoc0(DirectUpdateHandler2.java:235)
> at
> org.apache.solr.update.Direc

AW: AW: Nested entities not imported / do not show up in search?

2015-10-19 Thread Matthias Fischer
Thanks, Andrea, your answer does make sense! Obviously as a SOLR newbie I am 
still thinking too much in terms of traditional databases ;-)

Kind regards
Matthias

-Ursprüngliche Nachricht-
Von: Andrea Gazzarini [mailto:a.gazzar...@gmail.com] 
Gesendet: Montag, 19. Oktober 2015 12:05
An: solr-user@lucene.apache.org
Betreff: Re: AW: Nested entities not imported / do not show up in search?

Most probably my answer makes no sense because I don't know the overall 
context, but why don't you import flat branches and companies with a "type"
attribute ("company" or "branch") and a "owner" field that will be valorized 
only for braches with the company id ? Then you could autocomplete on the 
company name (fq=type:"company"). Once selected a company it would be just a 
matter of another query with two fq:
type:"branch", owner: 

Andrea
On 19 Oct 2015 11:48, "Matthias Fischer" <matthias.fisc...@doubleslash.de>
wrote:

> Ok, thanks for your advice so far. I can import companies with their 
> nested entities (business branches) now. But I wonder whether there is 
> a way to query for company name patterns and get the business branches 
> nested inside the respective companies. Using the following query I 
> only get the companies without their nested entities:
>
> http://localhost:8983/solr/jcg/select?q=firma_namenszeile_1%3AMu*=x
> ml=true
>
> I can use the firma_ebi_nr (the company id) and get the associated 
> branches by issueing the following query:
>
> http://localhost:8983/solr/jcg/select?q={!child%20of=%22firma_ebi_nr:1
> 23123%22}firma_ebi_nr:123123 This results in a flat list of associated 
> business branches. However I would like to search a company by name 
> and in the result I would like to see all associated business branches 
> nested inside the respective company.
> Is this possible or do I need to issue the second query above for each 
> company search result in order to get the nested entities?
>
> Example of what I would like to achieve:
>
>
> http://localhost:8983/solr/jcg/select?q=firma_namenszeile_1%3AMust*
> =xml=true
>
> 
> 
> 0
> 1
> 
> firma_namenszeile_1:Must*
> true
> xml
> 
> 
> 
> 
> 123123
> Musterfirma
> ac8d5627-b17a--8926-8d5a80680ee4
> 1515205299087081472
>
> 
> 
> 6
> 
> 
> 43000
> 
> 
> 43900
> 
>
>  
>  
> 
>
>
> Is this possible? Or maybe there is a better way than nested enties? 
> An alternative I could think of is to join companies and branches in 
> the JDBC import. But this would result in duplicate companies in the 
> search result (one for each associated branch). My goal is to have a 
> suggest field where the user can type a company name pattern and gets 
> a list of matching companies including the associated branches. Any 
> suggestions?
>
> Kind regards,
> Matthias
>
> -Ursprüngliche Nachricht-
> Von: Andrea Gazzarini [mailto:a.gazzar...@gmail.com]
> Gesendet: Freitag, 16. Oktober 2015 17:24
> An: solr-user@lucene.apache.org
> Betreff: Re: Nested entities not imported / do not show up in search?
>
> Hi Matthias,
> I guess the company.id field is not unique so you need a "compound"
> uniqueKey on Solr, which is not strctly possible. As consequence of 
> that
> (company) UUID is probably created before the index phase by an 
> UpdateRequestProcessor [1] so you should check your solrconfig.xml 
> and, if I'm right, check if the same strategy could be used for the nested 
> entities.
>
> Andrea
>
> [1]
>
> http://lucene.apache.org/solr/5_2_1/solr-core/org/apache/solr/update/p
> rocessor/UUIDUpdateProcessorFactory.html
>
> 2015-10-16 17:11 GMT+02:00 Matthias Fischer < 
> matthias.fisc...@doubleslash.de
> >:
>
> > Thank you, Andrea, for answering so quickly.
> >
> > However I got further errors. I also had to change 
> > "firma_ebi_nr" to "id".
> > But it still does not work properly. It seems that an id is auto 
> > generated for the company documents but not for the nested ones (the
> business branches).
> > Any ideas how to fix this?
> >
> > 2015-10-16 12:49:29.650 WARN  (Thread-17) [   x:jcg] o.a.s.h.d.SolrWriter
> > Error creating document :
> > SolrInputDocument(
> > fields: [firma_ebi_nr=317709682, firma_namenszeile_1=Example 
> > Company, id=3c7f7421-9d51-4056-a2a0-eebab87a546a,
> > _version_=1515192078460518400,
> _root_=3c7f7421-9d51-4056-a

Nested entities not imported / do not show up in search?

2015-10-16 Thread Matthias Fischer
Hello everybody,

I am trying to import from an Oracle DB 11g2 via DIH using SOLR 5.3.1. 
In my relational DB there are company addresses (table tb_firmen_adressen) and 
branches (table tb_branchen). They have an n:m relationship using the join 
table tb_firmen_branchen. 
Now I would like to find companies by their name and in each company result I 
would like to see the associated branches.
However I only get the companies without the nested entries. As a newbie I'd 
highly appreciate some help as there are no errors or warnings in the log file 
and I could not find any helpful hints in the documentation or elsewhere in the 
internet concerning my problem. 

Here is my data config:















  





And here are the relevant lines from my schema file:

firma_ebi_nr

 
 
 
 
 
 


After restarting solr and calling 
http://localhost:8983/solr/jcg/dataimport?command=full-import I get "Indexing 
completed. Added/Updated:  documents. Deleted 0 documents."
So basically it seams to work, but my search results look like this:

{
  "responseHeader":{
"status":0,
"QTime":71,
"params":{
  "q":"Der Bunte",
  "defType":"edismax",
  "indent":"true",
  "qf":"firma_namenszeile_1",
  "wt":"json"}},
  "response":{"numFound":85,"start":0,"docs":[
  {
"firma_ebi_nr":123123123,
"firma_namenszeile_1":"Der Bunte Laden",
"_version_":1515185579421073408},
  {
 ...
}

Why are there no company branches inside the company records? What's wrong with 
my configuration? Any help is appreciated!

Kind regards
Matthias Fischer



AW: Nested entities not imported / do not show up in search?

2015-10-16 Thread Matthias Fischer
Thank you, Andrea, for answering so quickly.

However I got further errors. I also had to change 
"firma_ebi_nr" to "id". But it 
still does not work properly. It seems that an id is auto generated for the 
company documents but not for the nested ones (the business branches). Any 
ideas how to fix this? 

2015-10-16 12:49:29.650 WARN  (Thread-17) [   x:jcg] o.a.s.h.d.SolrWriter Error 
creating document : 
SolrInputDocument(
fields: [firma_ebi_nr=317709682, firma_namenszeile_1=Example Company, 
id=3c7f7421-9d51-4056-a2a0-eebab87a546a, _version_=1515192078460518400, 
_root_=3c7f7421-9d51-4056-a2a0-eebab87a546a], 
children: [
   SolrInputDocument(fields: [branche_ebc_code=7, 
_root_=3c7f7421-9d51-4056-a2a0-eebab87a546a]), 
   SolrInputDocument(fields: [branche_ebc_code=47000, 
_root_=3c7f7421-9d51-4056-a2a0-eebab87a546a]), 
   SolrInputDocument(fields: [branche_ebc_code=47700, 
_root_=3c7f7421-9d51-4056-a2a0-eebab87a546a]), 
   SolrInputDocument(fields: [branche_ebc_code=47790, 
_root_=3c7f7421-9d51-4056-a2a0-eebab87a546a]), 
   SolrInputDocument(fields: [branche_ebc_code=47791, 
_root_=3c7f7421-9d51-4056-a2a0-eebab87a546a])])
org.apache.solr.common.SolrException: [doc=null] missing required field: id
at 
org.apache.solr.update.DocumentBuilder.toDocument(DocumentBuilder.java:198)
at 
org.apache.solr.update.AddUpdateCommand$1.next(AddUpdateCommand.java:191)
at 
org.apache.solr.update.AddUpdateCommand$1.next(AddUpdateCommand.java:166)
at 
org.apache.lucene.index.DocumentsWriterPerThread.updateDocuments(DocumentsWriterPerThread.java:259)
at 
org.apache.lucene.index.DocumentsWriter.updateDocuments(DocumentsWriter.java:413)
at 
org.apache.lucene.index.IndexWriter.updateDocuments(IndexWriter.java:1316)
at 
org.apache.solr.update.DirectUpdateHandler2.addDoc0(DirectUpdateHandler2.java:235)
at 
org.apache.solr.update.DirectUpdateHandler2.addDoc(DirectUpdateHandler2.java:163)
at 
org.apache.solr.update.processor.RunUpdateProcessor.processAdd(RunUpdateProcessorFactory.java:69)
at 
org.apache.solr.update.processor.UpdateRequestProcessor.processAdd(UpdateRequestProcessor.java:51)
at 
org.apache.solr.update.processor.DistributedUpdateProcessor.doLocalAdd(DistributedUpdateProcessor.java:955)
at 
org.apache.solr.update.processor.DistributedUpdateProcessor.versionAdd(DistributedUpdateProcessor.java:1110)
at 
org.apache.solr.update.processor.DistributedUpdateProcessor.processAdd(DistributedUpdateProcessor.java:706)
at 
org.apache.solr.update.processor.LogUpdateProcessor.processAdd(LogUpdateProcessorFactory.java:104)
at 
org.apache.solr.update.processor.UpdateRequestProcessor.processAdd(UpdateRequestProcessor.java:51)
at 
org.apache.solr.update.processor.AbstractDefaultValueUpdateProcessorFactory$DefaultValueUpdateProcessor.processAdd(AbstractDefaultValueUpdateProcessorFactory.java:94)
at 
org.apache.solr.handler.dataimport.SolrWriter.upload(SolrWriter.java:71)
at 
org.apache.solr.handler.dataimport.DataImportHandler$1.upload(DataImportHandler.java:259)
at 
org.apache.solr.handler.dataimport.DocBuilder.buildDocument(DocBuilder.java:524)
at 
org.apache.solr.handler.dataimport.DocBuilder.buildDocument(DocBuilder.java:414)
at 
org.apache.solr.handler.dataimport.DocBuilder.doFullDump(DocBuilder.java:329)
at 
org.apache.solr.handler.dataimport.DocBuilder.execute(DocBuilder.java:232)
at 
org.apache.solr.handler.dataimport.DataImporter.doFullImport(DataImporter.java:416)
at 
org.apache.solr.handler.dataimport.DataImporter.runCmd(DataImporter.java:480)
at 
org.apache.solr.handler.dataimport.DataImporter$1.run(DataImporter.java:461)

Kind regards,
Matthias

-Ursprüngliche Nachricht-
Von: Andrea Gazzarini [mailto:a.gazzar...@gmail.com] 
Gesendet: Freitag, 16. Oktober 2015 13:59
An: solr-user@lucene.apache.org
Betreff: Re: Nested entities not imported / do not show up in search?

Hi Matthias,
you should use . in your expressions. So for example, 
here

WHERE fb.EBI_NR='${firma.firma_ebi_nr}'

should be

WHERE fb.EBI_NR='${firma.EBI_NR}'

Best,
Andrea

2015-10-16 13:40 GMT+02:00 Matthias Fischer <matthias.fisc...@doubleslash.de
>:

> Hello everybody,
>
> I am trying to import from an Oracle DB 11g2 via DIH using SOLR 5.3.1.
> In my relational DB there are company addresses (table 
> tb_firmen_adressen) and branches (table tb_branchen). They have an n:m 
> relationship using the join table tb_firmen_branchen.
> Now I would like to find companies by their name and in each company 
> result I would like to see the associated branches.
> However I only get the companies without the nested entries. As a 
> newbie I'd highly appreciate some help as there are no errors or 
> warnings in the log file and I could not find any helpful