Page 1 of 1

Search in document content with findByStatement

PostPosted:Wed Jun 02, 2010 10:28 am
by Linsche
Hello

I wonder how I have to use XPath to search within the content of documents. It workes pretty well with keywords and name but with content it always failes
Code: Select all
$result = $searchRequest->findByStatement($token, '/jcr:root/okm:root/DAI/Marken//element(*,okm:document)[jcr:contains(@okm:content,\'Ajax\')]order by @jcrcore descending', 'xpath'); //doesn't work

$result = $searchRequest->findByStatement($token, '/jcr:root/okm:root/DAI/Marken//element(*,okm:document)[jcr:contains(@okm:name,\'Ajax\')]order by @jcrcore descending', 'xpath'); //works

$result = $searchRequest->findByStatement($token, '/jcr:root/okm:root/DAI/Marken//element(*,okm:document)[jcr:contains(@okm:keywords,\'Ajax\')]order by @jcrcore descending', 'xpath'); //works

$result = $searchRequest->findByStatement($token, '/jcr:root/okm:root/DAI/Marken//element(*,okm:document)[jcr:contains(@okm:name,\'Ajax\') or jcr:contains(@okm:keywords,\'something\') ]order by @jcrcore descending', 'xpath'); //works
Thank you

Re: Search in document content with findByStatement

PostPosted:Thu Jul 08, 2010 7:56 pm
by pavila
Try
Code: Select all
/jcr:root/okm:root/DAI/Marken//element(*,okm:document)[jcr:contains(okm:content,'Ajax')] order by @jcr:score descending

Re: Search in document content with findByStatement

PostPosted:Mon Jan 31, 2011 8:59 am
by Linsche
Hello,

thank you for the code but it is not working with the content. Keywords and name is not a problem but content doesn't work. I tried to put everything into one find - statement. This is also not working at all.
I have to fill the params. I think name, content, keywords and path are clear but i also have to fill domain, id, properties, dashboard. What ware they for ? This is what I filled :
Code: Select all
<?php
//some code

$params['dashboard'] = false;
$params['domain'] ='0;
$params['id'] = '';
$params['properties'] = array();
$params['name'] = 'myfilename';
$params['content'] = 'mycontent';
$params['keywords'] = 'mykeyword';
$params['operator'] = 'or';
$params['path'] = '/okm:root/path/to/folder;

$result = $searchRequest->find($token, $params);

//a lot of other code
?>
One time I tried some random id's and domains. There wars a result but only two files and a lot of empty folders. Do I have to specify that I only want so get documents as result?

Thank you!

Re: Search in document content with findByStatement

PostPosted:Tue Feb 01, 2011 9:38 am
by pavila

Re: Search in document content with findByStatement

PostPosted:Tue Feb 01, 2011 1:39 pm
by Linsche
This works pretty good now.

Thank You!