AnsweredAssumed Answered

Search using SearchParameter

Question asked by deepusearching on Feb 28, 2006
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.

Outcomes