Page 1 of 1

Question about fulltext search

PostPosted:Tue Jul 29, 2008 1:55 am
by Field888
Hi
I learn that the search statements in OpenKM are organized like this:
//element(*,okm:document)[jcr:contains(.,\'term1\') and jcr:contains(.,\'term2\')]
but how do you search for content that does not include a term? Is it using jcr:contains(.,\'-term1\')? I tests this statment but doesn\'t work.

I appreciate any help

Re:Question about fulltext search

PostPosted:Tue Jul 29, 2008 6:38 am
by pavila
OpenKM uses Lucene for queries. See Lucene Query Syntax to learn more on its capabilities. And your query should be re-written this way:
Code: Select all
//element(*,okm:document)[jcr:contains(okm:content,\'term1\') and jcr:contains(okm:content,\'term2\')]

Re:Question about fulltext search

PostPosted:Tue Jul 29, 2008 7:14 am
by pavila
See this query:
Code: Select all
/jcr:root/okm:root//element(*,okm:document)[jcr:contains(okm:content,\'coche -casa\')] order by @jcr:score descending
This will search for documents which contains \"coche\" and not \"casa\", and will order the results.

Re:Question about fulltext search

PostPosted:Wed Jul 30, 2008 2:35 am
by Field888
Thanks for your help,
I organized the querry like this:
/jcr:root/okm:root//element(*,okm:document)[jcr:contains(okm:content,\'* - casa\')] order by @jcr:score descending

And this works well. :)