You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stanbol.apache.org by si...@apache.org on 2012/05/03 13:49:05 UTC

svn commit: r1333409 - in /incubator/stanbol/trunk/contenthub: ./ search/featured/src/main/java/org/apache/stanbol/contenthub/search/featured/ search/solr/src/main/java/org/apache/stanbol/contenthub/search/solr/ search/solr/src/main/java/org/apache/sta...

Author: sinaci
Date: Thu May  3 11:49:05 2012
New Revision: 1333409

URL: http://svn.apache.org/viewvc?rev=1333409&view=rev
Log:
STANBOL-584

Merged the branch for faceted-browsing into Contenthub trunk.

* Easier interface for faceted search/browsing.
* Independent from Solr facet syntax/knowledge.

Added:
    incubator/stanbol/trunk/contenthub/search/featured/src/main/java/org/apache/stanbol/contenthub/search/featured/ConstraintImpl.java
      - copied unchanged from r1333404, incubator/stanbol/branches/faceted-browsing/contenthub/search/featured/src/main/java/org/apache/stanbol/contenthub/search/featured/ConstraintImpl.java
    incubator/stanbol/trunk/contenthub/search/featured/src/main/java/org/apache/stanbol/contenthub/search/featured/DefaultConstrainedDocumentSet.java
      - copied unchanged from r1333404, incubator/stanbol/branches/faceted-browsing/contenthub/search/featured/src/main/java/org/apache/stanbol/contenthub/search/featured/DefaultConstrainedDocumentSet.java
    incubator/stanbol/trunk/contenthub/search/featured/src/main/java/org/apache/stanbol/contenthub/search/featured/FacetImpl.java
      - copied unchanged from r1333404, incubator/stanbol/branches/faceted-browsing/contenthub/search/featured/src/main/java/org/apache/stanbol/contenthub/search/featured/FacetImpl.java
    incubator/stanbol/trunk/contenthub/servicesapi/src/main/java/org/apache/stanbol/contenthub/servicesapi/search/featured/ConstrainedDocumentSet.java
      - copied unchanged from r1333404, incubator/stanbol/branches/faceted-browsing/contenthub/servicesapi/src/main/java/org/apache/stanbol/contenthub/servicesapi/search/featured/ConstrainedDocumentSet.java
    incubator/stanbol/trunk/contenthub/servicesapi/src/main/java/org/apache/stanbol/contenthub/servicesapi/search/featured/Constraint.java
      - copied unchanged from r1333404, incubator/stanbol/branches/faceted-browsing/contenthub/servicesapi/src/main/java/org/apache/stanbol/contenthub/servicesapi/search/featured/Constraint.java
    incubator/stanbol/trunk/contenthub/servicesapi/src/main/java/org/apache/stanbol/contenthub/servicesapi/search/featured/Facet.java
      - copied unchanged from r1333404, incubator/stanbol/branches/faceted-browsing/contenthub/servicesapi/src/main/java/org/apache/stanbol/contenthub/servicesapi/search/featured/Facet.java
Modified:
    incubator/stanbol/trunk/contenthub/   (props changed)
    incubator/stanbol/trunk/contenthub/search/featured/src/main/java/org/apache/stanbol/contenthub/search/featured/FeaturedSearchImpl.java
    incubator/stanbol/trunk/contenthub/search/solr/src/main/java/org/apache/stanbol/contenthub/search/solr/SolrSearchImpl.java
    incubator/stanbol/trunk/contenthub/search/solr/src/main/java/org/apache/stanbol/contenthub/search/solr/util/SolrQueryUtil.java
    incubator/stanbol/trunk/contenthub/servicesapi/src/main/java/org/apache/stanbol/contenthub/servicesapi/search/featured/FeaturedSearch.java
    incubator/stanbol/trunk/contenthub/web/src/main/java/org/apache/stanbol/contenthub/web/resources/FeaturedSearchResource.java

