On Tue, Jun 29, 2010 at 15:32, Thomas Lustig <[email protected]> wrote: > dear all, > > I am using Jackrabbit JCR via DavEx (not RMI) and would like to do an > fulltext-search xpath query including excerpt of the found text parts. > I am using the following code to do a fulltext search query for term > "jackrabbit": > > ----------------------------------------- test function start > ------------------------------------ > public void doFulltextSearchTest() { > try { > System.out.println("found:"); > RowIterator rows = queryFulltextSearch("kanzlei"); > for (RowIterator it = rows; it.hasNext();) { > Row r = it.nextRow(); > Value title = r.getValue("Title"); > Value excerpt = r.getValue("rep:excerpt(.)"); > System.out.println("Element title:" + title + " excerpt" > + excerpt); > } > } catch (ItemNotFoundException e) { > e.printStackTrace(); > } catch (RepositoryException e) { > e.printStackTrace(); > } > > } > > > public RowIterator queryFulltextSearch(String searchstring) throws > RepositoryException{ > QueryManager qm = currentSession.getWorkspace().getQueryManager(); > Query q = qm.createQuery("//*[jcr:contains(., > '"+searchstring+"')]/(@Title|rep:excerpt(.))", Query.XPATH); > QueryResult result = q.execute(); > return result.getRows(); > } > ----------------------------------------- test function > end------------------------------------ > > ---------------------------- causes Exception start > -------------------------------------- > javax.jcr.ItemNotFoundException: rep:excerpt(.) > at > org.apache.jackrabbit.jcr2spi.query.RowIteratorImpl$RowImpl.getValue(RowIteratorImpl.java:271) > at > consearch.demos.jcr.FulltextSearchTest.<init>(FulltextSearchTest.java:44) > at > consearch.demos.jcr.FulltextSearchTest.main(FulltextSearchTest.java:61) > ---------------------------- causes Exception end > -------------------------------------- > > Is it possible to arrange this via DavEX and how? > thanking you in advance for helping me
Looks like rep:excerpt(.) and other non-jcr-property values in Row.getValue() are not supported by jcr2spi. Could you file an enhancement/bug? http://jackrabbit.apache.org/issue-tracker.html Regards, Alex -- Alexander Klimetschek [email protected]
