SourceForge.net Logo
Main Overview Wiki Issues Forum Build Fisheye

Welcome, Guest
Guest Settings
Help

Compass Support Forums » Compass » Compass Users

Thread: indexing multilevel object graph

This question is not answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 1 - Pages: 1 - Last Post: Aug 18, 2006 8:08 AM Last Post By: Aleksei Valikov
darnok

Posts: 27
Registered: 8/14/06
indexing multilevel object graph
Posted: Aug 18, 2006 7:23 AM
 
  Click to reply to this thread Reply
I've moved this post out of the isNull query question, does not really belong there...

I have a question on indexing 2+ level hierarchy. Seems I can index parent.child.name, but not parent.child.grandchild.name. The query I use for that is:
session.queryBuilder().term("Server.dataCenter.lob.name", lobName).setAliases(new String[] {"Server"})

Doing so raises:
java.lang.IllegalArgumentException: Failed to find mapping for alias [Server] and path [Server.dataCenter.lob.name]
at org.compass.core.mapping.CompassMapping.getResourcePropertyMappingByPath(Compas sMapping.java:181)
at org.compass.core.mapping.CompassMapping$ResourcePropertyLookup.<init>(Com passMapping.java:50)
at org.compass.core.mapping.CompassMapping.getResourcePropertyLookup(CompassMappin g.java:122)
at org.compass.core.impl.DefaultCompassQueryBuilder.term(DefaultCompassQueryBuilde r.java:308)
at com.compassplayground.dao.CompassDaoImpl$2.doInCompass(CompassDaoImpl.java:36)
at org.compass.core.CompassTemplate.execute(CompassTemplate.java:133)
at org.compass.core.CompassTemplate.execute(CompassTemplate.java:116)
Aleksei Valikov

Posts: 46
Registered: 3/6/06
Re: indexing multilevel object graph
Posted: Aug 18, 2006 8:08 AM   in response to: darnok in response to: darnok
 
  Click to reply to this thread Reply
First of all, try $/parent/child/grandchild/name or $/parent/child/grandchild.name
However, this depends on the mapping, the expression above is for the case where child and grandchild are mapped as components.

General advice: set a brackpoint in DefaultCompassSession.create or save and make two steps in the debugger. You'll have the resource object which will be saved in the index. In this resource, you can easily see the indexed properties - together with their names and values.

I usually do this trick what I can't find something that theoretically must be found.
Legend
Guru: 2001 + pts
Expert: 501 - 2000 pts
Super-star: 101 - 500 pts
Assistant: 51 - 100 pts
Participant: 0 - 50 pts
Helpful Answer (5 pts)
Correct Answer (10 pts)

Point your RSS reader here for a feed of the latest messages in all forums