Hi,Thanks for your reply.
QueryManager manager = session.getWorkspace().getQueryManager();String
sql = "SELECT * FROM [nt:file] WHERE CONTAINS(., 'cat')"; Query query =
manager.createQuery(sql, Query.JCR_SQL2); QueryResult result =
query.execute(); NodeIterator itr = result.getNodes();
while (itr.hasNext()){ Node node = itr.nextNode();
System.out.println(node.getName()); }
If I used the highlighted sql query. The parsers throws exception indicating
invalid syntax for the query. CONTAINS(., 'cat')"Do you know why?
However, if I use: String sql = "SELECT * FROM [nt:file] AS file WHERE
CONTAINS(file,'text should be found')";There is no exception, but no result
returned.
The indexing_configuration file looks like
<?xml version="1.0"?><!DOCTYPE configuration SYSTEM
"http://jackrabbit.apache.org/dtd/indexing-configuration-1.0.dtd"><configuration
xmlns:jcr="http://www.jcp.org/jcr/1.0"
xmlns:nt="http://www.jcp.org/jcr/nt/1.0"> <aggregate primaryType="nt:file">
<include primaryType="nt:resource">*</include>
</aggregate></configuration>
Where is ${wsp.home} ? Is it "workspaces/default" folder? Anyway, that's
where I put the indexing_configuration file.
Can someone please help me out? Thanks again.Jason
> Date: Wed, 25 Aug 2010 11:33:11 +0200
> Subject: Re: full text search in jackrabbit
> From: [email protected]
> To: [email protected]
>
> Hello Jason,
>
> On Wed, Aug 25, 2010 at 11:24 AM, jason wang <[email protected]> wrote:
> >
> > Hi,
> >
> >
> >
> > First of all, in order to use full-text search for files stored in
> > JackRabbit, do I need to set up indexing configuation manually? If so, how
> > to set it up?
>
> You can, but out-of-the-box there is a proper working one.
>
> > Currently I just run the following codes: nothing returns (no exceptin
> > either) even though a file contains the text. Is the sql wrong?
> >
> > QueryManager manager = session.getWorkspace().getQueryManager();
> > String sql = "SELECT * FROM [nt:file] AS file WHERE CONTAINS(file,'text
> > should be found')";
>
> Can you try:
>
> CONTAINS(.,'text should be found')";
>
> Regards Ard
>
> > Query query = manager.createQuery(sql, Query.JCR_SQL2);
> > QueryResult result = query.execute();
> > NodeIterator itr = result.getNodes();
> > hile (itr.hasNext()){
> > Node node = itr.nextNode();
> > System.out.println(node.getName());
> >
> > }
> >
> >
> >
> >
> >
> > Thanks a lot for your help.
> >
> > Jason
> >
> >
> >