[Registry-dev] Combining content search with custom queries

Chathura C. Ekanayake chathura at wso2.com
Wed Jul 23 02:43:53 PDT 2008


Hi Azeez,

It is very difficult to combine content search with other search 
parameters to that extend. For example, we have to prepare multiple SQL 
statements and execute many queries to get the results of following query.

SELECT R.PATH FROM RESOURCE R, COMMENT C WHERE (R.AUTHOR=? AND 
$CONTENT=?) OR (C.COMMENT_TEXT=? AND C.RID=R.RID)

If we implement the way I suggested, we are restricting the allowed 
combinations in the API level. But if we let users to combine content 
search in the SQL statement itself, users may feel that they can provide 
any combination, which is hard and inefficient to implement.

First, we have to decide whether we want to support complex combinations 
like above. If yes, we have to follow the way you have proposed. If no, 
I think the earlier method is better as it restricts users from giving 
complex combinations.

I prefer only to support only the simple combinations. i.e combining the 
content search results with custom query search results with AND or OR.

Thanks,
Chathura

Afkham Azeez wrote:
> 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
>>
>>     
>
>
> _______________________________________________
> 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