Quantcast
Viewing all articles
Browse latest Browse all 4979

UserSearchManager doesnot return right result.

Hi , I am using the following code to retrieve other users information using UserSearchManager.

 

UserSearchManager search = new UserSearchManager(mXMPPConnection);

  Form searchForm = null;

  services = search.getSearchServices();

  if (services.isEmpty()) {

  Log.i(DEBUG_LOG , "No search services available");

  }

   else
   {

  Log.i(DEBUG_LOG , "Services Available : " + services.size());

   for (String elem : services) {

  System.out.println("Service = " + elem);

  }

// Service show vjud is available.

  }

 

 

  searchForm = search.getSearchForm("vjud." + mXMPPConnection.getServiceName());

  List<FormField> flist = searchForm.getFields();

  Form answerForm = searchForm.createAnswerForm();

   answerForm.setAnswer("user", "achuk");

   ReportedData data = search.getSearchResults(answerForm,"vjud."+con.getServiceName());

   if (data.getRows() != null) {

  List<ReportedData.Row> it = data.getRows();

  Log.i(DEBUG_LOG , "Rows size : " + it.size() + " : " + data.getTitle());

   for(ReportedData.Row r1 :it)

  {

  Log.i(DEBUG_LOG , "ROw is " + r1.getValues("jid").toString());

  }

   return true;

  }

   else
   {

  Log.i(DEBUG_LOG , "Result is Empty");

  }

   return false;

}

 

Now If I search someone that is within my roster then it returns right user. But when i search someone which is an existing user but not in my roster list then it returns null(or result rows = 0).

 

any solutions ?

Flow , csh , matt , stizzo

Image may be NSFW.
Clik here to view.

Viewing all articles
Browse latest Browse all 4979

Trending Articles