sometimes old news is still a good news :) 
this is bloody excellent!

i kept missing this little gem:

" select * from Movie where ( thumbs containskey 'Ebert' ) and (  
thumbs['Ebert'] 
= 12 ) "

that is, you have to use the indexed key with containskey and then see if 
it has the desired value ... otherwise the index is not used 

perhaps would be good to add it to documentation :) ...


On Thursday, December 22, 2011 at 5:23:00 AM UTC+11, Lvc@ wrote:
>
> Yes.
>
> On 21 December 2011 18:51, Steven Tomer <[email protected] <javascript:>
> > wrote:
>
>> Is this change in the trunk?
>>
>>
>> On Wed, Dec 21, 2011 at 9:44 AM, Artem Orobets <[email protected] 
>> <javascript:>> wrote:
>>
>>> Hi,
>>>
>>> We've implemented indexing of embedded maps. 
>>> So, you can use following query:
>>>
>>>    - To create index by key:
>>>    CREATE INDEX indexForMap ON classWithMap (embeddedMap by key)
>>>    or
>>>    CREATE INDEX indexForMap ON classWithMap ( embeddedMap )
>>>    - To create index by value
>>>     CREATE INDEX indexForMap ON classWithMap (embeddedMap by value) 
>>>    
>>> This indexes also take part in query optimization.
>>>
>>> Unfortunately, index can't be applied to "[]" operator, because it needs 
>>> wide and deep changes in parser design, thus it can't be delivered in short 
>>> term.
>>> But you can use following way:
>>>
>>> CREATE INDEX indexForMap ON Movie (thums  by key) UNIQUE
>>>
>>> and then use following select query:
>>> select * from Movie where ( thums containskey 'Ebert' ) and (  
>>> thums['Ebert'] 
>>> = 12 )
>>>
>>> Query executor optimize this query in following way 
>>>
>>>    1. Fetching thumbs with such key from index 
>>>    2. Applying filter to this thumbs. 
>>>    
>>>
>>> Full description of this syntax will be described at wiki soon.
>>>
>>>
>>> 2011/12/9 Luca Garulli <[email protected] <javascript:>>
>>>
>>>> Hi Steven,
>>>> course it's possible but it's at lower priority than other stuff. Can 
>>>> you open a new issue for it?
>>>>
>>>> Lvc@
>>>>
>>>>
>>>> On 7 December 2011 22:33, StevenTomer <[email protected] 
>>>> <javascript:>> wrote:
>>>>
>>>>> Can we create indexes that will efficiently index maps (both keys and
>>>>> values)?
>>>>>
>>>>> For an example of a use case, take the following:
>>>>>
>>>>> create class Movie
>>>>> create property Movie.title STRING
>>>>> create property Movie.thumbs EMBEDDEDMAP SHORT
>>>>>
>>>>> insert into movie (title, thumbs) values ('Chocolat', {'Ebert':
>>>>> 4,'Roeper':3})
>>>>> insert into movie (title, thumbs) values ('Taken', {'Ebert':3,'Roeper':
>>>>> 4})
>>>>> insert into movie (title, thumbs) values ('Star Trek', {'Ebert':
>>>>> 3,'Roeper':2})
>>>>> insert into movie (title, thumbs) values ('Gone With the Wind',
>>>>> {'Ebert':4})
>>>>> insert into movie (title, thumbs) values ('Dark Knight', {'Roeper':4})
>>>>>
>>>>> (Let's say there are 1 million movies, and we have many other
>>>>> reviewers as well.)
>>>>>
>>>>> I'd like to efficiently do the following types of queries:
>>>>>
>>>>> select from movie where thumbs containskey "Ebert"
>>>>> select from movie where thumbs[Roeper] = 4
>>>>>
>>>>> Without an index, these queries are terribly slow.
>>>>>
>>>>> Steve
>>>>>
>>>>
>>>>
>>>
>>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"OrientDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to