Propchange: incubator/stanbol/trunk/contenthub/
------------------------------------------------------------------------------
--- svn:mergeinfo (added)
+++ svn:mergeinfo Thu May  3 11:49:05 2012
@@ -0,0 +1 @@
+/incubator/stanbol/branches/faceted-browsing/contenthub:1325631-1333404

Modified: incubator/stanbol/trunk/contenthub/search/featured/src/main/java/org/apache/stanbol/contenthub/search/featured/FeaturedSearchImpl.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/contenthub/search/featured/src/main/java/org/apache/stanbol/contenthub/search/featured/FeaturedSearchImpl.java?rev=1333409&r1=1333408&r2=1333409&view=diff
==============================================================================
--- incubator/stanbol/trunk/contenthub/search/featured/src/main/java/org/apache/stanbol/contenthub/search/featured/FeaturedSearchImpl.java (original)
+++ incubator/stanbol/trunk/contenthub/search/featured/src/main/java/org/apache/stanbol/contenthub/search/featured/FeaturedSearchImpl.java Thu May  3 11:49:05 2012
@@ -47,6 +47,8 @@ import org.apache.stanbol.commons.solr.m
 import org.apache.stanbol.contenthub.search.featured.util.SolrContentItemConverter;
 import org.apache.stanbol.contenthub.search.solr.util.SolrQueryUtil;
 import org.apache.stanbol.contenthub.servicesapi.search.SearchException;
+import org.apache.stanbol.contenthub.servicesapi.search.featured.ConstrainedDocumentSet;
+import org.apache.stanbol.contenthub.servicesapi.search.featured.Constraint;
 import org.apache.stanbol.contenthub.servicesapi.search.featured.DocumentResult;
 import org.apache.stanbol.contenthub.servicesapi.search.featured.FacetResult;
 import org.apache.stanbol.contenthub.servicesapi.search.featured.FeaturedSearch;
@@ -55,6 +57,7 @@ import org.apache.stanbol.contenthub.ser
 import org.apache.stanbol.contenthub.servicesapi.search.related.RelatedKeywordSearchManager;
 import org.apache.stanbol.contenthub.servicesapi.search.solr.SolrSearch;
 import org.apache.stanbol.contenthub.servicesapi.store.StoreException;
+import org.apache.stanbol.contenthub.servicesapi.store.vocabulary.SolrVocabulary.SolrFieldName;
 import org.apache.stanbol.contenthub.store.solr.manager.SolrCoreManager;
 import org.apache.stanbol.enhancer.servicesapi.ContentItem;
 import org.apache.stanbol.enhancer.servicesapi.ContentItemFactory;
@@ -112,7 +115,7 @@ public class FeaturedSearchImpl implemen
 
     @Reference
     private ContentItemFactory ciFactory;
-    
+
     private BundleContext bundleContext;
 
     @Activate
