excerpt via DavEx does not work
-------------------------------

                 Key: JCR-2668
                 URL: https://issues.apache.org/jira/browse/JCR-2668
             Project: Jackrabbit Content Repository
          Issue Type: Bug
          Components: jackrabbit-jcr2spi
    Affects Versions: 2.1.0
         Environment: JCR via DavEx
            Reporter: Thomas Malcom
             Fix For: 2.1.1


When  using Jackrabbit JCR via DavEx (not RMI) and doing an fulltext-search 
xpath query including excerpt of the found text parts.

I am using the following code to test  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 
-------------------------------------- 

I guess that excerpt is a major feature when getting WebDav in a full featured 
state

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to