| Line 34... |
Line 34... |
| 34 |
} catch (URISyntaxException e) {
|
34 |
} catch (URISyntaxException e) {
|
| 35 |
log.error("Error while building solr_url "+e);
|
35 |
log.error("Error while building solr_url "+e);
|
| 36 |
}
|
36 |
}
|
| 37 |
autoSuggestUrl.addParameter("fl", "title,subCategoryId,category_id,category,subCategory,score"); //Fields to choose
|
37 |
autoSuggestUrl.addParameter("fl", "title,subCategoryId,category_id,category,subCategory,score"); //Fields to choose
|
| 38 |
autoSuggestUrl.addParameter("wt", "json"); //Output format
|
38 |
autoSuggestUrl.addParameter("wt", "json"); //Output format
|
| 39 |
autoSuggestUrl.addParameter("group", "true"); //group data
|
- |
|
| 40 |
autoSuggestUrl.addParameter("group.query", "category_id:3"); //group by category
|
- |
|
| 41 |
autoSuggestUrl.addParameter("group.query", "category_id:5"); //group by category
|
- |
|
| 42 |
autoSuggestUrl.addParameter("group.field", "subCategoryId"); //group by subCategory
|
- |
|
| 43 |
autoSuggestUrl.addParameter("group.limit", "10"); //search limit for each grouped field or query
|
39 |
autoSuggestUrl.addParameter("rows", "20"); //search limit for each grouped field or query
|
| 44 |
}
|
40 |
}
|
| 45 |
|
41 |
|
| 46 |
public String getSuggestions(String search_text) throws URISyntaxException, IOException{
|
42 |
public String getSuggestions(String search_text) throws URISyntaxException, IOException{
|
| 47 |
autoSuggestUrl.setParameter("q", "suggest:("+search_text+")");
|
43 |
autoSuggestUrl.setParameter("q", "suggest:("+search_text+")");
|
| 48 |
URL url = autoSuggestUrl.build().toURL();
|
44 |
URL url = autoSuggestUrl.build().toURL();
|