[ 
https://issues.apache.org/jira/browse/SOLR-11214?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16932404#comment-16932404
 ] 

Erick Erickson edited comment on SOLR-11214 at 9/18/19 1:04 PM:
----------------------------------------------------------------

[~varunthacker] You put some of the checking in for this, and it's restricted 
to points-based and string types. Is there any specific reason that Trie (and 
anything Numeric) isn't supported or is it just a case that we should check for 
that too. The code is in
{code:java}
GraphQueryParser.validateFields {code}
In fact, do we even care about what type the field is if it has docValues? 
SortableTextField would be rather weird to support, but would it work?

And is there a reason why the test for Point fields does not include whether 
it's indexed, while the test for string fields does?
{code}
public void validateFields(String field) throws SyntaxError {
    if (req.getSchema().getField(field) == null) {
      throw new SyntaxError("field " + field + " not defined in schema");
    }

    if (req.getSchema().getField(field).getType().isPointField()) {
      if (req.getSchema().getField(field).hasDocValues()) {
        return;
      } else {
        throw new SyntaxError("point field " + field + " must have 
docValues=true");
      }
    }
    if (req.getSchema().getField(field).getType() instanceof StrField) {
      if ((req.getSchema().getField(field).hasDocValues() || 
req.getSchema().getField(field).indexed())) {
        return;
      } else {
        throw new SyntaxError("string field " + field + " must have 
indexed=true or docValues=true");
      }
    }
    throw new SyntaxError("FieldType for field=" + field + " not supported");
  }
{code}

As you can tell, I haven't looked at much else but that check...


was (Author: erickerickson):
[~varunthacker] You put some of the checking in for this, and it's restricted 
to points-based and string types. Is there any specific reason that Trie (and 
anything Numeric) isn't supported or is it just a case that we should check for 
that too. The code is in
{code:java}
GraphQueryParser.validateFields {code}
In fact, do we even care about what type the field is if it has docValues? 
SortableTextField would be rather weird to support, but would it work?

As you can tell, I haven't looked at much else but that check...

> GraphQuery not working for TrieField's that has only docValues
> --------------------------------------------------------------
>
>                 Key: SOLR-11214
>                 URL: https://issues.apache.org/jira/browse/SOLR-11214
>             Project: Solr
>          Issue Type: Bug
>          Components: query parsers
>    Affects Versions: 6.6
>            Reporter: Karthik Ramachandran
>            Assignee: Karthik Ramachandran
>            Priority: Major
>
> Graph traversal is not working for TrieField's with only docValues since the 
> construction of leaf or parent node queries uses only TermQuery.
> \\ \\
> {code:xml|title=managed-schema|borderStyle=solid}
> <schema name="graph" version="1.6">
>     <field name="_version_" type="long" indexed="false" stored="false" 
> docValues="true" />
>     <field name="id" type="int" indexed="false" stored="false" 
> docValues="true" />
>     <field name="parentid" type="int" indexed="false" stored="false" 
> docValues="true" />
>     <field name="name" type="string" indexed="false" stored="false" 
> docValues="true" />
>     <uniqueKey>id</uniqueKey>
>     <fieldType name="string" class="solr.StrField" sortMissingLast="true" />
>     <fieldType name="int" class="solr.TrieIntField" docValues="true" 
> precisionStep="0" positionIncrementGap="0"/>
>     <fieldType name="long" class="solr.TrieLongField" docValues="true" 
> precisionStep="0" positionIncrementGap="0"/>
> </schema>
> {code}
> {code}
> curl -XPOST -H 'Content-Type: application/json' 
> 'http://localhost:8983/solr/graph/update' --data-binary ' {
>  "add" : { "doc" : { "id" : "1", "name" : "Root1" } },
>  "add" : { "doc" : { "id" : "2", "name" : "Root2" } },
>  "add" : { "doc" : { "id" : "3", "name" : "Root3" } },
>  "add" : { "doc" : { "id" : "11", "parentid" : "1", "name" : "Root1 Child1" } 
> },
>  "add" : { "doc" : { "id" : "12", "parentid" : "1", "name" : "Root1 Child2" } 
> },
>  "add" : { "doc" : { "id" : "13", "parentid" : "1", "name" : "Root1 Child3" } 
> },
>  "add" : { "doc" : { "id" : "21", "parentid" : "2", "name" : "Root2 Child1" } 
> },
>  "add" : { "doc" : { "id" : "22", "parentid" : "2", "name" : "Root2 Child2" } 
> },
>  "add" : { "doc" : { "id" : "121", "parentid" : "12", "name" : "Root12 
> Child1" } },
>  "add" : { "doc" : { "id" : "122", "parentid" : "12", "name" : "Root12 
> Child2" } },
>  "add" : { "doc" : { "id" : "131", "parentid" : "13", "name" : "Root13 
> Child1" } },
>  "commit" : {}
> }'
> {code}
> {code}
> http://localhost:8983/solr/graph/select?q=*:*&fq={!graph from=parentid 
> to=id}id:1
> or
> http://localhost:8983/solr/graph/select?q=*:*&fq={!graph from=id 
> to=parentid}id:122
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org

Reply via email to