Hi,
I am using SEARCH API to perform text search in my application developed
using Google AppEngine (Platform: JAVA). I am facing problems with the
cursor.
Initially I won't have the cursor string and so by using following codes I
am able to get first set of records that I needed along with the cursor
string.
*Code:*
query = Query.newBuilder()
.setOptions( QueryOptions.newBuilder().setLimit( limit
).setCursor( Cursor.newBuilder().build() ).build() )
.build( queryString );
searchResults = getIndex( accountPin ).search( query );
nextCursor = searchResults.getCursor().toWebSafeString();
*Result Cursor (nextCursor):*
false:CqADCuUBCswB9wUnngv/////c35zdGFnaW4tY21zAP//AIuSX19mdHNfXwD//wCiYXBwZW5naW5lAP//AIyLkmluZGV4AP//AKJNUDUwVlYA//8AjIuSZG9jX2lkAP//AKI4UUk3NDQA//8AjIA4UUk3NDQA//8AAP8B//6MgYyLnpiWkdKckoz/AHRtoKCZi4ygoP8AXZ6Pj5qRmJaRmv8Ac3RtlpGbmof/AF2yr8rPqan/AHN0bZuQnKCWm/8AXceutsjLy/8Ac3/HrrbIy8v/AP/+EAohwwIDw+6dfww5AAAAAPRh2PpIARINRG9jdW1lbnRJbmRleBqfAShBTkQgKElTICJjdXN0b21lcl9uYW1lIiAiYXBwZW5naW5lIikgKElTICJncm91cF9uYW1lIiAic35zdGFnaW4tY21zIikgKElTICJuYW1lc3BhY2UiICIiKSAoSVMgImluZGV4X25hbWUiICJNUDUwVlYiKSAoT1IgKFFUICJ0ZXN0IikgKElTICJfX2dhdG9tX18iICJ0ZXN0IikpKUoFCABA6Ac=
Is the result cursor which I showed above is a *websafestring*? I don't
think so.
If it is a *websafestring, *I should be able to put as parameter in URL and
get the subsequent records.
For the subsequent requests, I will use the following query.
*CODE:*
query = Query
.newBuilder()
.setOptions(
QueryOptions.newBuilder().setLimit( limit ).setCursor(
Cursor.newBuilder().build( nextCursor ) ).build() )
.build( queryType + queryString );
But when I try with the cursor what I have showed, its giving me an
exception.
*SAMPLE URL:* http://example.appspot.com/?queryType=all&queryString=**
test&limit=10&cursor=false:**CqADCuUBCswB9wUnngv/////**c35zdGFnaW4tY21zAP//*
*AIuSX19mdHNfXwD//**wCiYXBwZW5naW5lAP//**AIyLkmluZGV4AP//AKJNUDUwVlYA//**
8AjIuSZG9jX2lkAP//**AKI4UUk3NDQA//8AjIA4UUk3NDQA//**
8AAP8B//6MgYyLnpiWkdKckoz/**AHRtoKCZi4ygoP8AXZ6Pj5qRmJaRmv**
8Ac3RtlpGbmof/AF2yr8rPqan/**AHN0bZuQnKCWm/8AXceutsjLy/**8Ac3/HrrbIy8v/AP/<http://29.stagin-cms.appspot.com/services/data/v1.0/objects/search/?apikey=MP50VV&queryType=all&queryString=test&limit=10&cursor=false:CqADCuUBCswB9wUnngv/////c35zdGFnaW4tY21zAP//AIuSX19mdHNfXwD//wCiYXBwZW5naW5lAP//AIyLkmluZGV4AP//AKJNUDUwVlYA//8AjIuSZG9jX2lkAP//AKI4UUk3NDQA//8AjIA4UUk3NDQA//8AAP8B//6MgYyLnpiWkdKckoz/AHRtoKCZi4ygoP8AXZ6Pj5qRmJaRmv8Ac3RtlpGbmof/AF2yr8rPqan/AHN0bZuQnKCWm/8AXceutsjLy/8Ac3/HrrbIy8v/AP/>
EAohwwIDw
6dfww5AAAAAPRh2PpIARINRG9jdW1l**bnRJbmRleBqfAShBTkQgKElTICJjdX**
N0b21lcl9uYW1lIiAiYXBwZW5naW5l**IikgKElTICJncm91cF9uYW1lIiAic3**
5zdGFnaW4tY21zIikgKElTICJuYW1l**c3BhY2UiICIiKSAoSVMgImluZGV4X2**
5hbWUiICJNUDUwVlYiKSAoT1IgKFFU**ICJ0ZXN0IikgKElTICJfX2dhdG9tX1**
8iICJ0ZXN0IikpKUoFCABA6Ac=
*Exception:*
at com.google.appengine.api.**urlfetch.URLFetchServiceImpl.**conver
tApplicationException(**URLFetchServiceImpl.java:115)
at com.google.appengine.api.**urlfetch.URLFetchServiceImpl.**fetch(
URLFetchServiceImpl.**java:42)
at com.google.apphosting.utils.**security.urlfetch.**URLFetchServic
eStreamHandler$**Connection.fetchResponse(**URLFetchServiceStreamHandler.**
java:418)
at com.google.apphosting.utils.**security.urlfetch.**URLFetchServic
eStreamHandler$**Connection.getInputStream(**URLFetchServiceStreamHandler.**
java:297)*
*
*I have used URLEncoder and URLDecoder for the cursor string.....But that
will not work....Since it will replace '+' sign with empty space.*
*Please suggest me a solution to fix this problem.*
--
You received this message because you are subscribed to the Google Groups
"Google App Engine" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/google-appengine/-/w5LCFTLCWDoJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-appengine?hl=en.