Subversion Repositories SmartDukaan

Rev

Rev 6896 | Rev 6998 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
317 ashish 1
/**
2
 * 
3
 */
4
package in.shop2020.serving.services;
5
 
6
 
1698 chandransh 7
import in.shop2020.config.ConfigException;
6866 amit.gupta 8
import in.shop2020.serving.utils.Utils;
1698 chandransh 9
import in.shop2020.thrift.clients.config.ConfigClient;
2070 rajveer 10
import in.shop2020.utils.CategoryManager;
1698 chandransh 11
 
6866 amit.gupta 12
import java.util.ArrayList;
354 rajveer 13
import java.util.Arrays;
5729 amit.gupta 14
import java.util.Collections;
354 rajveer 15
import java.util.HashMap;
6866 amit.gupta 16
import java.util.HashSet;
5729 amit.gupta 17
import java.util.Iterator;
18
import java.util.LinkedHashMap;
790 vikas 19
import java.util.LinkedList;
20
import java.util.List;
5729 amit.gupta 21
import java.util.Map;
6866 amit.gupta 22
import java.util.Set;
354 rajveer 23
import java.util.TreeMap;
6866 amit.gupta 24
import java.util.regex.Matcher;
25
import java.util.regex.Pattern;
354 rajveer 26
 
317 ashish 27
import javax.xml.xpath.XPath;
28
import javax.xml.xpath.XPathConstants;
29
import javax.xml.xpath.XPathExpressionException;
30
import javax.xml.xpath.XPathFactory;
31
 
832 rajveer 32
import org.apache.log4j.Logger;
317 ashish 33
import org.w3c.dom.Node;
34
import org.w3c.dom.NodeList;
35
import org.xml.sax.InputSource;
36
 
354 rajveer 37
 
317 ashish 38
/**
545 rajveer 39
 * @author rajveer
317 ashish 40
 *
41
 */
