Reputation: 33
I have a class called Dataset that has an Organization field. I want to add this to the solr index. I gave to Organization's fields proper annotation as well.
public class Dataset {
@Field("publisher")
@rdf("http://www.w3.org/ns/foaf#publisher")
private Organization publisher;
public class Organization {
@Field("OrganizationName")
@rdf("http://www.w3.org/ns/foaf#name")
private String name;
But when I add the bean to solr what I get is something like this:
<doc>
<arr name="keyword">
<str>public</str>
</arr>
...
<date name="modified">1995-12-31T23:59:59Z</date>
<str name="publisher">Organization [name=MECON]</str>
...
<str name="type">dataset</str>
</doc>
I don't really like how it looks and is ugly to get facets from that. I would like to get something like an individual field called publisherName or something like that (one string for each field in Organization class). Do i need to define a fieldType to the publisher field? How can resolve this issue? Is there any example?
Upvotes: 0
Views: 379
Reputation: 8797
The issue is fixed now, how ever it's difficult to figure out how to use document object binding in general, so I requested an update of the solj tutorial at https://issues.apache.org/jira/browse/SOLR-11032 and will update this answer as soon as it's fixed.
Upvotes: 0
Reputation: 99750
As far as I know, SolrJ doesn't support nested objects yet. See the corresponding JIRA issue about it to get updates and/or contribute to implementing it.
In the meantime, it's up to you to flatten your object graph.
Upvotes: 1