Thanks Alex. A fix has been made and should roll out in 1.7.7.

On Thursday, March 21, 2013 9:11:00 PM UTC+11, alex wrote:
>
> I think there's a little bug in the search.put() of SDK 1.7.6.
> Maybe it's the desired behaviour but please correct me if I'm doing 
> something wrong here:
>
>
> The following seem to fail (where it shouldn't, I think) running SDK 1.7.6:
>
>   doc1 = search.Document(fields=[... valid search fields ...])  # i.e. no 
> doc_id provided
>   doc2 = search.Document(fields=[... valid search fields ...])  # i.e. no 
> doc_id provided
>
>   myidx = search.Index(name='myindex')
>   myidx.put([doc1, doc2])
>
>   >>> ValueError: Different documents with the same ID found in the same 
> call to Index.put()
>
>
> The following patch would fix the error but I'm not sure whether it breaks 
> something else:
>
> --- /a/google/appengine/api/search/search.py 2013-03-15 17:48:00.000000000 
> +0100
> +++ /b/google/appengine/api/search/search.py 2013-03-21 10:42:03.000000000 
> +0100
> @@ -2441,14 +2441,15 @@
>      seen_docs = {}
>      for document in docs:
>        doc_id = document.doc_id
> -      if doc_id in seen_docs:
> -        if document != seen_docs[doc_id]:
> -          raise ValueError('Different documents with the same ID found in 
> the '
> -                           'same call to Index.put()')
> +      if doc_id:
> +        if doc_id in seen_docs:
> +          if document != seen_docs[doc_id]:
> +            raise ValueError('Different documents with the same ID found 
> in the '
> +                             'same call to Index.put()')
>
>
> -        continue
> -      seen_docs[doc_id] = document
> +          continue
> +        seen_docs[doc_id] = document
>        doc_pb = params.add_document()
>        _CopyDocumentToProtocolBuffer(document, doc_pb)
>
> @@ -2460,7 +2461,7 @@
>
>      results = self._NewPutResultList(response)
>
> -    if response.status_size() != len(seen_docs):
> +    if response.status_size() != len(docs):
>        raise PutError('did not index requested number of documents', 
> results)
>
>
> I posted it on the issue tracker too:
> https://code.google.com/p/googleappengine/issues/detail?id=8553
>  

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-appengine?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to