42
public class SolrSearchService {
43
	/**
44
	 * 
45
	 */
2147 chandransh 46
	private static Logger log = Logger.getLogger(Class.class);
6931 amit.gupta 47
	private HashMap<String, Double> dynamicPriceMap = null;
545 rajveer 48
 
49
	/**
50
	 * 
51
	 */
1698 chandransh 52
	public static final String SOLR_URL;
317 ashish 53
 
6866 amit.gupta 54
	private static final Pattern FACET_PATTERN = Pattern.compile("(?=(F_\\d{5}))");
55
 
5729 amit.gupta 56
	private static final Map<String, List<String>> SORTED_FACET_VALUE_MAP = Collections.unmodifiableMap(
57
			new HashMap<String, List<String>>(){
58
				/**
59
				 * 
60
				 */
61
				private static final long serialVersionUID = 1L;
62
 
63
				{
6896 amit.gupta 64
					put("F_50007", Arrays.asList("Upto 2 Mpx", "2 - 5 Mpx", "5 - 10 Mpx", "10 Mpx and above"));
65
					put("F_50024", Arrays.asList("Upto 10 Mpx", "10 - 12 Mpx", "12 - 15 Mpx", "15 - 18 Mpx", "18 Mpx and above"));
66
					put("F_50025", Arrays.asList("Upto 4x", "4 - 6x", "6 - 10x", "10 - 14x", "14 - 18x", "18x and above"));
67
					put("F_50026", Arrays.asList("Below 2 in.", "2 to 2.9 in.", "3 to 3.9 in.", "4 in. and above"));
68
					put("F_50032", Arrays.asList("Below 3 in.", "3 to 3.9 in.", "4 to 4.9 in.", "5 in. and above"));
69
					put("F_50027", Arrays.asList("Upto 10 Mpx", "10 - 15 Mpx", "15 - 20 Mpx", "20 Mpx and above"));
5729 amit.gupta 70
				}
71
		});
1698 chandransh 72
	static {
73
		String solr_url = null;
74
		try {
75
			solr_url = ConfigClient.getClient().get("solr_url");
76
		}catch(ConfigException cex){
2949 chandransh 77
		    log.error("Unable to get the solr URL from the config server. Setting the default value.", cex);
1698 chandransh 78
			solr_url = "http://localhost:8983/solr/select/";
79
		}
80
		SOLR_URL = solr_url;
81
	}
82
 
317 ashish 83
	/**
84
	 * 
85
	 */
86
	private XPath xpath;
87
 
88
	/**
89
	 * 
90
	 */
91
	private InputSource inputSource;
92
 
5729 amit.gupta 93
	Map<String,Map<String,Integer>> facetMap;
354 rajveer 94
 
6866 amit.gupta 95
	private String 	query;
96
 
790 vikas 97
	List<String> resultMap;
545 rajveer 98
 
99
	long numberOfResults=0;
3561 rajveer 100
 
101
	String priceFacetName = "F_50002";
102
 
317 ashish 103
	/**
104
	 * 
105
	 * @param query
106
	 * @param facetDefinitionIDs
107
	 */
3561 rajveer 108
	public SolrSearchService(String query, String[] facetqueries, String[] facetDefinitionIDs, long start, long rows,  Double minPrice, Double maxPrice, long categoryId, String sortOrder, long sourceId) {
6866 amit.gupta 109
		this.query = query;
354 rajveer 110
 
6866 amit.gupta 111
		List<String> rootFacetsQueried = new ArrayList<String>();
3561 rajveer 112
		if(sourceId != -1){
113
			priceFacetName = priceFacetName + "_" + sourceId;
114
		}
115
 
317 ashish 116
		this.xpath = XPathFactory.newInstance().newXPath();
545 rajveer 117
 
2606 rajveer 118
		query = query.trim().replaceAll("\\s+", " ");
545 rajveer 119
    	log.info("query=" + query);
120
 
317 ashish 121
		String uri = SOLR_URL + "?wt=xml&q=" + query;
122
 
3561 rajveer 123
		uri += "&stats=on&stats.field=" + priceFacetName;
545 rajveer 124
 
125
 
569 rajveer 126
		if(categoryId != 10000){
127
			uri += "&fq=F_50010:\"" + CategoryManager.getCategoryManager().getCategoryLabel(categoryId) + "\"";
128
		}
354 rajveer 129
 
569 rajveer 130
		if(sortOrder != null){
3561 rajveer 131
			//replace the price facet name, so that it can pick price for the source.
132
			sortOrder = sortOrder.replace("F_50002", priceFacetName);
569 rajveer 133
			uri += "&sort=" + sortOrder;
134
		}
545 rajveer 135
 
317 ashish 136
		if(facetqueries != null) {
6866 amit.gupta 137
			//sorting will guarantee all similar facets together so that we can assume or between all similar items without fail.
138
			Arrays.sort(facetqueries);
139
			String fq="";
317 ashish 140
			for(int i=0; i<facetqueries.length; i++) {
6866 amit.gupta 141
				String[] tokens = facetqueries[i].split(":");
142
				if(rootFacetsQueried.contains(tokens[0])) {
143
					uri += " OR ";
144
					if(facetqueries[i].contains(" ")){
145
						uri +=  "\"" + tokens[1] + "\"";
146
					}else{
147
						uri += facetqueries[i];
148
					}
149
 
150
				} else {
151
					if(Arrays.asList(Utils.facetDefIDs).contains(tokens[0])) {
152
						fq = "{!tag=dt" + rootFacetsQueried.size() + "}";
153
						rootFacetsQueried.add(tokens[0]);
154
						if(facetqueries[i].contains(" ") && !(facetqueries[i].contains(" OR "))){
155
							fq +=  tokens[0] + ":\"" + tokens[1] + "\"";
156
						}else{
157
							fq += facetqueries[i] + "";
158
						}
159
					}
160
					uri += "&fq=" + fq;
536 rajveer 161
				}
317 ashish 162
			}
163
		}
6931 amit.gupta 164
		String minString = "0";
165
		String maxString = "*";  
166
		if(minPrice != null || maxPrice != null){
167
			try {
168
				dynamicPriceMap = getPriceStatsMap(new InputSource(uri)); 
169
			} catch (Exception e){
170
				e.printStackTrace();
171
			}
172
			if(minPrice != null){
173
				minString = minPrice.toString();
174
			}
175
			if(maxPrice != null){
176
				maxString = maxPrice.toString();
177
			}
178
		}
179
		uri += "&fq=" + priceFacetName + ":["+  minString + " " + maxString + "]";
6866 amit.gupta 180
		uri += "&fl=ID,Name&facet=true&start=" + start + "&rows=" + rows + "&facet.mincount=1";
2435 rajveer 181
		if(facetDefinitionIDs != null){
182
			for(int i=0; i<facetDefinitionIDs.length; i++) {
6866 amit.gupta 183
				if(rootFacetsQueried.contains(facetDefinitionIDs[i])){
184
					uri += "&facet.field={!ex=dt" + rootFacetsQueried.indexOf(facetDefinitionIDs[i])+ "}"+ facetDefinitionIDs[i]; 
185
				} else {
186
					uri += "&facet.field=" + facetDefinitionIDs[i];
187
				}
2435 rajveer 188
			}
317 ashish 189
		}
3262 rajveer 190
		log.info("uri=" + uri);
317 ashish 191
 
192
		this.inputSource = new InputSource(uri);
517 rajveer 193
 
545 rajveer 194
		this.facetMap = getFacetMap();
354 rajveer 195
	}
196
 
5729 amit.gupta 197
	public Map<String,Map<String,Integer>> removeUnwantedFacets(Map<String,Map<String,Integer>> facetMap, long numberOfResults){
6866 amit.gupta 198
 
199
		Set<String> facetsInQuery = new HashSet<String>(getAllMatches(this.query));
5729 amit.gupta 200
		Map<String,Map<String,Integer>> tempFacets = new TreeMap<String, Map<String,Integer>>(); 
354 rajveer 201
		for(String facet : facetMap.keySet()){
6866 amit.gupta 202
			if(facetMap.get(facet).size() > 0 && !facetsInQuery.contains(facet)){
5729 amit.gupta 203
				Map<String,Integer> tempMap = new LinkedHashMap<String, Integer>();
545 rajveer 204
 
354 rajveer 205
				for(String facetValueName : facetMap.get(facet).keySet()){
6866 amit.gupta 206
					//if(facetMap.get(facet).get(facetValueName) != 0 && facetMap.get(facet).get(facetValueName) != numberOfResults){
545 rajveer 207
						tempMap.put(facetValueName, facetMap.get(facet).get(facetValueName));
6866 amit.gupta 208
					//}
354 rajveer 209
				}
545 rajveer 210
				if(!tempMap.isEmpty()){
211
					tempFacets.put(facet, tempMap);
354 rajveer 212
				}
545 rajveer 213
			}	
354 rajveer 214
		}
6866 amit.gupta 215
		/*if(tempFacets.containsKey("F_50010")){
550 rajveer 216
			tempFacets.remove("F_50011");
6866 amit.gupta 217
		}*/
354 rajveer 218
 
219
		return tempFacets;
220
	}
221
 
5729 amit.gupta 222
	public Map<String,Integer> getFacetDetails(String facetName){
2606 rajveer 223
		if(facetMap != null){
224
			return facetMap.get(facetName);
225
		}else{
226
			return null;
227
		}
354 rajveer 228
	}
229
 
5729 amit.gupta 230
	public Map<String,Map<String,Integer>> getFacetMap() {
231
		facetMap = new TreeMap<String,Map<String,Integer>>();
354 rajveer 232
 
233
		String facetNamePath = "/response/lst/lst[@name = 'facet_fields']/lst";
545 rajveer 234
 
354 rajveer 235
		NodeList nodes = null;
236
		try {
237
			nodes = (NodeList) this.xpath.evaluate(facetNamePath, this.inputSource, XPathConstants.NODESET);
238
		}
239
		catch (XPathExpressionException xpee) {
240
			return null;
241
		}
242
 
243
		if(nodes.getLength() == 0) {
244
			return null;
245
		}
246
 
247
		NodeList subNodes = null;
248
 
249
		for(int i=0; i<nodes.getLength(); i++) {
250
			Node node = nodes.item(i);
2946 chandransh 251
			String facetName = node.getAttributes().getNamedItem("name").getNodeValue();
354 rajveer 252
			subNodes = node.getChildNodes();
5729 amit.gupta 253
			Map<String,Integer> facetValueCountMap = new LinkedHashMap<String,Integer>();
354 rajveer 254
			for(int j=0; j<subNodes.getLength(); j++) {
255
				Node subNode = subNodes.item(j);
256
				facetValueCountMap.put(subNode.getAttributes().getNamedItem("name").getNodeValue(), Integer.parseInt(subNode.getTextContent()));
257
			}
5729 amit.gupta 258
			if(SORTED_FACET_VALUE_MAP.containsKey(facetName)){
259
				List<String> orderedValues = SORTED_FACET_VALUE_MAP.get(facetName);
260
				Map<String, Integer> sortedMap = new LinkedHashMap<String, Integer>();
261
			    for (Iterator<String> it = orderedValues.iterator(); it.hasNext();) {
262
			    	String val = it.next();
263
			        if(facetValueCountMap.containsKey(val)) {
264
			        	sortedMap.put(val, facetValueCountMap.get(val));
265
			        }
266
			    }
267
			    facetMap.put(facetName, sortedMap);
268
			} else {
269
				facetMap.put(facetName, facetValueCountMap);
354 rajveer 270
			}
5729 amit.gupta 271
		}
545 rajveer 272
		this.numberOfResults  = this.getTotalResults();
517 rajveer 273
 
354 rajveer 274
		facetMap = removeUnwantedFacets(facetMap, numberOfResults);
275
		return facetMap;
5729 amit.gupta 276
	}
354 rajveer 277
 
790 vikas 278
	public List<String> getResultMap() {
279
		resultMap = new LinkedList<String>();
354 rajveer 280
 
281
		String resultDocsPath = "/response/result/doc";
282
 
283
 
284
		NodeList nodes = null;
285
		try {
286
			nodes = (NodeList) this.xpath.evaluate(resultDocsPath, this.inputSource, XPathConstants.NODESET);
287
		}
288
		catch (XPathExpressionException xpee) {
289
			return null;
290
		}
291
 
292
		if(nodes.getLength() == 0) {
293
			return null;
294
		}
295
 
296
		for(int i=0; i<nodes.getLength(); i++) {
297
			Node node = nodes.item(i);
298
			String docID = node.getFirstChild().getTextContent();
790 vikas 299
			resultMap.add(docID);	
354 rajveer 300
 		}
301
		return resultMap;
302
	}
303
 
304
	public HashMap<String, Double> getPriceStatsMap() {
6931 amit.gupta 305
		return this.getPriceStatsMap(this.inputSource);
306
	}
307
 
308
	public HashMap<String, Double> getPriceStatsMap(InputSource inputSource) {
354 rajveer 309
		HashMap<String, Double> priceStatsMap = new HashMap<String, Double>();
310
 
3561 rajveer 311
		String resultDocsPath = "/response/lst[@name = 'stats']/lst[@name = 'stats_fields']/lst[@name = '" + priceFacetName + "']";
354 rajveer 312
 
313
 
314
		NodeList nodes = null;
315
		try {
6931 amit.gupta 316
			nodes = (NodeList) this.xpath.evaluate(resultDocsPath, inputSource, XPathConstants.NODESET);
354 rajveer 317
		}
318
		catch (XPathExpressionException xpee) {
319
			return null;
320
		}
321
 
322
		if(nodes.getLength() == 0) {
323
			return null;
324
		}
325
 
326
		NodeList subNodes = nodes.item(0).getChildNodes();
327
 
328
		for(int i=0; i<subNodes.getLength(); i++) {
329
			Node node = subNodes.item(i);
330
 
331
			String parameter = node.getAttributes().getNamedItem("name").getNodeValue();
332
			String value = node.getTextContent();
333
			priceStatsMap.put(parameter, Double.parseDouble(value));	
334
 		}
335
		return priceStatsMap;
336
	}
337
 
338
	public HashMap<String,Integer> getRangeQueryResultMap() {
339
		HashMap<String, Integer> rangeQueryResultMap = new HashMap<String,Integer>();
340
 
341
		String resultDocsPath = "/response/lst[@name = 'facet_counts']/lst[@name = 'facet_queries']/int";
342
 
343
 
344
		NodeList nodes = null;
345
		try {
346
			nodes = (NodeList) this.xpath.evaluate(resultDocsPath, this.inputSource, XPathConstants.NODESET);
347
		}
348
		catch (XPathExpressionException xpee) {
349
			return null;
350
		}
351
 
352
		if(nodes.getLength() == 0) {
353
			return null;
354
		}
355
 
356
 
357
		for(int i=0; i<nodes.getLength(); i++) {
358
			Node node = nodes.item(i);
359
 
360
			String query = node.getAttributes().getNamedItem("name").getNodeValue();
361
			String docCount = node.getTextContent();
362
 
363
			rangeQueryResultMap.put(query,Integer.parseInt(docCount));	
364
 		}
365
		return rangeQueryResultMap;
366
 
367
	}
368
 
545 rajveer 369
	/**
370
	 * 
371
	 */
372
	public long getTotalResults(){
373
		String resultDocsPath = "/response/result";
374
		NodeList nodes = null;
375
		try {
376
			nodes = (NodeList) this.xpath.evaluate(resultDocsPath, this.inputSource, XPathConstants.NODESET);
377
		}
378
		catch (XPathExpressionException xpee) {
379
			return 0;
380
		}
381
 
382
		Node node = nodes.item(0);
383
 
384
		return Long.parseLong(node.getAttributes().getNamedItem("numFound").getNodeValue());
385
 
386
	}
354 rajveer 387
		/**
317 ashish 388
	 * 
389
	 * @return
390
	 */
391
	public long[] getResultEntityIDs() {
392
		String expression = "/response/result/doc/long";
393
 
394
		NodeList nodes = null;
395
		try {
396
			nodes = (NodeList) this.xpath.evaluate(expression, this.inputSource,
397
					XPathConstants.NODESET);
398
		} 
399
		catch(XPathExpressionException xpee) {
400
			return null;
401
		}
402
 
403
		if(nodes.getLength() == 0) {
404
			return null;
405
		}
406
 
407
		long[] values = new long[nodes.getLength()];
408
		for(int i=0; i<nodes.getLength(); i++) {
409
			Node node = nodes.item(i);
410
			String value = node.getTextContent();
411
			values[i] = Long.parseLong(value);
412
 		}
413
 
414
		return values;
415
	}
416
 
417
	/**
418
	 * 
419
	 * @return
420
	 */
421
	public String[] getResultCategoryNames() {
422
		String expression = "/response/lst/lst[@name = 'facet_fields']/";
423
		expression += "lst[@name = 'Category']/int/@name";
424
 
425
		NodeList nodes = null;
426
		try {
427
			nodes = (NodeList) this.xpath.evaluate(expression, 
428
				this.inputSource, XPathConstants.NODESET);
429
		}
430
		catch (XPathExpressionException xpee) {
431
			return null;
432
		}
433
 
434
		if(nodes.getLength() == 0) {
435
			return null;
436
		}
437
 
438
		String[] values = new String[nodes.getLength()];
439
		for(int i=0; i<nodes.getLength(); i++) {
440
			Node node = nodes.item(i);
441
			values[i] = node.getTextContent();
442
 		}
443
 
444
		return values;
445
	}
446
 
447
	/**
448
	 * 
449
	 * @return
450
	 */
451
	public int[] getResultCategoryCounts() {
452
		String expression = "/response/lst/lst[@name = 'facet_fields']/";
453
		expression += "lst[@name = 'Category']/int";
454
 
455
		NodeList nodes = null;
456
		try {
457
			nodes = (NodeList) this.xpath.evaluate(expression, 
458
				this.inputSource, XPathConstants.NODESET);
459
		}
460
		catch (XPathExpressionException xpee) {
461
			return null;
462
		}
463
 
464
		if(nodes.getLength() == 0) {
465
			return null;
466
		}
467
 
468
		int[] values = new int[nodes.getLength()];
469
		for(int i=0; i<nodes.getLength(); i++) {
470
			Node node = nodes.item(i);
471
			values[i] = Integer.parseInt(node.getTextContent());
472
 		}
473
 
474
		return values;
475
	}
476
 
477
	/**
478
	 * 
479
	 * @return
480
	 */
481
	public String[]  getResultEntityNames() {
482
		String expression = "/response/result/doc/str";
483
 
484
		NodeList nodes = null;
485
		try {
486
			nodes = (NodeList) this.xpath.evaluate(expression, this.inputSource,
487
					XPathConstants.NODESET);
488
		} 
489
		catch(XPathExpressionException xpee) {
490
			return null;
491
		}
492
 
493
		if(nodes.getLength() == 0) {
494
			return null;
495
		}
496
 
497
		String[] values = new String[nodes.getLength()];
498
		for(int i=0; i<nodes.getLength(); i++) {
499
			Node node = nodes.item(i);
500
			String value = node.getTextContent();
501
			values[i] = value;
502
 		}
503
 
504
		return values;
505
	}
506
 
507
	/**
508
	 * 
509
	 * @param facetDefinitionID
510
	 * @return
511
	 */
354 rajveer 512
	public String[] getFacetValues(String facetDefinitionID) {
317 ashish 513
		String expression = "/response/lst/lst[@name = 'facet_fields']/";
354 rajveer 514
		expression += "lst[@name = '"+ facetDefinitionID +"']/int/@name";
317 ashish 515
 
516
		NodeList nodes = null;
517
		try {
518
			nodes = (NodeList) this.xpath.evaluate(expression, 
519
				this.inputSource, XPathConstants.NODESET);
520
		}
521
		catch (XPathExpressionException xpee) {
522
			return null;
523
		}
524
 
525
		if(nodes.getLength() == 0) {
526
			return null;
527
		}
528
 
529
		String[] values = new String[nodes.getLength()];
530
		for(int i=0; i<nodes.getLength(); i++) {
531
			Node node = nodes.item(i);
532
			values[i] = node.getTextContent();
545 rajveer 533
		}
317 ashish 534
 
535
		return values;
536
	}
537
 
538
	/**
539
	 * 
540
	 * @param facetDefinitionID
541
	 * @return
542
	 */
354 rajveer 543
	public String[] getFacetCounts(String facetDefinitionID) {
317 ashish 544
		String expression = "/response/lst/lst[@name = 'facet_fields']/";
354 rajveer 545
		expression += "lst[@name = '" + facetDefinitionID + "']/int";
317 ashish 546
 
547
		NodeList nodes = null;
548
		try {
549
			nodes = (NodeList) this.xpath.evaluate(expression, 
550
				this.inputSource, XPathConstants.NODESET);
551
		}
552
		catch (XPathExpressionException xpee) {
553
			return null;
554
		}
555
 
556
		if(nodes.getLength() == 0) {
557
			return null;
558
		}
559
 
560
		String[] values = new String[nodes.getLength()];
561
		for(int i=0; i<nodes.getLength(); i++) {
562
			Node node = nodes.item(i);
563
			values[i] = node.getTextContent();
564
 		}
565
 
566
		return values;
567
	}
545 rajveer 568
 
569
	public static void main(String[] args){
570
		/*
571
    	// Hard coded for now
572
    	String[] facetDefIDs = new String[] {"F_50001", "F_50002", "F_50003", "F_50004", "F_50005", "F_50006", "F_50007", "F_50008", "F_50009"};
573
 
574
    	// Hard-coded for now
575
    	String[] facetLabels = new String[] {
576
	    	"Brand", "Price","Form Factor", "Carry In Pocket", "Cellular Technologies", 
577
	    	"Data Connectivity", "Camera Resolution", "Built-in Memory", 
578
	    	"Talk time"
579
    	};
580
 
581
		 */
582
    	String[] facetDefIDs = new String[] {"Category","F_50002","F_50001",  "F_50006", "F_50007" };
2147 chandransh 583
    	//String[] facetLabels = new String[] {"Category","Price", "Brand", "Data Connectivity", "Camera Resolution"	};
545 rajveer 584
 
585
 
586
    	String[] fqrys = {};
3561 rajveer 587
		SolrSearchService search = new SolrSearchService("nokia", fqrys, facetDefIDs, 0 , 20, null, null, 10000, null, -1);
545 rajveer 588
 
589
    	long[] entityIDs = search.getResultEntityIDs();
590
    	log.info("entityIDs=" + Arrays.toString(entityIDs));
591
 
592
    	String[] entityNames = search.getResultEntityNames();
593
    	log.info("entityNames=" + Arrays.toString(entityNames));
594
    	search.getFacetMap();
595
 
596
    	search.getResultMap();
597
    	search.getRangeQueryResultMap();
6931 amit.gupta 598
    	search.getPriceStatsMap(new InputSource());
545 rajveer 599
    	search.getTotalResults();
600
       	for (int i=0; i<facetDefIDs.length; i++) {
601
       		search.getFacetCounts(facetDefIDs[i]);
602
       		search.getFacetValues(facetDefIDs[i]);
603
       	}
604
 
605
	}
6866 amit.gupta 606
 
607
 
608
    public static List<String> getAllMatches(String text) {
609
        List<String> matches = new ArrayList<String>();
610
        Matcher m = FACET_PATTERN.matcher(text);
611
        while(m.find()) {
612
            matches.add(m.group(1));
613
        }
614
        return matches;
615
    }
6931 amit.gupta 616
 
617
    public Map<String, Double> getDynamicPriceMap() {
618
    	return this.dynamicPriceMap;
619
    }
620
 
317 ashish 621
}