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 15:40:29 GMT
Hello Aaron,

     Yes, that's basically what I was thinking of for the facet results. 
The current implementation doesn't really make any sense if your coming 
from lucene. For simplicity and uniformity, I think it should be 
somewhat like it is with lucene... with adaptation to the way blur is 
built... I could kinda see something like this...

     public static void 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();
         int matches = 10;
         List<Facet> facets = Arrays.asList(new Facet("field1", 
matches),new Facet("field2", matches));
         blurQuery.setFacets(facets);
         blurQuery.setFetch(50);
         blurQuery.setQuery(query);
         blurQuery.setSelector(selector);

         try {
             BlurResults results = client.query(table, blurQuery);
             for (Facet facet : result.getFacetResults()) {
                 System.out.println(facet.name+" "+facet.value);
             }
         } catch (BlurException e) {
             // TODO Auto-generated catch block
             e.printStackTrace();
         } catch (TException e) {
             // TODO Auto-generated catch block
             e.printStackTrace();
         }
         return null;
     }

     Just a brief modification from what I am doing now. Basically I 
just envision a method called getFacetResults which returns List<Facet> 
with each Facet object containing a "name" and a "value" which would be 
the column name and facet count respectively. I'm just throwing this out 
there for now. This is a different way of implementing the facets than 
lucene in terms of how the code is accessed, but it would provide the 
same results.

     It could also be done something like this...

     List<Facet> facets = Arrays.asList(new Facet("field1"), new 
Facet("field2"));
     blurQuery.setFacets(facets, matches);

     Depends if the number of matches should be per facet or per query, 
although I see the merits in being able to specify the matches for each 
field.

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 5:20 AM, Aaron McCurry wrote:
> I have an issue in Jira to document facets in 0.2.1, it's not been worked
> yet but I hope I can get to it soon.  It looks like you figured out what is
> there.
>
> We will likely improve facets in 0.3.0 so the API will have to change a
> bit.  The biggest change we will need to make is the scenario that you
> bring up.  Facets in the current implementation case are simply other
> queries that can range from a single term to a complex query.  I'm assuming
> that you would like to specify a field name and get something like a map of
> terms to counts for the given facet?
>
> The field facetCounts are counts that each of the facets in the input list
> from the query.  So the count list corresponds one for one to the facet
> list in the Query.  I realize this is less than ideal and we can going to
> be improving it soon.
>
> If you have some suggestions on how you would want the facet api to
> operate, new features, or anything else for that matter just write up your
> thoughts on this thread and we can incorporate them into the task.
>
> Thanks!
>
> Aaron
>
>
>
> On Fri, Oct 18, 2013 at 6:43 AM, Colton McInroy <colton@dosarrest.com>wrote:
>
>> 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