4

Hi i use below code for Getting people Search. Using below code I am able to search but getting only user name and User my site url.

I want all user profile Property.How I get all user Property using this code.Any change in Query?

   var quickSearchConfig = {
delay: 500,             // time to wait before executing the query (in ms)
minCharacters: 3,       // minimum nr of characters to enter before search
scope: "People",     // search scope to use
numberOfResults: 15,    // number of results to show
resultsAnimation: 200,  // animation time (in ms) of the search results
resultAnimation: 0      // animation time (in ms) of individual result (when selected)
};    

function search(query) {
   quickSearchSelectedDivIndex = -1;
   var queryXML = 
       "<QueryPacket xmlns='urn:Microsoft.Search.Query' Revision='1000'> \
       <Query domain='QDomain'> \
        <SupportedFormats><Format>urn:Microsoft.Search.Response.Document.Document</Format></SupportedFormats> \
        <Context> \
         <QueryText language='en-US' type='STRING' >SCOPE:\"" + quickSearchConfig.scope + "\"" + query + "</QueryText> \
        </Context> \
       <SortByProperties><SortByProperty name='Rank' direction='Descending' order='1'/></SortByProperties> \
        <Range><StartAt>1</StartAt><Count>" + quickSearchConfig.numberOfResults + "</Count></Range> \
        <EnableStemming>false</EnableStemming> \
        <TrimDuplicates>true</TrimDuplicates> \
        <IgnoreAllNoiseQuery>true</IgnoreAllNoiseQuery> \
        <ImplicitAndBehavior>true</ImplicitAndBehavior> \
        <IncludeRelevanceResults>true</IncludeRelevanceResults> \
        <IncludeSpecialTermResults>true</IncludeSpecialTermResults> \
        <IncludeHighConfidenceResults>true</IncludeHighConfidenceResults> \
       </Query></QueryPacket>";

   var soapEnv =
       "<soap:Envelope xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'> \
         <soap:Body> \
           <Query xmlns='urn:Microsoft.Search'> \
             <queryXml>" + escapeHTML(queryXML) + "</queryXml> \
           </Query> \
         </soap:Body> \
       </soap:Envelope>";
   $.ajax({
       url: "/_vti_bin/search.asmx",
       type: "POST",
       dataType: "xml",
       data: soapEnv,
       complete: processResult,
       contentType: "text/xml; charset=\"utf-8\""
   });       
   function processResult(xData, status) {
       $(xData.responseXML).find("QueryResult").each(function() {               
           var x = $("<xml>" + $(this).text() + "</xml>");
           x.find("Document").each(function() {
               var title = $("Title", $(this)).text();
               var url = $("Action>LinkUrl", $(this)).text();
               var description = $("Description", $(this)).text()
               alert($(this).text());

           });              

       });      

       );                                
   }            
   }

   function escapeHTML (str) {
  return str.replace(/&/g,'&amp;').replace(/</g,'&lt;').replace(/>/g,'&gt;');
   }    
  search('administrator'); 

3 Answers 3

3

You can call the User Profile Service with each account returned by search. Each Web Service focuses on different tasks and subsets of data and many times you must combine them to build applications.

Also consider using my SPServices jQuery library to make things easier. http://SPServices.codeplex.com

1

I found my solution there is problem in configuration of property

If u want to search custom property then u have to configure following Changes.

go to central admin > services > search service > menaged property >select your numeric field and edit it's propery

select those options

1)."Reduce storage requirements for text properties by using a hash for comparison"

2)."Allow this property to be used in scope"

after that must do full crawl

That's It.

0

xData.responseXML is the response from the webservice you recieve. from the below code

 var title = $("Title", $(this)).text();   
 var url = $("Action>LinkUrl", $(this)).text();          
 var description = $("Description", $(this)).text() 

here you are getting only title property ,LINKURL and Description Check other properties and include them in code

Thanks

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.