WebSphere Commerce suite - Websphere commerce search module - rule query

This is Interesting: Free IT Magazines  
Home > Archive > WebSphere Commerce suite > October 2005 > Websphere commerce search module - rule query





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Websphere commerce search module - rule query

2005-10-03, 7:51 am

Can someone provide me some good resource on how rule query works in CatEntrySearchListDataBean, search designand all related stuff.

2005-10-24, 4:26 pm

Please give me some information about what are traying to do.
For example doing searches in fields that are not the defaults ones.

2005-10-25, 2:54 am

Actually i want to customise advance search and provide attribute search as well, given the attributes, a product with the matching attribute needs to be searched.
So i need to study how rule query works. Bu there is no enough documents.

2005-10-25, 5:54 pm

Well, for example to add an attribute to the search you have to (this is for field4 and field5):
-Create a new class that extends Rulequery and prepare it to manage the two fields:

public class AdvanceSearchRuleQuery extends RuleQuery {
private static final String COPYRIGHT =
com.ibm.commerce.copyright.IBMCopyright.SHORT_COPYRIGHT;
public final static int CATENTRY_FIELD4_Attr = 2001; //Static reference, it is a new number bigger than 1000
public final static int CATENTRY_FIELD5_Attr = 2002; //Static reference, it is a new number bigger than 1000

protected String findAttributeInfoName(int attrId) {
String className;
className = super.findAttributeInfoName(attrId);
switch (attrId) {
case CATENTRY_FIELD4_Attr:
className = new String("CatEntryField4AttributeInfo");
break;
case CATENTRY_FIELD5_Attr:
className = new String("CatEntryField5AttributeInfo");
break;
}
return className;
}


protected AttributeInfo getInstanceOfAttrInfoByClassName(String classname)
throws Exception
{
if( classname.equalsIgnoreCase("CatEntryField4AttributeInfo") || classname.equalsIgnoreCase("CatEntryField5AttributeInfo") ){

StringBuffer s = new StringBuffer("com.ibm.commerce.cummins.search.beans.");
s.append(classname);
Class c = Class.forName(s.toString());
Method m = c.getMethod("getSingleton", null);
AttributeInfo a = (AttributeInfo)m.invoke(null, null);
return a;
}else{
return super. getInstanceOfAttrInfoByClassName(classna
me);
}
}
}


then create two more classes to define the field4 and 5 (iŽll show you one of them):

public class CatEntryField4AttributeInfo extends AttributeInfo {
private static final String COPYRIGHT =
com.ibm.commerce.copyright.IBMCopyright.SHORT_COPYRIGHT;
// singleton idiom in Java
private static CatEntryField4AttributeInfo info = new
CatEntryField4AttributeInfo(CatEntryTabl
eInfo.getSingleton());
/**
* The constructor set?s the column name, column?s table name, and datatype.
*/
public CatEntryField4AttributeInfo(TableInfo info) {
super(info);
columnName = "FIELD4";
sqltype = SQLTYPE_CHAR;
}
/**
* The method returns the sigleton idiom.
* @return com.ibm.commerce.search.catalog.CatEntryField4AttributeInfo
*/
public static CatEntryField4AttributeInfo getSingleton()
{
return info;
}
}

after creating this 3 classes, in your extended advance search class (for example ExtendedAdvanceSearch), now you can use the recently created rulequery extended class instead of the original and you will be able to use the new 2 fields to search by.

Good Luck!



Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com