help required using external index in retrieval | tinkerpop 3.0

80 просмотров
Перейти к первому непрочитанному сообщению

gaurav tiwari

не прочитано,
6 мар. 2016 г., 22:31:0006.03.2016
– Gremlin-users

Hello ,

Looks like Tinkerpop API does not use mixed elasticsearch index while retrieving data from titan. Though if we directly use titan API it does use mixed elasticsearch index.

e.g. I have created a mixed index on name.

When we use tinkerpop API : graph.iterator().V().has("name", "Apple"), it does not use mixed index on "name" and gives a warning log 'Query requires iterating over all vertices'.

With titan API it works fine and uses the mixed index on "name" as given below

titanGraph.query().has("name", "Apple").vertices()

What can be the reason of this?Please any one advise . We have requirement to use external index with tinkerpop3.0 stack.


Many Thanks in Advance 

gaurav tiwari

не прочитано,
7 мар. 2016 г., 02:51:5507.03.2016
– Gremlin-users
Update -
It works with titan APi in version 0.5.4 whereas when using the same query in Titan1.0 its not using index and giving the same index message

Query to be used  :- titanGraph.query().has("name", "Apple").vertices() 

Messge :WARN  com.thinkaurelius.titan.graphdb.transaction.StandardTitanTx  - Query requires iterating over all vertices [(user_sender_name = Apple )]. For better performance, use indexes .

Jason Plurad

не прочитано,
7 мар. 2016 г., 10:24:0207.03.2016
– Gremlin-users
Hi guarav,

Looks like we're doing double duty on this one...

Can you post the code where you created the mixed index? Did you create the vertex property name and the mixed index in the same schema management transaction?


-- Jason

gaurav tiwari

не прочитано,
7 мар. 2016 г., 11:03:3807.03.2016
– Gremlin-users
THanks Jason for looking in to this.
You can respond  in any one of these . my whole team is all out for figuring this out :) :)

Below code i am using for creating index

final PropertyKey name = mgmt.makePropertyKey("user_sender_name").dataType(String.class).make();
mgmt.buildIndex("user_sender_name_mixed_index", Vertex.class).addKey(name).buildMixedIndex("search"); 
mgmt.commit();

I am creating both key and index in same transaction . the same code works well in titan 0.5.4 but not in Titan 1.0 and using tinkerpop

Jason Plurad

не прочитано,
7 мар. 2016 г., 13:06:3407.03.2016
– Gremlin-users
Hi Gaurav,

First off, if you're doing exact string matches, it seems like a composite index would do fine.

You should review the Titan docs in Chapter 20. Index Parameters and Full-Text Search. When you addKey(name) without a mapping parameter, the mixed index for a String key will default to a full-text search -- addKey(name, Mapping.TEXT.asParameter()). There are a lot of gotchas listed in the documentation to consider with full-text search:
  • the string is tokenized into a bag of words which allows the user to efficiently query for all matches that contain one or multiple words.
  • Titan’s default tokenization splits the string on non-alphanumeric characters and removes any tokens with less than 2 characters.
  • only full-text search predicates are supported in graph queries by the indexing backend. [textContains, textContainsPrefix, textContainsRegex]
  • Full-text search is case-insensitive.
Your query is trying to do an equals comparison, so perhaps Mapping.STRING or Mapping.TEXTSTRING would be more appropriate.

I created a couple gists to compare the different versions. You can cut and paste these examples in to the Gremlin Console.

Titan 0.5.4 https://gist.github.com/pluradj/ff1e1b1bcea0753adbb1
Titan 1.0.0 https://gist.github.com/pluradj/9bf96f8eae9fa24f3d61

Note that this behavior hasn't changed between Titan 0.5.4 and 1.0.0, so I'm not sure why your example worked previously.


-- Jason

gaurav tiwari

не прочитано,
8 мар. 2016 г., 01:33:5808.03.2016
– Gremlin-users
Thanks a  lot ,

Is there any way to query full text search in case  insensitive data using tinkerpop3.0  .

Jason Plurad

не прочитано,
8 мар. 2016 г., 08:59:2608.03.2016
– Gremlin-users
Hi Gaurav,

This was covered in the original response. Check the fourth bullet point, and the Titan 1.0.0 gist shows examples of all text predicates.

-- Jason
Ответить всем
Отправить сообщение автору
Переслать
0 новых сообщений