[Registry-dev] Combining content search with custom queries

Chathura C. Ekanayake chathura at wso2.com
Mon Jul 21 22:10:56 PDT 2008


We can use the following method to introduce content search for custom 
queries.

When executing a custom query, user has to provide the parameters for 
SQL query as a Map, where keys are the parameter numbers and values are 
the values of parameters. We can introduce a special parameter key named 
"content" and let the users pass content search keywords using the 
"content" key. Then we use AND to combine content search results with 
SQL search results. If we want to allow both AND and OR combinations, we 
can introduce two parameters named "and.content" and "or.content", 
instead of parameter key "content".

So, if we want to execute the query SELECT PATH FROM RESOURCE WHERE 
AUTHOR=? and combine the results with content search for content 
containing "high performance", we can use the below code.

Map params = new HashMap();
params.put("1", "chathura");
params.put("content", "high performance");

Collection results = 
registry.executeQuery("/system/queries/authorQuery", params);

Thus, we can combine the content search with custom queries without 
introducing API changes.

Thoughts...

Thanks,
Chathura



More information about the Registry-dev mailing list