Subversion Repositories SmartDukaan

Rev

Rev 8326 | Rev 8358 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 8326 Rev 8328
Line 147... Line 147...
147
	 * 
147
	 * 
148
	 * @param query
148
	 * @param query
149
	 * @param facetDefinitionIDs
149
	 * @param facetDefinitionIDs
150
	 */
150
	 */
151
	public SolrSearchService(String query, String[] facetqueries, long start, long rows,  Double minPrice, Double maxPrice, String sortOrder, long sourceId) {
151
	public SolrSearchService(String query, String[] facetqueries, long start, long rows,  Double minPrice, Double maxPrice, String sortOrder, long sourceId) {
152
		try {
152
 
153
			this.query = URLEncoder.encode(query, "UTF-8");
-
 
154
		} catch (UnsupportedEncodingException e1) {
-
 
155
			this.query=query;
153
		this.query = query;
156
			e1.printStackTrace();
-
 
157
		}
-
 
158
		
154
		
159
		List<String> facetsQueried = new ArrayList<String>();
155
		List<String> facetsQueried = new ArrayList<String>();
160
		if(sourceId != -1){
156
		if(sourceId != -1){
161
			priceFacetName = priceFacetName + "_" + sourceId;
157
			priceFacetName = priceFacetName + "_" + sourceId;
162
		}
158
		}
Line 167... Line 163...
167
		this.xpath = XPathFactory.newInstance().newXPath();
163
		this.xpath = XPathFactory.newInstance().newXPath();
168
		
164
		
169
		query = query.trim().replaceAll("\\s+", " ");
165
		query = query.trim().replaceAll("\\s+", " ");
170
    	log.info("query=" + query);
166
    	log.info("query=" + query);
171
    	
167
    	
-
 
168
		String uri;
-
 
169
		try {
-
 
170
			uri = SOLR_URL + "?wt=xml&q=" + URLEncoder.encode(this.query, "UTF-8");
-
 
171
		} catch (UnsupportedEncodingException e1) {
-
 
172
			// TODO Auto-generated catch block
172
		String uri = SOLR_URL + "?wt=xml&q=" + query;
173
			uri = SOLR_URL + "?wt=xml&q=" + this.query;
-
 
174
			e1.printStackTrace();
-
 
175
		}
173
		
176
		
174
		uri += "&stats=on&stats.field=" + priceFacetName;
177
		uri += "&stats=on&stats.field=" + priceFacetName;
175
		
178
		
176
		if(sortOrder != null){
179
		if(sortOrder != null){
177
			//replace the price facet name, so that it can pick price for the source.
180
			//replace the price facet name, so that it can pick price for the source.