You are viewing a plain text version of this content. The canonical link for it is here.
Posted to slide-user@jakarta.apache.org by Stefan Burkard <ne...@burknet.ch> on 2004/08/27 10:05:35 UTC

property-search in database-store?

hi slide-users

i'm fighting around with the dasl-search in a slide-repository. so first 
of all i would be glad to find a code-example how to create the 
http-request with jakarta http-client to do a dasl-search :-)

additionally i was looking around for alternatives. since i'm putting 
all except content in a jdbc-store, i found all property-values in the 
database...

would it be a bad idea to search directly in the database for the 
documents that match on specific property-values?

i get to this because an additional problem is, that the website who 
provides the search-form is built with macromedia coldfusion. so i would 
need to build the request and "transform" the response of a dasl-search 
with this scripting-language.
in contrast the database-connection and sql-based search is very easy.

greetings
stefan burkard


---------------------------------------------------------------------
To unsubscribe, e-mail: slide-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-user-help@jakarta.apache.org


Re: property-search in database-store?

Posted by James Mason <ma...@apache.org>.
Some properties can get very long. 8000 may be enough, but I think it 
depends on how you're using Slide. Version numbers, for instance, just 
keep on getting larger if you have versioning enabled.

You can always modify the schema and try it. 8000 characters seems like 
it should be enough for most scenarios.

-James

Stefan Burkard wrote:
> thanks for the answer james!
> 
> i need to check the security-issues myself in any case - in my actual 
> case it's an "access-all-or-nothing-approach".
> 
> searching in the database works fine - except that the 
> property-value-field is of the type "text" in ms-sqlserver. therefore it 
> is not possible to compare or sort the fields in a query :-(
> 
> are 8000 characters (the capacity of a normal varchar-field in ms-sql) 
> not enough for a webdav-property? :-)
> 
> greetings
> stefan
> 
> 
> James Mason wrote:
> 
>> Searching the database should be no problem. Keep in mind though that 
>> you'll need to do security checks on the returned resources yourself. 
>> If you search through Slide it won't return resources the user doing 
>> the search doesn't have access to. Depending on your needs this may 
>> not be an issue.
>>
>> Here's an example of some code to do a search through Slide:
>>
>> ---------------------------------------
>> String path = "/slide/files";
>> String query =
>>     "<D:searchrequest xmlns:D =\"DAV:\" >" +
>>         "<D:basicsearch>" +
>>             "<D:select>" +
>>                 "<D:prop>" +
>>                     "<D:getcontentlength/>" +
>>                 "</D:prop>" +
>>             "</D:select>" +
>>             "<D:from>" +
>>                 "<D:scope>" +
>>                     "<D:href>articles</D:href>" +
>>                     "<D:depth>infinity</D:depth>" +
>>                 "</D:scope>" +
>>             "</D:from>" +
>>             "<D:where>" +
>>                 "<D:contains>TERMS</D:contains>" +
>>             "</D:where>" +
>>         "</D:basicsearch>" +
>>     "</D:searchrequest>";
>> SearchMethod method = new SearchMethod( path, query );
>> HttpURL httpURL = new HttpURL( "http://localhost:8080/slide/" );
>> HttpClient client = new HttpClient();
>> client.setState(new WebdavState());
>> HostConfiguration hostConfig = client.getHostConfiguration();
>> hostConfig.setHost(httpURL);
>>
>> Credentials hostCredentials =
>>     new UsernamePasswordCredentials("john","john");
>>
>> if (hostCredentials != null) {
>>     HttpState clientState = client.getState();
>>     clientState.setCredentials(null, httpURL.getHost(),
>>                                 hostCredentials);
>>     clientState.setAuthenticationPreemptive(true);
>> }
>> int state = client.executeMethod(method);
>> System.out.println( "State: " + state );
>> Header[] headers = method.getResponseHeaders();
>> for ( int i = 0; i < headers.length; i++ ) {
>>     System.out.println( headers[i].toString() );
>> }
>> Enumeration enum = method.getAllResponseURLs();
>> while ( enum.hasMoreElements() ) {
>>     System.out.println( enum.nextElement() );
>> }
>> --------------------------------
>>
>> -James
>>
>> Stefan Burkard wrote:
>>
>>> hi slide-users
>>>
>>> i'm fighting around with the dasl-search in a slide-repository. so 
>>> first of all i would be glad to find a code-example how to create the 
>>> http-request with jakarta http-client to do a dasl-search :-)
>>>
>>> additionally i was looking around for alternatives. since i'm putting 
>>> all except content in a jdbc-store, i found all property-values in 
>>> the database...
>>>
>>> would it be a bad idea to search directly in the database for the 
>>> documents that match on specific property-values?
>>>
>>> i get to this because an additional problem is, that the website who 
>>> provides the search-form is built with macromedia coldfusion. so i 
>>> would need to build the request and "transform" the response of a 
>>> dasl-search with this scripting-language.
>>> in contrast the database-connection and sql-based search is very easy.
>>>
>>> greetings
>>> stefan burkard
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: slide-user-unsubscribe@jakarta.apache.org
>>> For additional commands, e-mail: slide-user-help@jakarta.apache.org
>>>
>>>
>>>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: slide-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: slide-user-help@jakarta.apache.org
> 
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: slide-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-user-help@jakarta.apache.org


