AnsweredAssumed Answered

Problem with searching

Question asked by ajaiking on Jul 23, 2009
Latest reply on Jul 25, 2009 by ajaiking
Hi,

I have created a repository with 15 different docs. I try to search the repository using the following snippet.
The repository has a folder with 15 documents. (Very small)

         namespacePrefixResolver.registerNamespace("jcr",
               "http://www.jcp.org/jcr/1.0");
         namespacePrefixResolver.registerNamespace("nt",
               "http://www.jcp.org/jcr/nt/1.0");
         List<NodeRef> resultList = searchService.selectNodes(matterNodeRef,
               "//jcr:content/@jcr:data[contains('" + searchString + "')]",
               null, namespacePrefixResolver, false);
         Iterator resultListIterator = resultList.iterator();
         System.out.println("—xpath with service—");
         while (resultListIterator.hasNext()) {
            NodeRef nodeRef = (NodeRef) resultListIterator.next();
            Node node = session.getNodeByUUID(nodeRef.getId());
            System.out.println(node.getName() + "—" + node.getPath());
         }

1. The query fetches all the documents available in the repository, for the query *a*. Is this the expected behavior? The time taken to print the results was close to six seconds.

2. The query takes a lot of time to return results. What are the parameters to control the search time?

3. I doubt if the document contents are indexed. How to ensure that the contents are indexed?

4. For most of the queries with the generic expression //*[contains('*a*')] fetches some JS files, pdfs etc.. which i have not added into the repository, are returned. Please note that 'matterNodeRef' used in the above snippet is pointing to the folder node directly. But the query returned contains many nodes that are outside the nodeRef.

Thanks in Advance.

Outcomes