Re: Query requires iterating over all vertices


Boxuan Li
 
Edited

The difference between “text” and “string” is explained here: https://docs.janusgraph.org/index-backend/text-search/
 
In short, “text” is for full-text search (tokenized search) capability while “string” is for whole string match. You can also take a look at https://codecurated.com/blog/elasticsearch-text-vs-keyword which explains Elasticsearch’s Text (corresponding to “text” in JanusGraph), and Keyword (corresponding to “string” in JanusGraph). The same applies to Lucene.
 
Speaking of your use case, has(“country”) is interpreted as a “TraversalFilter” step in Gremlin, different from has(“country”, “value”) which is interpreted as a “GraphStep”. JanusGraph only applied indexes when it saw a “GraphStep”. Starting from 0.6.0 (unreleased yet), indexes are also applied for “has(key)” steps. This is just FYI.
 
Best,
Boxuan


On Jul 24, 2021, at 2:23 AM, Laura Morales <lauretas@...> wrote:
Looks like this is because you are indexing your property as text. See https://docs.janusgraph.org/index-backend/text-search/#full-text-search_1

I believe the query has(“country", P.neq(null)) would work when you build your index as follows:

   addKey(country, Mapping.STRING.asParameter()).buildMixedIndex("search”)


or using Mapping.TEXTSTRING.

Moreover, if you try the unreleased version (on GitHub master branch), even your original query and setup should work.


Thank you so much! I was using the newest release, but compiling the lastest source (from main branch) did indeed fix the problem. Or at least I think it has, since I don't get any more warnings.
On the other hand I'm absolutely confused and I don't know what I'm doing. I'm new with Janus, and the process of creating these indexes seems overly complex. What's the difference between "text" and "string"? And why wasn't it working with the previous release?





Join janusgraph-users@lists.lfaidata.foundation to automatically receive all group messages.