Re: property-search in database-store?

Posted by Stefan Burkard <ne...@burknet.ch>.
thanks for the answer james!

i need to check the security-issues myself in any case - in my actual 
case it's an "access-all-or-nothing-approach".

searching in the database works fine - except that the 
property-value-field is of the type "text" in ms-sqlserver. therefore it 
is not possible to compare or sort the fields in a query :-(

are 8000 characters (the capacity of a normal varchar-field in ms-sql) 
not enough for a webdav-property? :-)

greetings
stefan


James Mason wrote:

> Searching the database should be no problem. Keep in mind though that 
> you'll need to do security checks on the returned resources yourself. If 
> you search through Slide it won't return resources the user doing the 
> search doesn't have access to. Depending on your needs this may not be 
> an issue.
> 
> Here's an example of some code to do a search through Slide:
> 
> ---------------------------------------
> String path = "/slide/files";
> String query =
>     "<D:searchrequest xmlns:D =\"DAV:\" >" +
>         "<D:basicsearch>" +
>             "<D:select>" +
>                 "<D:prop>" +
>                     "<D:getcontentlength/>" +
>                 "</D:prop>" +
>             "</D:select>" +
>             "<D:from>" +
>                 "<D:scope>" +
>                     "<D:href>articles</D:href>" +
>                     "<D:depth>infinity</D:depth>" +
>                 "</D:scope>" +
>             "</D:from>" +
>             "<D:where>" +
>                 "<D:contains>TERMS</D:contains>" +
>             "</D:where>" +
>         "</D:basicsearch>" +
>     "</D:searchrequest>";
> SearchMethod method = new SearchMethod( path, query );
> HttpURL httpURL = new HttpURL( "http://localhost:8080/slide/" );
> HttpClient client = new HttpClient();
> client.setState(new WebdavState());
> HostConfiguration hostConfig = client.getHostConfiguration();
> hostConfig.setHost(httpURL);
> 
> Credentials hostCredentials =
>     new UsernamePasswordCredentials("john","john");
> 
> if (hostCredentials != null) {
>     HttpState clientState = client.getState();
>     clientState.setCredentials(null, httpURL.getHost(),
>                                 hostCredentials);
>     clientState.setAuthenticationPreemptive(true);
> }
> int state = client.executeMethod(method);
> System.out.println( "State: " + state );
> Header[] headers = method.getResponseHeaders();
> for ( int i = 0; i < headers.length; i++ ) {
>     System.out.println( headers[i].toString() );
> }
> Enumeration enum = method.getAllResponseURLs();
> while ( enum.hasMoreElements() ) {
>     System.out.println( enum.nextElement() );
> }
> --------------------------------
> 
> -James
> 
> Stefan Burkard wrote:
> 
>> hi slide-users
>>
>> i'm fighting around with the dasl-search in a slide-repository. so 
>> first of all i would be glad to find a code-example how to create the 
>> http-request with jakarta http-client to do a dasl-search :-)
>>
>> additionally i was looking around for alternatives. since i'm putting 
>> all except content in a jdbc-store, i found all property-values in the 
>> database...
>>
>> would it be a bad idea to search directly in the database for the 
>> documents that match on specific property-values?
>>
>> i get to this because an additional problem is, that the website who 
>> provides the search-form is built with macromedia coldfusion. so i 
>> would need to build the request and "transform" the response of a 
>> dasl-search with this scripting-language.
>> in contrast the database-connection and sql-based search is very easy.
>>
>> greetings
>> stefan burkard
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: slide-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: slide-user-help@jakarta.apache.org
>>
>>
>>


