cancel
Showing results for 
Search instead for 
Did you mean: 

Document Search Result Mismatch

swemon
Champ on-the-rise
Champ on-the-rise
Dear all,

I want to use search service to retrieve documents in repository like alfresco search page.
like this
SearchParameters sp = new SearchParameters();
            sp.addStore(new StoreRef(REPOSITORY_STOREREF)); //"workspace://SpacesStore"
            sp.setLanguage(SearchService.LANGUAGE_LUCENE);
            String query = documentNameParam + " AND TYPE:\"content\""; // filename AND TYPE:"content"
            sp.setQuery(query);
            ResultSet resultSet = null;
            try
            {
               System.out.println("NodeRef meeting for search critria…: " + sp.getQuery());
               resultSet = searchService.query(sp);
                for(ResultSetRow row : resultSet)
                {
                   System.out.println("NodeRef: " + row.getNodeRef());
                   documentNodeRefs.add(row.getNodeRef());
                }
            }
            finally
            {
                if(resultSet != null)
                {
                   resultSet.close();
                }
            }

When I use same query, this code will not show any correct result but not always while searching with alfresco search page shows correct results.

Any ideas? Is there any restriction for document in search service???
2 REPLIES 2

mitpatoliya
Star Collaborator
Star Collaborator
have you checked with different users?
because this code will automatically check the permission of users.

andy
Champ on-the-rise
Champ on-the-rise
Hi

Please post the actual query you run - and run this query against the node browser.
The code does not show the actual query you run or who it is run as.
The node browser is running with admin rights.

Andy