incubator-blur-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Colton McInroy <col...@dosarrest.com>
Subject Re: Facets
Date Fri, 18 Oct 2013 10:43:12 GMT
Ok, so I created this method...

public static BlurResults queryBlur(String queryString, String table) {
         Iface client = 
BlurClient.getClient(mainConfig.getString("controllers"));
         Query query = new Query();
         query.setQuery(queryString);

         Selector selector = new Selector();

         // This will fetch all the columns in family "fam0".
         selector.addToColumnFamiliesToFetch("event");
         selector.addToColumnFamiliesToFetch("msg");

         BlurQuery blurQuery = new BlurQuery();
         List<Facet> facets = Arrays.asList(new Facet(queryString, 
Long.MAX_VALUE));
         blurQuery.setFacets(facets);
         blurQuery.setFetch(50);
         blurQuery.setQuery(query);
         blurQuery.setSelector(selector);

         try {
             BlurResults results = client.query(table, blurQuery);
             return results;
         } catch (BlurException e) {
             // TODO Auto-generated catch block
             e.printStackTrace();
         } catch (TException e) {
             // TODO Auto-generated catch block
             e.printStackTrace();
         }
         return null;
     }

 From reading through source code, I was able to find out that you 
specify facets as a list, but this is fairly confusing to me coming from 
lucene.

In lucene when getting facet data, I specify the facet fields I am 
interested in, and the facet results show me a top X list of values 
within that field. Whereas with blur, it appears that a facet is another 
query which gives only a number as a result. When I tried to obtain the 
facet data I am used to with Lucene, the only thing I could find was...

System.out.println("Facet Results: "+results.getFacetCountsSize());
System.out.println(JSONArray.toJSONString(results.getFacetCounts()));

Could you please elaborate on this.

Thanks,
Colton McInroy

  * Director of Security Engineering

	
Phone
(Toll Free) 	
_US_ 	(888)-818-1344 Press 2
_UK_ 	0-800-635-0551 Press 2

My Extension 	101
24/7 Support 	support@dosarrest.com <mailto:support@dosarrest.com>
Email 	colton@dosarrest.com <mailto:colton@dosarrest.com>
Website 	http://www.dosarrest.com

On 10/18/2013 3:07 AM, Colton McInroy wrote:
> I think I wrote this to soon, I believe I just found out how to do it. 
> I'll test it out and supply some example code if correct to help others.
>
> Thanks,
> Colton McInroy
>
>  * Director of Security Engineering
>
>
> Phone
> (Toll Free)
> _US_     (888)-818-1344 Press 2
> _UK_     0-800-635-0551 Press 2
>
> My Extension     101
> 24/7 Support     support@dosarrest.com <mailto:support@dosarrest.com>
> Email     colton@dosarrest.com <mailto:colton@dosarrest.com>
> Website     http://www.dosarrest.com
>
> On 10/18/2013 2:58 AM, Colton McInroy wrote:
>> Hey Aaron,
>>
>>     You mentioned a while ago that blur handles facets as well and 
>> that you would provide an example. Unless I have missed that email, I 
>> haven't seen an example yet, could you provide one? I just took a 
>> quick look myself and could not figure it out. I see there is an 
>> example FacetQueryTest.java in blur-query but that appears to be 
>> basically just a copy of the lucene file.
>>
>
>


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message