Well I found that in the xpath query, it doesn't matter if I add the period
or not. I do get an excerpt to return, but it is an empty excerpt. Also,
when I call row.getValue("rep:excerpt()").getString(), I get an exception:
javax.jcr.ItemNotFoundException: rep:excerpt(.). So I can use the period in
the query (period doesn't make a difference) but I can't use it to get the
row value. It looks like it queries correctly by returning the cwe:file
nodes that have 'apple' in it, but it doesn't return the excerpt it finds.
Any ideas why that might be. I'm using jackrabbit 1.3.1 and I have
re-indexed my repository with the text extractors installed properly.
Marcel Reutegger wrote:
>
> bilobag wrote:
>> Hi, I am having an issue getting my query to return the excerpt from a
>> binary
>> file. The following is the query i'm using:
>>
>> query:
>> "//*[(@jcr:primaryType = 'cwe:file') and jcr:contains(jcr:content,
>> 'apple')]/rep:excerpt() order by @jcr:score desc"
>
> if you change rep:excerpt() to rep:excerpt(.) it should work.
>
> regards
> marcel
>
>> java:
>> RowIterator rowIter = qresult.getRows();
>> String[] columns = qresult.getColumnNames();
>>
>> while(rowIter.hasNext()) {
>> Row row = rowIter.nextRow();
>> log.debug("**********text excerpt=" +
>> row.getValue("rep:excerpt(.)").getString());
>> }
>>
>>
>> output:
>>
>> javax.jcr.ItemNotFoundException: rep:excerpt(.)
>> at
>> org.apache.jackrabbit.core.query.lucene.RowIteratorImpl$RowImpl.getValue(RowIteratorImpl.java:291)
>> at
> [...]
>
>
--
View this message in context:
http://www.nabble.com/How-Can-I-catch-the-%22excerpt%22-value-from-highlighting--tf3709100.html#a12146100
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.