jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marcel Reutegger <marcel.reuteg...@gmx.net>
Subject Re: Support for lucene query syntax in jcr:contains()
Date Fri, 18 Apr 2008 11:48:39 GMT
Hi,

in general jackrabbit follows the specification, which says that NOT is not a 
keyword and does not have special meaning in a jcr:contains clause.

that is, your query should actually return nodes that contain all three words: 
'blood', 'not' and 'smell'.

certain lucene operators still work, even though they are not specified in JSR 
170. e.g. you can boost terms using ^

regards
  marcel

mabogunje wrote:
> Is there full support for the lucene query syntax ... my scenario is as
> follows :
> 
> I have the following code snippet :
> 
>   .....
>   QueryManager queryManager = session.getWorkspace().getQueryManager();
>   Query query = queryManager.createQuery(queryString, Query.XPATH);
>   QueryResult result = query.execute();
> 
> When queryString is as follows :
> 
> //*[@jcr:primaryType = 'prm:File' and (jcr:contains(jcr:content, 'blood
> !smell') or jcr:contains(@prm:Title, 'blood !smell'))] order by jcr:score()
> descending
> 
> The result is as expected (it returns all documents that contain blood but
> not smell in either the title or contents.
> 
> However changing the "!" to "NOT" changes the results. so when the query is
> :
> 
> //*[@jcr:primaryType = 'prm:File' and (jcr:contains(jcr:content, 'blood NOT
> smell') or jcr:contains(@prm:Title, 'blood NOT smell'))] order by
> jcr:score() descending
> 
> I do not get the same results.
> 
> Even though ! or NOT are valid in regular lucene, that does not seem to be
> the case when used in a jcr:contains function ... is that true ? if so is
> there another where to run a pure lucene query ?


Mime
View raw message