Ouch, I was mistaken. The second query makes search only throough the aliases. I think that is a correct variant of the second query
SELECT EXPAND( $c ) LET $a = (select from (traverse * from (select in_language from Alias where name LUCENE 'fr_tord*') while $depth <=2) where @class='Location' order by name_en), $b = ( SELECT FROM Location where name_en LUCENE 'Minsk*' ), $c = UNIONALL( $a, $b ) But the main question is still not answered. Is there any way to make similar search without traversing? вторник, 17 июня 2014 г., 13:22:00 UTC+3 пользователь Vladimir Ziankevich написал: > > I have the next database schema: > > vertex type Location(properties: id, name) > vertex type Alias(properties: name) > edge type Language(properties: name) > > Each vertex of Location can have multiple edges with Aliases. > For example: > location(1,London) -> edge language(name='english') -> > alias(name='City of London') > -> edge > language(name='french') -> alias(name='Londres') > > There are about 600 000 locations and more than 1 000 000 aliases. I need > to implement fast search of locations through the location names and > aliases for typeahead. > I've applied Lucene indices both to Location.name and Alias.name and > expected to get appropriate locations list running query like: > > select from Location where name LUCENE 'Lon*' or out_language.in.name > LUCENE 'Lon*' limit=20 > something like that. > > But it does not work. This query returns all the locations from database. > > I've found another one query that works correctly > > select from > (traverse * from (select in_language from Alias where name LUCENE 'Lon*') > while $depth <=2) > where @class='Location' > > but I'm worried about the performance. > > Could someone offer me another variants? Or how to tune this one query. > Thanks in advance. > -- --- 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.