@@ -122,7 +125,7 @@ public class FeaturedSearchImpl implemen
 
     @Override
     public SearchResult search(String queryTerm) throws SearchException {
-        return search(queryTerm, null, null);
+        return search(queryTerm, "", "");
     }
 
     private List<FacetResult> convertFacetFields(List<FacetField> facetFields, List<FacetResult> allFacets) {
@@ -181,19 +184,38 @@ public class FeaturedSearchImpl implemen
 
     @Override
     public SearchResult search(SolrParams solrParams, String ontologyURI, String ldProgramName) throws SearchException {
-        /*
-         * RESTful services uses search method with "SolrParams" argument. For those operations
-         */
         SolrQuery solrQuery = new SolrQuery();
         solrQuery.add(solrParams);
         List<FacetResult> allFacets = getAllFacetResults(ldProgramName);
-        SolrQueryUtil.setDefaultQueryParameters(solrQuery, allFacets);
+        SolrQueryUtil.setFacetFields(solrQuery, allFacets);
         QueryResponse queryResponse = solrSearch.search(solrQuery, ldProgramName);
         String queryTerm = SolrQueryUtil.extractQueryTermFromSolrQuery(solrParams);
         return search(queryTerm, queryResponse, ontologyURI, ldProgramName, allFacets);
     }
 
     @Override
+    public ConstrainedDocumentSet search(String keyword, Set<Constraint> constraints) throws SearchException {
+        return performSearch(keyword, constraints, SolrCoreManager.CONTENTHUB_DEFAULT_INDEX_NAME);
+    }
+
+    @Override
+    public ConstrainedDocumentSet search(String keyword, Set<Constraint> constraints, String indexName) throws SearchException {
+        return performSearch(keyword, constraints, indexName);
+    }
+
+    private ConstrainedDocumentSet performSearch(String keyword, Set<Constraint> constraints, String indexName) throws SearchException {
+        SolrQuery query = SolrQueryUtil.prepareSolrQuery(keyword);
+        SolrQueryUtil.addConstraintsToSolrQuery(constraints, query);
+        List<FacetResult> allFacets = getAllFacetResults();
+        SolrQueryUtil.setFacetFields(query, allFacets);
+        query.setRows(Integer.MAX_VALUE);
+        query.setFields(SolrFieldName.ID.toString(), SolrFieldName.ENHANCEMENTCOUNT.toString(),
+            SolrFieldName.TITLE.toString(), SolrFieldName.MIMETYPE.toString());
+        QueryResponse queryResponse = solrSearch.search(query);
+        return new DefaultConstrainedDocumentSet(keyword, queryResponse, constraints, indexName, this);
+    }
+
+    @Override
     public List<FacetResult> getAllFacetResults() throws SearchException {
         return getAllFacetResults(null);
     }
@@ -252,8 +274,8 @@ public class FeaturedSearchImpl implemen
             log.error("Failed to get enmancements for the query term: {}", queryTerm, e);
             error = true;
         } catch (IOException e) {
-            log.error("Failed to create a ContentItem by using "
-                    + ciFactory.getClass().getSimpleName()+"!",e);
+            log.error(
+                "Failed to create a ContentItem by using " + ciFactory.getClass().getSimpleName() + "!", e);
             error = true;
         }
 

