incubator-blur-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Aaron McCurry <amccu...@gmail.com>
Subject Re: Querying a record while it's in memory
Date Sat, 12 Oct 2013 12:21:09 GMT
Colton,

I'm I haven't responded, I missed your follow up email.


On Wed, Oct 9, 2013 at 1:57 PM, Colton McInroy <colton@dosarrest.com> wrote:

> Hmm... I was thinking about this, and if I am going to have to include
> components of lucene anyway, why not just use MemoryIndex directly? This
> shouldn't be a problem for me to do in my situation, so I am starting on
> that code right now. This way I will create a MemoryIndex at the same time
> I create a record. I will pass the record into a queue to be written to
> Blur, and the MemoryIndex over to my analyzer engine which checks the
> memoryindex. This will probably use a bit more memory because I have to
> create two objects with the same info, but it should provide me with the
> functionality I am looking for right now.
>
> It would be nice though if an individual record could have a query method
> so that you could query it directly though. Something like...
>
> ||Iface client = BlurClient.getClient("**controller1:40010,controller2:**
> 40010");
>
> |Query query = new Query();
> query.setQuery("field1:value")**;
>
> BlurQuery blurQuery = new BlurQuery();
> blurQuery.setQuery(query);
>
> Record newrec = new Record();|
> ||newrec.setRecordId("**recordid1");
> newrec.setFamily("fam0");|
> newrec.addToColumns(new Column("field1", "value"));
> ||newrec.addToColumns(new Column("field2", "value"));|
>
> if (newrec.query(blurQuery)) {
>         System.out.println("Match found");
> } else {
>         System.out.println("No match found");
> }
> |List  recordMutations = new ArrayList();
>     recordMutations.add(new RecordMutation(**RecordMutationType.REPLACE_**ENTIRE_RECORD,
> newrec));
>
> RowMutation mutation = new RowMutation("table1", "rowid1", true,
> RowMutationType.REPLACE_ROW, recordMutations, false);
> mutation.setRecordMutations(**recordMutations);
>     client.mutate(mutation);|
>
>
> This would make it nice and easy to query the record and do things with it
> on the fly... like for instance determining if you want to do the mutation
> call or not.


Interesting.  I hadn't thought of that use case before.  While I'm not sure
that it belongs with the core thrift code, there's nothing stopping you (or
someone) from extending the thrift classes and adding on methods like you
are suggesting.  If there is enough of a need could start another package
in blur-core for the extended versions.

As for the other email with sample code.  Do you need me to create an
indexing example or no?  It kinda looks like you got it working, but that
might just be pseudo code.  Let me know.

Aaron


>
>
> 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/8/2013 7:17 PM, Aaron McCurry wrote:
>
>> On Tue, Oct 8, 2013 at 4:30 PM, Colton McInroy <colton@dosarrest.com>
>> wrote:
>>
>>  Hmm... I've been trying to do this without any luck so far.
>>>
>>> I cannot find where the objects Field, and Analyzer are declared... I
>>> tried adding all of the blur libs as well as lucene analyzer common,
>>> queries, and queryparser.
>>>
>>>  The Field class is a Lucene class, as well as the Analyzer class.  The
>> FieldManager class is in the blur-query project, and the TableContext is
>> in
>> the blur-core project.
>>
>>
>>  Can you perhaps ellaborate a bit more on how to accomplish searching a
>>> single record in memory.
>>>
>>
>> I will see if I can come up with an example of something simple sometime
>> tomorrow.
>>
>> Thanks,
>> Aaron
>>
>>
>>
>>> 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/4/2013 5:04 AM, Aaron McCurry wrote:
>>>
>>>  Are you talking the MemoryIndex in Lucene?  If so, no Blur doesn't have
>>>> anything like that built in.  However you could use the Analyzer and
>>>> FieldManager from Blur to help create a similar behavior.
>>>>
>>>> TableContext context = TableContext.create(****TableDescriptor);
>>>> FieldManager fieldManager = context.getFieldManager();
>>>> List<Field> fields = fieldManager.getField(rowid,****record);
>>>> Analyzer analyzerForWriter =  fieldManager.****getAnalyzerForIndex();
>>>> Analyzer analyzerForQuery =  fieldManager.****getAnalyzerForQuery();
>>>>
>>>>
>>>> Aaron
>>>>
>>>>
>>>>
>>>> On Thu, Oct 3, 2013 at 9:58 AM, Colton McInroy <colton@dosarrest.com>
>>>> wrote:
>>>>
>>>>   Hello,
>>>>
>>>>>       I am wondering if it is possible to run a query against a single
>>>>> record stored in memory? and if so can you give me an example? While
>>>>> parsing and entering log entries into Blur, I would like to be able to
>>>>> pass
>>>>> that record over to a thread which analyzes the record with a query
>>>>> which
>>>>> may trigger some kind of action. I used to be able to do this with
>>>>> lucene... hmm... I was going to provide some example code, but I cannot
>>>>> seem to find it.
>>>>>
>>>>> --
>>>>> 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
>>>>>
>>>>>
>>>>>
>>>>>
>

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