You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by rainer <Ra...@gmx.de> on 2007/04/17 19:59:18 UTC

EQUALS instead of CONTAINS ?

Hi,

is there sth. like EQUALS in JCR... ?

i tried to use LIKE but it needs an attribute (name) -> WHERE name LIKE
'foo'
i need this with a wildcard for all attibutes...

The problem i have to solve is the following:
i have to find handles that not only CONTAINS(*,'foo')  --> cause this also
finds 'foooooooo'
i only want to get those pages, that exactly match 'foo' in any property...

i searched a lot but couldn't find anything... Maybe i have to combine
CONTAINS and LIKE somehow?
or is this really not possible? if u need any further information, just ask
me :)

thank u very much...
-- 
View this message in context: http://www.nabble.com/EQUALS-instead-of-CONTAINS---tf3595051.html#a10042854
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.


Re: EQUALS instead of CONTAINS ?

Posted by Marcel Reutegger <ma...@gmx.net>.
rainer wrote:
> if i search for CONTAINS(*, 'foo') i also get the 'fooooooo' hits, cause
> 'foooooo' contains 'foo' (am i wrong?)

contains simply runs the query words through an analyzer and compares them with 
the tokens in the index. fooooo and foo are therefore not the same and will not 
yield a match.

> and u say this is incorrect behaviour?? 

or your observation is incorrect ;) maybe there are other properties on that 
node that contain the term foo.

> is "%" or "*" the correct wildcard here?

if you are refering to the first argument of the contains function in a SQL 
query then * is the correct 'wildcard'. it indicates that the function should 
take all properties into account.

the second argument of the contains function may also contain wildcards (but 
this is jackrabbit proprietary and not specified in jsr 170).
CONTAINS(*, 'foo*') matches all properties that contain terms that start with 'foo'.

> BTW is a "/" kind of special character in JCR queries? i get some strange
> behaviour sometimes...

yes, it separates elements of a path

regards
  marcel

Re: EQUALS instead of CONTAINS ?

Posted by rainer <Ra...@gmx.de>.
1. thx


Marcel Reutegger wrote:
> 
> 
> with the default analyzer configured this shouldn't actually be the case
> ('foo' 
> and 'fooooo' are distinct tokens), unless you have:
> 
> ...WHERE CONTAINS(*, 'foo*')
> 

if i search for CONTAINS(*, 'foo') i also get the 'fooooooo' hits, cause
'foooooo' contains 'foo' (am i wrong?)
and u say this is incorrect behaviour?? 

is "%" or "*" the correct wildcard here?



Marcel Reutegger wrote:
> 
>> i only want to get those pages, that exactly match 'foo' in any
>> property...
> 
> that's not possible with a JCR query. you have to name the properties
> individually:
> 
> where propA = 'foo' or propB = 'foo' or propC = 'foo' ...
> 
> regards
>   marcel
> 

OK.. so i need to get the property names before i can query for an exact
match... an "all_Properties" Wildcard does not exist! it s a pitty, but it's
much better then "try and error" when u cant win :)

BTW is a "/" kind of special character in JCR queries? i get some strange
behaviour sometimes...
-- 
View this message in context: http://www.nabble.com/EQUALS-instead-of-CONTAINS---tf3595051.html#a10058798
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.


Re: EQUALS instead of CONTAINS ?

Posted by Marcel Reutegger <ma...@gmx.net>.
rainer wrote:
> is there sth. like EQUALS in JCR... ?

yes there is. e.g.

select * from nt:resource where jcr:mimeType = 'text/html'

or

//element(*, nt:resource)[@jcr:mimeType = 'text/html']

> i tried to use LIKE but it needs an attribute (name) -> WHERE name LIKE
> 'foo'
> i need this with a wildcard for all attibutes...
 >
> The problem i have to solve is the following:
> i have to find handles that not only CONTAINS(*,'foo')  --> cause this also
> finds 'foooooooo'

with the default analyzer configured this shouldn't actually be the case ('foo' 
and 'fooooo' are distinct tokens), unless you have:

...WHERE CONTAINS(*, 'foo*')

> i only want to get those pages, that exactly match 'foo' in any property...

that's not possible with a JCR query. you have to name the properties individually:

where propA = 'foo' or propB = 'foo' or propC = 'foo' ...

regards
  marcel