Re: NPE Issue with atomic update to nested document or child document through SolrJ

2020-09-17 Thread pratik@semandex
Following are the approaches I have tried so far and both results in NPE.



*approach 1

TestChildPOJO  testChildPOJO = new TestChildPOJO().cId( "c1_child1" )
  .conceptid( "c1" )
  .storeid( storeId )
  .fieldName(
"c1_child1_field_value1" )
  .startTime( Date.from(
now.minus( 10, ChronoUnit.DAYS ) ) )
  .integerField_iDF( 10
)
 
.booleanField_bDF(true);


TestPojo  pojo1  = new TestPojo().cId( "abcd" )
 .conceptid( "c1" )
 .storeid( storeId )
 .testChildPojos(
Collections.list( testChildPOJO, testChildPOJO2, testChildPOJO3 ) );

 

// index pojo1 with child testChildPOJO

SolrInputDocument sdoc = new SolrInputDocument();
sdoc.addField( "_route_", pojo1.cId() );
sdoc.addField( "id", testChildPOJO.cId() );
sdoc.addField( "conceptid", testChildPOJO.conceptid() );
sdoc.addField( "storeid", testChildPOJO.cId() );
sdoc.setField( "fieldName", java.util.Collections.singletonMap("set",
Collections.list(testChildPOJO.fieldName() + postfix) ) );  // modify field
"fieldName"

collection.client.add( sdoc );  
// results in NPE!

*approach 1


*approach 2

SolrInputDocument sdoc = new SolrInputDocument(  );
sdoc.addField( "id", testChildPOJO.id() );
sdoc.setField( "fieldName",
java.util.Collections.singletonMap("set", testChildPOJO.fieldName() +
postfix) );
final UpdateRequest req = new UpdateRequest();
req.withRoute( pojo1.id() );
req.add(sdoc);
   
collection.client.request( req, collection.getCollectionName()
);
req.commit( collection.client, collection.getCollectionName());


*approach 2




--
Sent from: https://lucene.472066.n3.nabble.com/Solr-User-f472068.html


Re: Bug in scoreNodes function of streaming expressions?

2020-01-28 Thread pratik@semandex
Joel Bernstein wrote
> Ok, that sounds like a bug. I can create a ticket for this.
> 
> On Mon, Jul 1, 2019 at 5:57 PM Pratik Patel 

> pratik@

>  wrote:
> 
>> I think the problem was that my streaming expression was always returning
>> just one node. When I added more data so that I can have more than one
>> node, I started seeing the result.
>>
>> On Mon, Jul 1, 2019 at 11:21 AM Pratik Patel 

> pratik@

>  wrote:
>>
>>> Hello Everyone,
>>>
>>> I am trying to execute following streaming expression with "scoreNodes"
>>> function in it. This is taken from the documentation.
>>>
>>> scoreNodes(top(n="50",
>>>sort="count(*) desc",
>>>nodes(baskets,
>>>  random(baskets, q="productID:ABC",
>>> fl="basketID", rows="500"),
>>>  walk="basketID->basketID",
>>>  fq="-productID:ABC",
>>>  gather="productID",
>>>  count(*
>>>
>>> I have ensured that I have the collection and data present for it.
>>> Upon executing this, I am getting an error message as follows.
>>>
>>> "No collection param specified on request and no default collection has
>>> been set: []"
>>>
>>> Upon digging into the source code I found that there is a possible bug
>>> in
>>> ScoreNodesStream.java
>>>
>>> StringBuilder instance is never appended any string and the block which
>>> initializes collection, needs the length of that instance to be more
>>> than
>>> zero. This condition will always be false and hence the collection will
>>> never be set.
>>>
>>> I checked this file in solr version 8.1 and that also has the same
>>> issue.
>>> Is there any JIRA open for this or any patch available?
>>>
>>> [image: image.png]
>>>
>>> Thanks,
>>> Pratik
>>>
>>


Hi Joel,

You mentioned creating a ticket for this bug, I can't find any, was it
created? If not then I can create one. Currently, ScoreNodes has two issues.

1. It fails when result has only one node.
2. It triggers a GET request instead of POST. GET fails if number of nodes
is large.

I have been using a custom class as workaround for #2, it would be good to
use the original SolrJ class.

Thanks,
Pratik



--
Sent from: https://lucene.472066.n3.nabble.com/Solr-User-f472068.html


Re: Issues with the handling of NULLs in Streaming Expressions

2019-11-14 Thread pratik@semandex
I am facing exactly the same issue right now. There is no way to check if a
particular field is not present in tuple or is null.

Was there any development related to this issue? Is there a work around?

In my case, I have an incoming stream of tuples and I want to filter out all
the tuples which do not have certain field set, so I was thinking of
"having" function like this.

having( seed_expr, not(eq(fieldA,null) )

this would result in stream of tuples which definitely have fieldA set and I
can do some operation on it.

Problem is that "eq" evaluator fails with null value. 

Is there a related JIRA that I can track?

@Joel is there any way/ workaround  to achieve this? i.e. to know whether
certain field is null or not? 


Thanks and Regards,
Pratik



--
Sent from: https://lucene.472066.n3.nabble.com/Solr-User-f472068.html