You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Gary Long <ga...@gmx.fr> on 2009/09/14 16:07:48 UTC

fulltext search & sql query

Hi :)

I have a JCR with files converted into binary and i'm trying to perform
fulltext search. I'm using SQL. 
My query is :

"SELECT * FROM mnt:resource WHERE contains(* , '" + textQuery + " OR " +
textQuery + "% OR %" + textQuery + " OR %" + textQuery + "%')"

When i try  for the word lucene (for exemple) i get results. But if i try
with luc or lucen, there are no matches...

I don't understand why?

Could someone help me please ? :)

Thanks

Gary
-- 
View this message in context: http://www.nabble.com/fulltext-search---sql-query-tp25436447p25436447.html
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.


Re: fulltext search & sql query

Posted by Alexander Klimetschek <ak...@day.com>.
On Mon, Sep 14, 2009 at 16:07, Gary Long <ga...@gmx.fr> wrote:
> I have a JCR with files converted into binary and i'm trying to perform
> fulltext search. I'm using SQL.
> My query is :
>
> "SELECT * FROM mnt:resource WHERE contains(* , '" + textQuery + " OR " +
> textQuery + "% OR %" + textQuery + " OR %" + textQuery + "%')"
>
> When i try  for the word lucene (for exemple) i get results. But if i try
> with luc or lucen, there are no matches...

The (JCR-) SQL CONTAINS and the Xpath jcr:contains methods do not
support wildcard characters, as they are working on a tokenized
fulltext index. For using wildcard queries, there is LIKE/jcr:like
which works directly on properties:

SELECT * FROM mnt:resource WHERE (my:property LIKE lucene) OR
(my:property LIKE luc%) OR (my:property LIKE %ene)

Regards,
Alex

-- 
Alexander Klimetschek
alexander.klimetschek@day.com