---------------------------------------------------------------------
To unsubscribe, e-mail: slide-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-user-help@jakarta.apache.org


Re: property-search in database-store?

Posted by James Mason <ma...@apache.org>.
Searching the database should be no problem. Keep in mind though that 
you'll need to do security checks on the returned resources yourself. If 
you search through Slide it won't return resources the user doing the 
search doesn't have access to. Depending on your needs this may not be 
an issue.

Here's an example of some code to do a search through Slide:

---------------------------------------
String path = "/slide/files";
String query =
	"<D:searchrequest xmlns:D =\"DAV:\" >" +
		"<D:basicsearch>" +
			"<D:select>" +
				"<D:prop>" +
					"<D:getcontentlength/>" +
				"</D:prop>" +
			"</D:select>" +
			"<D:from>" +
				"<D:scope>" +
					"<D:href>articles</D:href>" +
					"<D:depth>infinity</D:depth>" +
				"</D:scope>" +
			"</D:from>" +
			"<D:where>" +
				"<D:contains>TERMS</D:contains>" +
			"</D:where>" +
		"</D:basicsearch>" +
	"</D:searchrequest>";
SearchMethod method = new SearchMethod( path, query );
HttpURL httpURL = new HttpURL( "http://localhost:8080/slide/" );
HttpClient client = new HttpClient();
client.setState(new WebdavState());
HostConfiguration hostConfig = client.getHostConfiguration();
hostConfig.setHost(httpURL);

Credentials hostCredentials =
	new UsernamePasswordCredentials("john","john");

if (hostCredentials != null) {
	HttpState clientState = client.getState();
	clientState.setCredentials(null, httpURL.getHost(),
								hostCredentials);
	clientState.setAuthenticationPreemptive(true);
}
int state = client.executeMethod(method);
System.out.println( "State: " + state );
Header[] headers = method.getResponseHeaders();
for ( int i = 0; i < headers.length; i++ ) {
	System.out.println( headers[i].toString() );
}
Enumeration enum = method.getAllResponseURLs();
while ( enum.hasMoreElements() ) {
	System.out.println( enum.nextElement() );
}
--------------------------------

-James

Stefan Burkard wrote:
> hi slide-users
> 
> i'm fighting around with the dasl-search in a slide-repository. so first 
> of all i would be glad to find a code-example how to create the 
> http-request with jakarta http-client to do a dasl-search :-)
> 
> additionally i was looking around for alternatives. since i'm putting 
> all except content in a jdbc-store, i found all property-values in the 
> database...
> 
> would it be a bad idea to search directly in the database for the 
> documents that match on specific property-values?
> 
> i get to this because an additional problem is, that the website who 
> provides the search-form is built with macromedia coldfusion. so i would 
> need to build the request and "transform" the response of a dasl-search 
> with this scripting-language.
> in contrast the database-connection and sql-based search is very easy.
> 
> greetings
> stefan burkard
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: slide-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: slide-user-help@jakarta.apache.org
> 
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: slide-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-user-help@jakarta.apache.org