[Registry-dev] Combining content search with custom queries

Afkham Azeez azeez at wso2.com
Wed Jul 23 01:47:17 PDT 2008


What about making the content search also part of the custom query:

1. SELECT PATH FROM RESOURCE WHERE  AUTHOR=? and $CONTENT=?

2. SELECT PATH FROM RESOURCE WHERE  AUTHOR=? or $CONTENT=?

params.put("1", "Gabe")
params.put("2" , "garbage collection")

that makes it clearer since in the query itself you can see that there 
is an additional condition. The $ in $CONTENT is used to signify a 
special parameter.

In you suggestion, you are hiding a condition in the parameter map.

WDYT?

Azeez

Chathura C. Ekanayake wrote:
> 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
> 
> _______________________________________________
> Registry-dev mailing list
> Registry-dev at wso2.org
> http://wso2.org/cgi-bin/mailman/listinfo/registry-dev
> 




More information about the Registry-dev mailing list