Subversion Repositories SmartDukaan

Rev

Rev 1720 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1720 Rev 2188
Line 1... Line 1...
1
package in.shop2020.social.services;
1
package in.shop2020.social.services;
2
 
2
 
3
import in.shop2020.config.ConfigException;
3
import in.shop2020.config.ConfigException;
4
import in.shop2020.thrift.clients.config.ConfigClient;
4
import in.shop2020.thrift.clients.config.ConfigClient;
5
 
5
 
6
import java.util.Arrays;
-
 
7
import java.util.HashMap;
6
import java.util.HashMap;
8
import java.util.LinkedList;
7
import java.util.LinkedList;
9
import java.util.List;
8
import java.util.List;
10
import java.util.TreeMap;
9
import java.util.TreeMap;
11
 
10
 
Line 24... Line 23...
24
 * @author Varun Gupta
23
 * @author Varun Gupta
25
 *
24
 *
26
 */
25
 */
27
 
26
 
28
public class SolrSearchService {
27
public class SolrSearchService {
29
	/**
-
 
30
	 * 
-
 
31
	 */
-
 
32
	private static final int PERCENTAGE_OF_TOTAL_RESULTS = 2;
-
 
33
	
28
	
34
	/**
29
	/**
35
	 * 
30
	 * 
36
	 */
31
	 */
37
	public static final String SOLR_URL;
32
	public static final String SOLR_URL;
Line 177... Line 172...
177
	
172
	
178
	public TreeMap<String,HashMap<String,Integer>> getFacetMap() {
173
	public TreeMap<String,HashMap<String,Integer>> getFacetMap() {
179
		facetMap = new TreeMap<String,HashMap<String,Integer>>();
174
		facetMap = new TreeMap<String,HashMap<String,Integer>>();
180
		
175
		
181
		String facetNamePath = "/response/lst/lst[@name = 'facet_fields']/lst";
176
		String facetNamePath = "/response/lst/lst[@name = 'facet_fields']/lst";
182
		String facetValuePath = "/response/lst/lst[@name = 'facet_fields']/lst/int/@name";
-
 
183
		String facetCountPath = "/response/lst/lst[@name = 'facet_fields']/lst/int";
-
 
184
		
177
		
185
		NodeList nodes = null;
178
		NodeList nodes = null;
186
		try {
179
		try {
187
			nodes = (NodeList) this.xpath.evaluate(facetNamePath, this.inputSource, XPathConstants.NODESET);
180
			nodes = (NodeList) this.xpath.evaluate(facetNamePath, this.inputSource, XPathConstants.NODESET);
188
		}
181
		}
Line 522... Line 515...
522
	    	"Talk time"
515
	    	"Talk time"
523
    	};
516
    	};
524
 
517
 
525
		 */
518
		 */
526
    	String[] facetDefIDs = new String[] {"Category","F_50002","F_50001",  "F_50006", "F_50007" };
519
    	String[] facetDefIDs = new String[] {"Category","F_50002","F_50001",  "F_50006", "F_50007" };
527
    	String[] facetLabels = new String[] {"Category","Price", "Brand", "Data Connectivity", "Camera Resolution"	};
-
 
528
 
-
 
529
    	
520
    	
530
    	String[] fqrys = {};
521
    	String[] fqrys = {};
531
		SolrSearchService search = new SolrSearchService("nokia", fqrys, facetDefIDs, 0 , 20, null, null, 10000, null);
522
		SolrSearchService search = new SolrSearchService("nokia", fqrys, facetDefIDs, 0 , 20, null, null, 10000, null);
532
    	
523
    	
533
    	long[] entityIDs = search.getResultEntityIDs();
-
 
534
    	
-
 
535
    	String[] entityNames = search.getResultEntityNames();
-
 
536
    	search.getFacetMap();
524
    	search.getFacetMap();
537
    	
525
    	
538
    	search.getResultMap();
526
    	search.getResultMap();
539
    	search.getRangeQueryResultMap();
527
    	search.getRangeQueryResultMap();
540
    	search.getPriceStatsMap();
528
    	search.getPriceStatsMap();