Modified: incubator/stanbol/trunk/contenthub/search/solr/src/main/java/org/apache/stanbol/contenthub/search/solr/SolrSearchImpl.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/contenthub/search/solr/src/main/java/org/apache/stanbol/contenthub/search/solr/SolrSearchImpl.java?rev=1333409&r1=1333408&r2=1333409&view=diff
==============================================================================
--- incubator/stanbol/trunk/contenthub/search/solr/src/main/java/org/apache/stanbol/contenthub/search/solr/SolrSearchImpl.java (original)
+++ incubator/stanbol/trunk/contenthub/search/solr/src/main/java/org/apache/stanbol/contenthub/search/solr/SolrSearchImpl.java Thu May  3 11:49:05 2012
@@ -60,7 +60,7 @@ public class SolrSearchImpl implements S
         SolrServer solrServer = null;
         try {
             solrServer = SolrCoreManager.getInstance(bundleContext, managedSolrServer).getServer();
-            solrQuery = SolrQueryUtil.prepareDefaultSolrQuery(solrServer, queryTerm);
+            solrQuery = SolrQueryUtil.prepareSolrQuery(solrServer, queryTerm);
         } catch (StoreException e) {
             throw new SearchException(e.getMessage(), e);
         } catch (SolrServerException e) {
@@ -79,7 +79,7 @@ public class SolrSearchImpl implements S
         SolrServer solrServer = null;
         try {
             solrServer = SolrCoreManager.getInstance(bundleContext, managedSolrServer).getServer(ldProgramName);
-            solrQuery = SolrQueryUtil.prepareDefaultSolrQuery(solrServer, queryTerm);
+            solrQuery = SolrQueryUtil.prepareSolrQuery(solrServer, queryTerm);
         } catch (StoreException e) {
             throw new SearchException(e.getMessage(), e);
         } catch (SolrServerException e) {

Modified: incubator/stanbol/trunk/contenthub/search/solr/src/main/java/org/apache/stanbol/contenthub/search/solr/util/SolrQueryUtil.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/contenthub/search/solr/src/main/java/org/apache/stanbol/contenthub/search/solr/util/SolrQueryUtil.java?rev=1333409&r1=1333408&r2=1333409&view=diff
==============================================================================
--- incubator/stanbol/trunk/contenthub/search/solr/src/main/java/org/apache/stanbol/contenthub/search/solr/util/SolrQueryUtil.java (original)
+++ incubator/stanbol/trunk/contenthub/search/solr/src/main/java/org/apache/stanbol/contenthub/search/solr/util/SolrQueryUtil.java Thu May  3 11:49:05 2012
@@ -22,6 +22,7 @@ import java.util.Arrays;
 import java.util.List;
 import java.util.Map;
 import java.util.Map.Entry;
+import java.util.Set;
 
 import org.apache.solr.client.solrj.SolrQuery;
 import org.apache.solr.client.solrj.SolrServer;
@@ -31,6 +32,8 @@ import org.apache.solr.client.solrj.util
 import org.apache.solr.common.params.CommonParams;
 import org.apache.solr.common.params.SolrParams;
 import org.apache.solr.common.util.NamedList;
+import org.apache.stanbol.contenthub.servicesapi.search.featured.Constraint;
+import org.apache.stanbol.contenthub.servicesapi.search.featured.Facet;
 import org.apache.stanbol.contenthub.servicesapi.search.featured.FacetResult;
 import org.apache.stanbol.contenthub.servicesapi.store.vocabulary.SolrVocabulary;
 import org.apache.stanbol.contenthub.servicesapi.store.vocabulary.SolrVocabulary.SolrFieldName;
@@ -57,39 +60,6 @@ public class SolrQueryUtil {
 
     public final static List<Character> queryDelimiters = Arrays.asList(' ', ',');
 
-    private static String getFacetFieldType(String fieldName, List<FacetResult> allAvailableFacets) {
-    	for(FacetResult fr : allAvailableFacets) {
-    		if(fieldName.equals(fr.getFacetField().getName())) {
-    			return fr.getType();
-    		}
-    	}
-    	return "";
-    }
-    
-    private static SolrQuery keywordQueryWithFacets(String keyword, List<FacetResult> allAvailableFacets, Map<String,List<Object>> constraints) {
-        SolrQuery query = new SolrQuery();
-        query.setQuery(keyword);
-        if (constraints != null) {
-            try {
-                for (Entry<String,List<Object>> entry : constraints.entrySet()) {
-                    String fieldName = ClientUtils.escapeQueryChars(entry.getKey());
-                    String type = getFacetFieldType(fieldName, allAvailableFacets);
-                    for (Object value : entry.getValue()) {
-                        if (SolrVocabulary.isRangeType(type)) {
-                            query.addFilterQuery(fieldName + facetDelimiter + (String) value);
-                        } else {
-                            query.addFilterQuery(fieldName + facetDelimiter + quotation
-                                                 + ClientUtils.escapeQueryChars((String) value) + quotation);
-                        }
-                    }
-                }
-            } catch (Exception e) {
-                log.warn("Facet constraints could not be added to Query", e);
-            }
-        }
-        return query;
-    }
-
     private static String removeFacetConstraints(String query) {
         int delimiteri = query.indexOf(facetDelimiter);
         while (delimiteri > -1) {
@@ -144,7 +114,18 @@ public class SolrQueryUtil {
         return queryFull.trim();
     }
 
-    public static <T> void setDefaultQueryParameters(SolrQuery solrQuery, List<T> allAvailableFacetNames) {
+    /**
+     * This methods adds a facet field the given <code>solrQuery</code> for each facet passed in
+     * <code>allAvailableFacetNames</code>. This provides obtaining information about specified facets such as
+     * possible facet values, number documents of documents matching with certain values of facets, etc in the
+     * search results.
+     * 
+     * @param solrQuery
+     *            {@link SolrQuery} to be extended with facet fields
+     * @param allAvailableFacetNames
+     *            list of facets
+     */
+    public static <T> void setFacetFields(SolrQuery solrQuery, List<T> allAvailableFacetNames) {
         solrQuery.setFields("*", SCORE_FIELD);
         solrQuery.setFacet(true);
         solrQuery.setFacetMinCount(1);
@@ -166,23 +147,88 @@ public class SolrQueryUtil {
         }
     }
 
-    public static SolrQuery prepareDefaultSolrQuery(SolrServer solrServer, String queryTerm) throws SolrServerException,
-                                                                                            IOException {
+    /**
+     * This method create a {@link SolrQuery} using the given parameters. <code>queryTerm</code> is the main
+     * query of the solr query to be created. <code>solrServer</code> is used fetch possible facet fields of
+     * the underlying Solr schema. Obtained facet names are attached to the query to obtain the corresponding
+     * facet information such as possible facet values, number documents of documents matching with certain
+     * values of facets, etc in the search results.
+     * 
+     * @param solrServer
+     *            Solr server to obtain corresponding facet names
+     * @param queryTerm
+     *            main query term to be used in {@link SolrQuery#setQuery(String)}
+     * @return {@link SolrQuery} constructed by using the given parameters
+     * @throws SolrServerException
+     * @throws IOException
+     */
+    public static SolrQuery prepareSolrQuery(SolrServer solrServer, String queryTerm) throws SolrServerException,
+                                                                                     IOException {
         SolrQuery solrQuery = new SolrQuery();
         solrQuery.setQuery(queryTerm);
-        setDefaultQueryParameters(solrQuery, getAllFacetNames(solrServer));
+        setFacetFields(solrQuery, getAllFacetNames(solrServer));
         return solrQuery;
     }
 
-    public static SolrQuery prepareDefaultSolrQuery(String queryTerm) {
+    /**
+     * This method simply wraps the given <code>queryTerm</code> in a {@link SolrQuery} instance.
+     * 
+     * @param queryTerm
+     *            {@link String} query term to be represented as a {@link SolrQuery}
+     * @return {@link SolrQuery} wrapping the given <code>queryTerm</code>
+     */
+    public static SolrQuery prepareSolrQuery(String queryTerm) {
         SolrQuery solrQuery = new SolrQuery();
         solrQuery.setQuery(queryTerm);
         return solrQuery;
     }
 
-    public static SolrQuery prepareFacetedSolrQuery(String queryTerm, List<FacetResult> allAvailableFacets, Map<String,List<Object>> constraints) {
-        SolrQuery solrQuery = keywordQueryWithFacets(queryTerm, allAvailableFacets, constraints);
-        return solrQuery;
+    /**
+     * This method creates a {@link SolrQuery} with the given parameters. It sets the <code>queryTerm</code>
+     * as the main query and for each constraint passed in the <code>constraints</code> a filter query is
+     * added to the solr query.
+     * 
+     * @param queryTerm
+     *            main query to be used in {@link SolrQuery#setQuery(String)}
+     * @param allAvailableFacets
+     *            {@link FacetResult}s passed in this list are used to check types of the facets.
+     * @param constraints
+     *            additional constraints to be applied in the {@link SolrQuery}.
+     * @return {@link SolrQuery} constructed by using the given parameters
+     */
+    public static SolrQuery prepareSolrQuery(String queryTerm,
+                                             List<FacetResult> allAvailableFacets,
+                                             Map<String,List<Object>> constraints) {
+        SolrQuery query = new SolrQuery();
+        query.setQuery(queryTerm);
+        if (constraints != null) {
+            try {
+                for (Entry<String,List<Object>> entry : constraints.entrySet()) {
+                    String fieldName = ClientUtils.escapeQueryChars(entry.getKey());
+                    String type = getFacetFieldType(fieldName, allAvailableFacets);
+                    for (Object value : entry.getValue()) {
+                        if (SolrVocabulary.isRangeType(type)) {
+                            query.addFilterQuery(fieldName + facetDelimiter + (String) value);
+                        } else {
+                            query.addFilterQuery(fieldName + facetDelimiter + quotation
+                                                 + ClientUtils.escapeQueryChars((String) value) + quotation);
+                        }
+                    }
+                }
+            } catch (Exception e) {
+                log.warn("Facet constraints could not be added to Query", e);
+            }
+        }
+        return query;
+    }
+
+    private static String getFacetFieldType(String fieldName, List<FacetResult> allAvailableFacets) {
+        for (FacetResult fr : allAvailableFacets) {
+            if (fieldName.equals(fr.getFacetField().getName())) {
+                return fr.getType();
+            }
+        }
+        return "";
     }
 
     public static List<String> getAllFacetNames(SolrServer solrServer) throws SolrServerException,
@@ -209,4 +255,22 @@ public class SolrQueryUtil {
                     "Fields container is not a NamedList, so there is no facet information available");
         }
     }
+
+    /**
+     * This method parses the {@link Set} of {@link Constraint} and update the {@link SolrQuery} with
+     * corresponding field queries. Name of the field is obtained from associated {@link Facet} of a
+     * constraint and the value is obtained from the constraint itself.
+     * 
+     * @param constraints
+     *            {@link Set} of {@link Constraint}s to be transformed into the given <code>solrQuery</code>
+     * @param solrQuery
+     *            {@link SolrQuery} to be updated with the given <code>constraints</code>
+     */
+    public static void addConstraintsToSolrQuery(Set<Constraint> constraints, SolrQuery solrQuery) {
+        if (constraints != null) {
+            for (Constraint constraint : constraints) {
+                solrQuery.addFilterQuery(constraint.getFacet().getLabel(null) + ":" + constraint.getValue());
+            }
+        }
+    }
 }

Modified: incubator/stanbol/trunk/contenthub/servicesapi/src/main/java/org/apache/stanbol/contenthub/servicesapi/search/featured/FeaturedSearch.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/contenthub/servicesapi/src/main/java/org/apache/stanbol/contenthub/servicesapi/search/featured/FeaturedSearch.java?rev=1333409&r1=1333408&r2=1333409&view=diff
==============================================================================
--- incubator/stanbol/trunk/contenthub/servicesapi/src/main/java/org/apache/stanbol/contenthub/servicesapi/search/featured/FeaturedSearch.java (original)
+++ incubator/stanbol/trunk/contenthub/servicesapi/src/main/java/org/apache/stanbol/contenthub/servicesapi/search/featured/FeaturedSearch.java Thu May  3 11:49:05 2012
@@ -17,6 +17,7 @@
 package org.apache.stanbol.contenthub.servicesapi.search.featured;
 
 import java.util.List;
+import java.util.Set;
 
 import org.apache.solr.common.params.SolrParams;
 import org.apache.stanbol.contenthub.servicesapi.search.SearchException;
@@ -96,15 +97,14 @@ public interface FeaturedSearch {
 
     /**
      * This methods returns a {@link SearchResult} as a unified search response. The response contains content
-     * items retrieved from the index, which is accessed using the given <code>indexName</code>, of
-     * Contenthub for the given <code>queryTerm</code>. This name corresponds to a Solr Core name within
-     * Contenthub. It also consists of related keywords that are obtained from the available
-     * {@link RelatedKeywordSearch} instances. This method also takes an ontology URI. Using the URI, actual
-     * ontology is obtained and it is used as related keyword source. To obtain related keywords, first the
-     * meaningful query terms are extracted from the Solr query and then they are tokenized with
-     * {@link #tokenizeEntities(String)}. And then, related keyword searchers are queried for all the query
-     * tokens. Furthermore, the {@link SearchResult} includes Solr facets that are obtained for the obtained
-     * content items.
+     * items retrieved from the index, which is accessed using the given <code>indexName</code>, of Contenthub
+     * for the given <code>queryTerm</code>. This name corresponds to a Solr Core name within Contenthub. It
+     * also consists of related keywords that are obtained from the available {@link RelatedKeywordSearch}
+     * instances. This method also takes an ontology URI. Using the URI, actual ontology is obtained and it is
+     * used as related keyword source. To obtain related keywords, first the meaningful query terms are
+     * extracted from the Solr query and then they are tokenized with {@link #tokenizeEntities(String)}. And
+     * then, related keyword searchers are queried for all the query tokens. Furthermore, the
+     * {@link SearchResult} includes Solr facets that are obtained for the obtained content items.
      * 
      * @param solrQuery
      *            for which the search results will be obtained
@@ -115,6 +115,45 @@ public interface FeaturedSearch {
     SearchResult search(SolrParams solrQuery, String ontologyURI, String indexName) throws SearchException;
 
     /**
+     * This method searches the given <code>keyword</code> in the default index of Contenthub considering the
+     * given <code>constraints</code>. Results are returned in a {@link ConstrainedDocumentSet} instance and
+     * all search results are returned without considering any <i>offset</i> or <i>limit</i> value.
+     * Furthermore, returned {@link ConstrainedDocumentSet} contains {@link Constraint}s that were used to
+     * filter the results and all possible {@link Facet}s that can be used to filter results even more.
+     * 
+     * @param keyword
+     *            keyword to be searched
+     * @param constraints
+     *            a {@link Set} of {@link Constraint}s to be provided in addition to initial query
+     *            <code>keyword</code>
+     * @return an instance of {@link ConstrainedDocumentSet} including the search results and additional
+     *         {@link Constraint} and {@link Facet} information.
+     * @throws SearchException
+     */
+    ConstrainedDocumentSet search(String keyword, Set<Constraint> constraints) throws SearchException;
+
+    /**
+     * This method searches the given <code>keyword</code> in the Solr index identified by the given
+     * <code>indexName</code> considering the given <code>constraints</code>. Results are returned in a
+     * {@link ConstrainedDocumentSet} instance and all search results are returned without considering any
+     * <i>offset</i> or <i>limit</i> value. Furthermore, returned {@link ConstrainedDocumentSet} contains
+     * {@link Constraint}s that were used to filter the results and all possible {@link Facet}s that can be
+     * used to filter results even more.
+     * 
+     * @param keyword
+     *            keyword to be searched
+     * @param constraints
+     *            a {@link Set} of {@link Constraint}s to be provided in addition to initial query
+     *            <code>keyword</code>
+     * @param indexName
+     *            name of the index (Solr core) on which search will be done
+     * @return an instance of {@link ConstrainedDocumentSet} including the search results and additional
+     *         {@link Constraint} and {@link Facet} information.
+     * @throws SearchException
+     */
+    ConstrainedDocumentSet search(String keyword, Set<Constraint> constraints, String indexName) throws SearchException;
+
+    /**
      * This method obtains the available field names of the default index of Contenthub.
      * 
      * @return {@link List} of field names related index

Modified: incubator/stanbol/trunk/contenthub/web/src/main/java/org/apache/stanbol/contenthub/web/resources/FeaturedSearchResource.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/contenthub/web/src/main/java/org/apache/stanbol/contenthub/web/resources/FeaturedSearchResource.java?rev=1333409&r1=1333408&r2=1333409&view=diff
==============================================================================
--- incubator/stanbol/trunk/contenthub/web/src/main/java/org/apache/stanbol/contenthub/web/resources/FeaturedSearchResource.java (original)
+++ incubator/stanbol/trunk/contenthub/web/src/main/java/org/apache/stanbol/contenthub/web/resources/FeaturedSearchResource.java Thu May  3 11:49:05 2012
@@ -234,10 +234,10 @@ public class FeaturedSearchResource exte
 			if (this.chosenFacets != null) {
 				List<FacetResult> allAvailableFacets = featuredSearch
 						.getAllFacetResults(indexName);
-				sq = SolrQueryUtil.prepareFacetedSolrQuery(queryTerm,
+				sq = SolrQueryUtil.prepareSolrQuery(queryTerm,
 						allAvailableFacets, constraintsMap);
 			} else {
-				sq = SolrQueryUtil.prepareDefaultSolrQuery(queryTerm);
+				sq = SolrQueryUtil.prepareSolrQuery(queryTerm);
 			}
 			sq.setStart(offset);
 			sq.setRows(limit + 1);