You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Jerry Toddsen <jt...@gmail.com> on 2010/04/16 17:54:00 UTC
Searching binary data
Hi all,
I am having a problem with full text searching and binary fields. I am
uploading some files to a Jackrabbit repository, and setting the jcr:data
property of a resource node with a Binary object containing the file
contents. I am able to retrieve the documents manually and verify that they
are there, but when I try running a query and searching for text that I know
is in the documents, my query returns empty.
I have set the SearchIndex tag in the repository.xml file:
<SearchIndex
class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
<param name="path" value="${wsp.home}/index" />
<param name="textFilterClasses"
value="org.apache.jackrabbit.extractor.MsWordTextExtractor,
org.apache.jackrabbit.extractor.MsExcelTextExtractor,
org.apache.jackrabbit.extractor.PdfTextExtractor,
org.apache.jackrabbit.extractor.OpenOfficeTextExtractor,
org.apache.jackrabbit.extractor.RTFTextExtractor,
org.apache.jackrabbit.extractor.HTMLTextExtractor,
org.apache.jackrabbit.extractor.XMLTextExtractor" />
<param name="extractorTimeout" value="100"/>
<param name="extractorPoolSize " value="2"/>
<param name="supportHighlighting" value="true"/>
</SearchIndex>
I have tried storing documents of type MsWord (.doc), MsExcel (.xls), and
even plain html files just to test. All of them contain the phrase "the
quick brown fox jumped over the lazy dog". I am detecting the mime type with
Tika and storing that as a jcr:mimeType property when storing the file.
My query looks like:
final Query q = qm.createQuery("SELECT * from nt:resource WHERE contains (*,
'*quick brown*')", Query.SQL);
This is all using JCR 2.0. I have had success searching on non-binary
properties such as encoding and mimeType, but can never get a successful
query when trying to check the binary data. Any help would be appreciated,
thanks.
Re: Searching binary data
Posted by Alexander Klimetschek <ak...@day.com>.
On Fri, Apr 16, 2010 at 17:54, Jerry Toddsen <jt...@gmail.com> wrote:
> I have set the SearchIndex tag in the repository.xml file:
Note: you also have to change the workspace.xml for existing
workspaces if you change the config. However, the default config in
jackrabbit 2.0 should find your documents.
> My query looks like:
>
> final Query q = qm.createQuery("SELECT * from nt:resource WHERE contains (*,
> '*quick brown*')", Query.SQL);
Try this one:
SELECT * from nt:resource WHERE CONTAINS(., 'quick brown')
You need to search for "." which denotes the current node scope. I
think full text extracted from the jcr:data binary property below a
nt:file (fulltext is only extracted for that, not for all binary
properties) is only aggregated on ".", not on the property itself.
Also, you don't need the wildcards in the query term in CONTAINS (unlike LIKE).
Regards,
Alex
--
Alexander Klimetschek
alexander.klimetschek@day.com