cancel
Showing results for 
Search instead for 
Did you mean: 

Search using SearchParameter

deepusearching
Champ in-the-making
Champ in-the-making
Hi ,

I am facing one problem while searching the asset from Alfresco. My base code is given bellow: I took this code from http://www.alfresco.org/mediawiki/index.php/Search.

        SearchParameters sp = new SearchParameters();
        sp.addStore(getStoreRef());
        sp.setLanguage(SearchService.LANGUAGE_LUCENE);
        sp.setQuery("TYPE:\"{http://www.alfresco.org/model/content/1.0}content}\"");
        ResultSet results = null;
        try
        {
            results = serviceRegistry.getSearchService().query(sp);
            for(ResultSetRow row : results)
            {
                NodeRef currentNodeRef = row.getNodeRef();
                …
            }
        }
        finally
        {
            if(results != null)
            {
                results.close();
            }
        }

The problem is for adding a store in the search parameters. I can?t find out how to initialize the StoreRef(Reference to a store) object. We can initialize the StoreRef in two ways:
1)   StoreRef(java.lang.String string)
2)   StoreRef(java.lang.String protocol, java.lang.String identifier)
We can findout one table named store in the database. I tried different combinations to initialize the StoreRef. I searched about this in the Alfresco Forum also. But it?s not working. The search language we are going to use is XPath.

Please let me know if you got any solution on this.

With Regards,
Deepu Sebastian.
1 REPLY 1

davidc
Star Contributor
Star Contributor
If you want to search the store that's used by the Alfresco Web Client you can use:

new StoreRef("workspace", "SpacesStore");
Getting started

Tags


Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.