function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Krishna_Krishna_ 

Find query


Hi to all,

 

I have created a visualforce page for SITES using CONTACT Object.


My visualforce page:


::::PAGE EDITOR:::::

 

<apex:page controller="theController">
   <apex:form >
      <apex:pageBlock mode="edit" id="block">
         <apex:pageBlockSection >
            <apex:pageBlockSectionItem >
               <apex:outputLabel for="searchText">Search Text</apex:outputLabel>
               <apex:panelGroup >
                  <apex:inputText id="searchText" value="{!searchText}"/>
                  <apex:commandButton value="Go!" action="{!doSearch}" status="status"/>
                                               </apex:panelGroup>
            </apex:pageBlockSectionItem>
        </apex:pageBlockSection>
        <apex:pageBlockSection title="Results" id="results">
           <apex:pageBlockTable value="{!results}" var="l" >
               <apex:column headervalue="Last Name" width="250">
                   <a href="/{!l.Id}">{!l.LastName }</a>
               </apex:column>
               <apex:column headervalue="Account Name" width="250">
                   <a href="/{!l.AccountId}">{!l.Account.Name}</a>
               </apex:column>
           </apex:pageBlockTable>
        </apex:pageBlockSection>
      </apex:pageBlock>
   </apex:form>
</apex:page>

 

 

:::::Controller:::::

 

public class theController
{

   String searchText;
   List<Contact> results;
   public String getSearchText()
   {
      return searchText;
   }
   public void setSearchText(String s)
   {
      searchText = s;
   }
   public List<Contact> getResults()
   {
      return results;
   }
   public PageReference doSearch()
   {
         results = (List<Contact>)[FIND :searchText RETURNING contact(id,LastName, AccountId,contact.Account.Name)][0];
         return null;
   }
}

 

I am using Find query....
that find query searches the Contact lastname only.....
My search defined as Contact Account Name..
How to change the Find query????
Pls help me.....

 

Thanks,

Krishna.