6 Replies Latest reply on Nov 21, 2012 9:45 AM by rhauch

    ModeShape 3 full-text search

    tamer_sk

      Hi,

      I am currently evaluating modeshape 3 and trying to test the full-text search. I am trying to search for a text in a msoffice word doc that I added to the repository. I am have modeshape setup as part of AS7 using the AS7 kit. I have the text extractor set configured as in the following:

       

          <subsystem xmlns="urn:jboss:domain:modeshape:1.0">
              <repository name="sample" cache-name="sample" cache-container="modeshape">
                  <sequencers>
                      <sequencer name="msoffice-sequencer" classname="msoffice" module="org.modeshape.sequencer.msoffice" path-expression="default://(*.(xls|doc|ppt))/jcr:content[@jcr:data] => /derived/msoffice/$1"/>
                  </sequencers>
                  <text-extractors>
                      <text-extractor name="tika-extractor" classname="org.modeshape.extractor.tika.TikaTextExtractor"/>
                  </text-extractors>
              </repository>
          </subsystem>

       

      I have the following code to search for documents containing (ModeShape)

       

          QueryManager queryManager = modeWS.getQueryManager();
          String sqlStatement = "SELECT [jcr:path] FROM [nt:resource] WHERE contains([nt:resource].[jcr:data],'ModeShape')";
          Query query = queryManager.createQuery(sqlStatement, Query.JCR_SQL2);
          // execute query and fetch result
          QueryResult qResult = query.execute();

       

          NodeIterator it = qResult.getNodes();

       

          if (it.hasNext()) {
              Node findedNode = it.nextNode();
              result = result + " " + findedNode.getName() + " ";
          }

       

      This keeps returning empty. Is there anything I am not doing right?

       

      Thanks