Below given program will list out all root level dimensions in an Endeca index. (dgraph) This program will be useful if you don’t have access to Endeca jsp reference application or reference application is not coming up due to some reason. This program connect to MDEX installed in localhost and running in port 15000. You may have to change the MDEX host and port as per your environment.
Please refer this program to load the complete dimension tree from Oracle Endeca MDEX.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
package com.ourownjava.search.endeca; import com.endeca.navigation.DimValIdList; import com.endeca.navigation.Dimension; import com.endeca.navigation.DimensionList; import com.endeca.navigation.ENEConnection; import com.endeca.navigation.ENEQuery; import com.endeca.navigation.ENEQueryException; import com.endeca.navigation.ENEQueryResults; import com.endeca.navigation.HttpENEConnection; /** * @author ourownjava.com * */ public class EndecaDimensionClient { private static final String MDEX_HOST = "localhost"; private static final Integer MDEX_PORT = 15000; /** * @param args * @throws ENEQueryException */ public static void main(final String[] args) throws ENEQueryException { final ENEQueryResults results = createConnection().query( createNavigationQuery("0")); final StringBuilder builder = new StringBuilder(); final DimensionList dimensions = results.getNavigation() .getCompleteDimensions(); for (Object element : dimensions) { final Dimension dimension = (Dimension) element; builder.append("id : "); builder.append(dimension.getId()); builder.append(" -> name :"); builder.append(dimension.getName()); builder.append("\n"); } System.out.println(builder.toString()); } private static ENEQuery createNavigationQuery(final String nValue) { final ENEQuery query = new ENEQuery(); final DimValIdList dimValIdList = new DimValIdList(nValue); query.setNavDescriptors(dimValIdList); query.setNavNumERecs(100); return query; } /** * @return */ private static ENEConnection createConnection() { return new HttpENEConnection(MDEX_HOST, MDEX_PORT); } } |
Pingback: How to list all dimensions in a dgraph using presentation API? | Clean Java
Hi,
We know that displaying the dimension results along with a navigation result can result in a performance issue. So is there a way to disable the dimension results to be displayed while forming an ENEQuery? I am hunting for the proper API method but not yet able to figure it out.
hi Anirban, Did you try passing parameter Ne=0 to not to expose any dimension refinement values. Ne=(Exposed Refinements) is passed to determines which dimension navigation refinements are exposed.
Hi, I came to learn that it is not possible to disable having the dimensions in an ENEQueryResult. Setting Ne=0 would just not display them, but the dimensions would be very much in the results.
Well, as a slightly different but a related query to your article, is there a way to get the complete dimension tree structure from an ENEQuery? I am trying out a dimension search instead of the navigation search but struggling to get all the dimensions upto the leaf node level. I tried this article of yours but it gives me only all the dimensions that come up as the first level of the navigation; the further child levels do not come up in this quite understandably as this is a “navigation” query. So, to get all the levels of dimensions using a navigation query, we’ll require multiple calls to Endeca and manually form the structure as we recursively travel towards the leaf level. I don’t think that’s at all a wise way of doing it and I’m struggling to find the clean way. Any help in this direction would be extremely useful.
Hi Anirban, Yes, you are right. This program just get the first level of dimensions. I have written another post to load the whole dimension tree using dimension search. Please take a look at https://ourownjava.com/endeca/oracle-endeca-load-dimension-tree-dimension-search, I would change the title of this post. Thanks for pointing out that.