Problem in user-specific search results

Hi All,
I have created an index which is indexing the docs properly. Now, I written a code to show user-specific docs using index management API's..
I have used an EP5 current user.
ISearchResultList results = session.getSearchResults(1,session.getNumberResultKeys());
In the following stmt, I am getting the proper value for session.getNumberResultKeys(), but still ISearchResultList size always is zero.
Is there anything I am missin in code or its a configuration problem??
I have full control permissions to index as well as to repository folder..Can someone plz get me out of this problem..Its urgent
Thanks & Regards,
Udit

Hi Udit,
I got the solution for the problem. Here is the code I am using and its working great. Just give a try
com.sapportals.portal.security.usermanagement.IUser user = null;
user = (com.sapportals.portal.security.usermanagement.IUser)request.getUser().getUser();
response.write("<html><head><title>Search</title></head><body>");
ResourceContext c = new ResourceContext(user);
try {
IIndexService indexService =
          (IIndexService) ResourceFactory
     .getInstance()
     .getServiceFactory()
     .getService(IServiceTypesConst.INDEX_SERVICE);
     SearchQueryListBuilder sqb = new SearchQueryListBuilder();
     sqb.setSearchTerm("valero");
     IQueryEntryList qel = sqb.buildSearchQueryList();
     // get an instance of federated search
IFederatedSearch federatedSearch =
          (IFederatedSearch) indexService.getObjectInstance(
          IWcmIndexConst.FEDERATED_SEARCH_INSTANCE);
     List indexList = new ArrayList();
     String index = null;
     if (index != null && index.length() > 0) {
     // take a specified index from index= parameter
     indexList.add(indexService.getIndex(index));
     } else {
     // take all available indexes
     indexList = indexService.getActiveIndexes();
     // it is recommended to use a search session object
     // for searching execution
     ISearchSession session = null;
     if (session == null)
     session = federatedSearch.searchWithSession(qel, indexList, c);
     this.renderResultHeader(response, session, indexList);
     // get all results from the search session
     ISearchResultList results =     session.getSearchResults(1, session.getTotalNumberResultKeys());
     response.write(" from session => " + results.size() + " and size is : " + results.toString());
Here it will print the size of the ISearchResultList, the problem is the user we are passing to ResourceContext is not proper.

Similar Messages

  • I need specific search results in iTunes search

    How do I restrict search in music titles?
    For example, I only want results with "Global Groove" in the Title of the album, yet when I search Global Groove, with or without the quotes, I get all kinds of other stuff.  I'm using iTunes 11.4
    Thanks, Vince

    I'm not sure if there is a way to access this directly within iTunes itself, but this link should open a 'power search' screen in the iTunes store :
    itms://phobos.apple.com/WebObjects/MZSearch.woa/wa/advancedSearch
    The left-hand side of that screen defaults to 'all results' but you can click on it and select Music so that it should give you a slightly different search screen specific to music - or this should take you straight to the music search screen :
    https://search.itunes.apple.com/WebObjects/MZSearch.woa/wa/advancedSearch?media= music#powerSearch&restrict=false&submit=…

  • Search result in CRM_KW

    Hi,
    we save documents on the content server from the document tab on BP. In transaction CRM_KW the documents can be search for by using attributes like keywords. The problem is that the search result in CRM_KW only presents 100 hits. Does anyone know where this is controlled and is there a way to get access to all documents matching a relevant key word.
    NB! We use CRM 4.0
    Best regards
    Annette

    In class CL_KWUI_QUERY, method DISPLAY -> Parameter MAX_NUMBER_OF_HITS

  • Search result Page throw Error for anonymous User

    We have claim base WebApplication in SharePoint 2013. Every thing is working fine and user can login site without any problem. Only search result page not working..its given "Sorry, something went wrong "
    From ULS Log I found below exception
    CoreResultsWebPart::OnInit: Exception initializing: System.InvalidOperationException: The security token request cannot be completed.    
     at Microsoft.SharePoint.SPSecurityContext.SecurityTokenForServiceContext(Uri contextUri)    
     at Microsoft.SharePoint.SPChannelFactoryOperations.InternalCreateChannelActingAsLoggedOnUser[TChannel](ChannelFactory`1 factory, EndpointAddress address, Uri via)    
     at Microsoft.Office.Server.Search.Administration.SearchServiceApplicationProxy.GetChannel(Uri address, Int32 timeoutInMilliseconds)    
     at Microsoft.Office.Server.Search.Administration.SearchServiceApplicationProxy.DoSpLoadBalancedUriWsOp[T](WebServiceBackedOperation`1 webServiceCall, Int32 timeoutInMilliseconds, Int32 wcfTimeoutInMilliseconds, String operationName)    
     at Microsoft.Office.Server.Search.Administration.SearchServiceApplicationProxy.DoWebServiceBackedOperation[T](String operationName, Int32 timeoutInMilliseconds, Int32 wcfTimeoutInMilliseconds, WebServiceBackedOperation`1 webServiceCall)    
     at Microsoft.Office.Server.Search.Administration.SearchServiceApplicationProxy.DoWebServiceBackedOperation[T](String operationName, WebServiceBackedOperation`1 webServiceCall)    
     at Microsoft.Office.Server.Search.Query.ConsumerScopeCache.Refresh(IEnumerable`1 sharedScopes)    
     at Microsoft.Office.Server.Search.Query.ConsumerScopeCache.EnsureFresh()    
     at Microsoft.Office.Server.Search.Query.ConsumerScopeCache.TryGetScope(Int32 id, ScopeInformation& scope)    
     at Microsoft.Office.Server.Search.Query.ScopeCache.TryGetScope(Guid siteGuid, Int32 id, ScopeInformation& scope)    
     at Microsoft.Office.Server.Search.WebControls.SearchCommon.GetScopeNameByScopeID(Guid siteGuid, Int32 scopeID)    
     at Microsoft.Office.Server.Search.WebControls.CoreResultsWebPart.SetPropertiesOnQueryReader()    
     at Microsoft.Office.Server.Search.WebControls.CoreResultsWebPart.OnInit(EventArgs e)
    We are using Arabic Language Pack SharePoint 2013 on Windows server 2012 with SQL Server 2012.
     anonymous access already given form Central Admin and Sitecollection level 
    Quick response will be highly Appreciated.

    Its need to be set  impersonate="true"
    <authentication mode="Forms">
        </authentication>
        <identity impersonate="true"
    />
    to resolve custom solution which need impersonate="false"
    Run command in evaluated privilege...

  • How to configure search results web part to display results only after a query is generated from user?

    Hi All,
    I am crawling documents from a file server. I created a new content source and crawled the documents. All documents are crawled successfully.
    Then I went to my enterprise search center site collection and created a new result source. I have added the query to use above content source.
    After that, on a page I am trying to configure the search results web part to display documents using this result source. Now the problem is:
    It displays all the documents that are crawled without searching for anything. I mean first it should not display any results. If a user searches for something , then according to that search it should display results.
    Any idea how to do this in the web part? I am using SharePoint 2013 on premise enterprise edition. No code. Totally OOTB.

    Hi Mohan,
    What did you use for the Query text in the result source?
    I could reproduce this issue when I used Query text like: {searchTerms} Path:”http://sps2k13sp/sites/First/Shared%20Documents”
    Then I changed the Query to
    {?{searchTerms}
    Path:"http://sps2k13sp/sites/First/Shared%20Documents"}
    , then Search result web part didn’t return results without searching.
    So , check your result source, and use the Query like the above(adding "{?...}").
    I hope this helps.
    Thanks,
    Wendy
    Wendy Li
    TechNet Community Support

  • User-defined variables in Search Results pane

    I am working with user-defined variables for WebHelp output.
    I have successfully added the variables to the topic, the displayed
    topic title, the TOC, and the Index entries. The problems lies in
    getting the search output to display the specified variable text.
    For example, the base topic title is "Introduction to XX". I
    use a variable to change the XX to YY throughout the project;
    however, when I generate the output and then Search for YY, the
    search results pane displays "Introduction to XX" even though the
    displayed topic is titled, correctly, "Introduction to YY". I am
    assuming, because the topic title is not adhering to the variables,
    that the search results displays the metadata <title>.
    What should I do so the search results title syncs with the
    other data?
    Carol

    Welcome to the forum.
    There have been two posts about this recently so do a search
    for more information.
    Basically the search results show the Topic Title as defined
    in Topic Properties. Your variable is in the Topic Heading at the
    top of the page. Not the same thing.
    I suggest you request a feature change.
    http://www.adobe.com/cfusion/mmform/index.cfm?name=wishform

  • CRM Search Results Problem

    Hello ,
    I am facing one problem from past 3 days. in my SAP CRM System one user  can not see search results in CRP100 Inbox Search. CRM - Inbox search shows "no results found" when other users doing the same search get 17 pages of results.
    Please give me the desirable solution for my problem.
    Thanks in advance

    Hi Raju,
    In inbox search criteria, please clear all the search fields. Also check the Quick Search fields too. If still its not coming then it is a authorization issue. Check with your security consultant.
    You also can check it from ST01 transaction. It is same as ST05 SQL trace.
    Thanks
    Subhankar

  • Problem in retrieving search result

    Hi Experts,
    I wrote Java Application for Search Using Index Management APIs.
    I am not getting any result.
    Just look at my code
    <b>i have taken some Variable String x="" to test my code</b>
    IIndexService indexService =
          (IIndexService)ResourceFactory.getInstance().getServiceFactory().getService("IndexmanagementService");
          <b> x=x+ "1"+ indexService.getID();</b>
           IFederatedSearch federatedSearch =
      (IFederatedSearch)indexService.getObjectInstance("federatedSearchInstance");
    //  get list of all active indexes
    //alternatively use the indexService to get indexes by index ID and add them to a list
          List listuser=indexService.getActiveIndexes();
          <b>x=x+ "  2  " + listuser.size();</b>
    //  build IQueryEntryList
          SearchQueryListBuilder sqb = new SearchQueryListBuilder();
      sqb.setSearchTerm(query);
      IQueryEntryList qel = sqb.buildSearchQueryList(); 
      <b> x=x+ "  3  " + qel.size();</b>     
    //search
      ISearchSession  session = federatedSearch.searchWithSession(qel, listuser,resourseContext);
          <b> x= x + "  4  " + session.getTotalNumberResultKeys();</b>   
          //get the Results
      ISearchResultList results = session.getSearchResults(1,session.getTotalNumberResultKeys());
       ISearchResultListIterator iter = results.listIterator();
          <b> x= x " 5  " results.size();</b> 
               while (iter.hasNext())
             ISearchResult result = iter.next();
         IResource resource = result.getResource();
           IURLGeneratorService url =
          (IURLGeneratorService)ResourceFactory.getInstance     ().getServiceFactory().getService(IServiceTypesConst.URLGENERATOR_SERVICE);
            uri=uri + url.getResourcePageUri(PathKey.CONTENT_ACCESS_PATH,resource.getAccessRID(),null).toString();
              <b> x=x+"  6  ";</b>     
              <b> x=x+ "  7  "+uri.length();</b>}
    return x;
    The output what i am getting is....
    For this line <b> session.getTotalNumberResultKeys(); </b> i am getting output as 1 (one).
    Means there is one result.
    I am retrieving the results and storing it in 'results' list object
    like this
    ISearchResultList results = session.getSearchResults(1,session.getTotalNumberResultKeys());
    When i say results.size() i am getting 0 as output.
    What is this strange behaviour....?
    Total results are 1(one)
    When i try to retrieve them it says 0(zero) results.
    When i perform normal search in protal there also i am getting only one result(when i search * as a search query).
    the same i am doing it here.But  i am not able to retrieve the result.
    To test this application , i am converting this java Class into Webservice and deploying it in searver.
    The reason why i am converting it into webservice is , it will be used other portal i.e Sharepoint Portal.(They will call this webservice in their code)
    Why is it happening so.
    Any one has ideas , where it is going wrong.
    Regards
    Bala

    HI Udit,
    Yes i got the answer to it.
    In my case the prblem was with the user credentilas.
    When i run the same application from WebDynpro, it was working fine, meanse result list and result keys was same.
    But when i run it as java application, i had the problem which you had.
    So what i did is, I have checked which user it is taking in WebDynpro and which user it is taking in my java Application. Surprisingly it was different.
    So tried with the same user, which it is taking in WebDynpro.
    generally by default it takes <b>Guest</b>  user in WebDynpro.
    So first try this application from webdynpro, if it works fine there.
    Take the same user name and pass it from your java application.
    It is the problem with user name only.
    any way i am sending you my code , have look at it.
    public class SearchJavaClass {
         String uri = "";
         //LinkedList list1 = new LinkedList();
         //public String Go(String query) {
         public List Go(String query) {
              String var =null;
              List SearchURL= new ArrayList();
              int i=0;
              //x=x+"i am in Go";
    //          com.sap.security.api.IUser nwUser =
    //               UMFactory.getAuthenticator().getLoggedInUser();
              com.sap.security.api.IUser nwUser = null;
              try {
                   //com.sap.security.api.IUser nwUser1 = UMFactory.getUserFactory().getUser("Guest");
                   //x = x + "nwUser1: "+nwUser1.getName();
                   nwUser = UMFactory.getUserFactory().getUserByLogonID("Guest");
              } catch (UMException e1) {
                   // TODO Auto-generated catch block
                   e1.printStackTrace();
              try {
                   // Bala start
                   com.sapportals.portal.security.usermanagement.IUser ep5User =
                        WPUMFactory.getUserFactory().getEP5User(nwUser);
                   ResourceContext resourseContext = new ResourceContext(ep5User);
                   IIndexService indexService =
                        (IIndexService) ResourceFactory
                             .getInstance()
                             .getServiceFactory()
                             .getService(
                             "IndexmanagementService");
                   IFederatedSearch federatedSearch =
                        (IFederatedSearch) indexService.getObjectInstance(
                             "federatedSearchInstance");
                   List listuser = indexService.getActiveIndexes();
                   SearchQueryListBuilder sqb = new SearchQueryListBuilder();
                   sqb.setSearchTerm(query);
                   IQueryEntryList qel = sqb.buildSearchQueryList();
                   ISearchSession session =
                        federatedSearch.searchWithSession(
                             qel,
                             listuser,
                             resourseContext);
                   ISearchResultList results =
                        session.getSearchResults(1, session.getTotalNumberResultKeys());
                   ISearchResultListIterator iter = results.listIterator();
                   //String uri = "";
                   //ArrayList al= new ArrayList();
                   //al.add(uri);
                        //var="";     
                   while (iter.hasNext()) {
                        var ="";
                   //     SearchVO searchvo = new SearchVO();
                        ISearchResult result = iter.next();
                        IResource resource = result.getResource();
                        IURLGeneratorService url =
                             (IURLGeneratorService) ResourceFactory
                                  .getInstance()
                                  .getServiceFactory()
                                  .getService(IServiceTypesConst.URLGENERATOR_SERVICE);
                        uri =
                             url
                                  .getResourcePageUri(
                                       PathKey.CONTENT_ACCESS_PATH,
                                        resource.getAccessRID(),
                                       null)
                                   .toString();
                        com.sapportals.wcm.util.uri.IUriReference uri9=url.getResourcePageUri(PathKey.DETAILS_PAGE, resource.getAccessRID(),null);
                        //@@@@@@@@@com.sapportals.wcm.util.uri.IUriReference uri99 =uri9.appendPath(uri);                    
                        IHierarchicalUri uri7  = url.createAbsoluteUri(uri9);
                           var = uri7.toString();
                           //searchvo.setIHierarchicalUri(uri7);
    //                       SearchURL.add(i,uri7);
                        SearchURL.add(i,var);
                        var="";
                           i++;
    //                     var = var"   "uri7;
              // Bala end     
              } catch (ResourceException e) {
                   // TODO Auto-generated catch block
                   e.printStackTrace();
              } catch (UserManagementException e) {
                   // TODO Auto-generated catch block
                   e.printStackTrace();
              } catch (WcmException e) {
                   // TODO Auto-generated catch block
                   e.printStackTrace();
              } catch (Exception e) {
                   // TODO Auto-generated catch block
                   e.printStackTrace();
              } finally {
    //               if(SearchURL.isEmpty())
    //               return SearchURL ;//+ " No matches have been found";
    //               else
    //               //return var;
                   return SearchURL;
         public static void main(String[] args) {
              SearchJavaClass obj = new SearchJavaClass();
              obj.Go(" Search Term");
    Regards
    Bala

  • Incluiding specific shared calendars in Busy Search results

    I have a staff member who would like to have some specific shared calendar(s) included in busy search results for him. He uses two calendars to keep track of his own schedule. Is there a way for GroupWise 2012SP2 to accommodate this?
    I can understand that it would be a bad idea to have busy search automatically included in busy search results. Obviously, there will be shared calendars that don't correspond to your schedule but I also see his point in wanting more than one calendar for his schedule.
    If it is not possible in the current version or 2014 does anyone know if it is on the roadmap? I didn't see it on the general one.
    Thanks.
    -Nyle

    I have put this in as an enhancement request. We understand that if you check the sub-calendar it will show in your main calendar and then be part of the busy search results for that mailbox. The user wants to be able to always have specific folders used in their busy search results even if they decide to uncheck that calendar from showing in their main calendar.
    I don't think I explained that well enough. The enhancement request that I put in was to put a checkbox property on each sub-calendar to allow it to be included in busy search results even if the user doesn't have it showing in their main calendar when someone does a busy search on their mailbox.
    -Nyle

  • Restrict F4 search results for specific plants / sales org / purchasing org

    Hello All,
    We have a project where a particular plant / sales org / purchasing org needs to be restricted because of the top secret data for that business.  We would like to be able to restrict the search results that are displayed based on sales org / plant / purchasing org in the F4 help.  If a user does not have access to the data / documents related a plant / sales org / purchasing org, we do not want the user to be able to see doc numbers, ship-to's, material numbers etc... My question is where do we restrict F4 results for the Sales and Distribution, Finance, Materials Management, Production Planning, Logistics, etc... modules?  Thanks in advance for the help.
    Jordan

    We can set authorization for specific plants and other organization levels,contact the basis team and discuss about the authorization

  • The way SharePoint open office documents will differ if the user try to open them from the document library directly, or if users try to open the document from the search result page.

    I have a document library where I have uploaded an excel sheet to it. Now If I click on the excel sheet directly from the document library page , I will get the following error ““The webpage cannot be displayed””. While if I do a search and I open the excel
    sheet from the search result page , it will open the excel sheet using the excel services inside the browser !!.
    So can anyone advice on this ?
    Also if I have a PowerPoint document , and I try to open it from the document library I will get the following error “The webpage cannot be displayed” , and the URL will be prefix with the following “ms-powerpoint:ofv|u|”. while if i do a search and i open
    the PowerPoint from the search result page i will be prompted to either open or save the document ? So why SharePoint is reacting totally different when trying to open document library items from the document library Or from the search result page?

    Hi,
    The behavior in the document library could be probably because of the Documents handling setting. Please try setting it to default behavior (Open in browser) as i hear from you that the default behavior is to open from browser.
    Thanks, Suneetha
    Currently I have set the following;-
    1. On the library advance setting :- I define  “Open in the client application”
    2. On the web application setting:- I define stricked for Browser File Handling
    And I have noted if I delete the browser cache and I access the document , then I will be prompted with the download dialog. but if I re-click on the same document I will be redirected to the
    The webpage cannot be displayed
    And the ms-powerpoint:ofv|u| will be added to the beginning of the URL. So could this be a caching problem ?

  • Search Preview, Open Search Result, Authentication, Security Trimming Users - Domain

    hi all
    Good morning. I hope someone can direct me in the right path.
    Server Setup 1 - SharePoint 2013 (using as search engine - fileserver)
    SharePoint 2013 Foundation - Latest Patches with HTTP
    Windows Server 2012
    Server Setup 2 - Office Web Apps 2013
    Office Web Apps - Latest Patches with HTTP
    Windows Server 2012
    Issues that I am facing - Search preview
    a. I have configure SP2013 as a search for my file server. I get all the searches but I cannot preview them. I have configured the Office Web Apps 2013 and can successfully see the XML file in various TechNet article's. No event errors.  I have ran
    various PowerShell commands, to see if SP connects with Office Web Apps and it connects. This is all Internal network and so I have used HTTP.
    Issues that I am facing - Open Search Result
    b. I have faced this when search a document, I tried to click on OPEN and nothing happens. The document doesn't open and no errors. However, if I send the document to a user, the path opens it directly.
    Issues that I am facing - Authentication
    c. I would like to provide our users the opportunity to search without entering username and password on a domain computer but required on a non-domain joined computers. Can this be done?
    Issues that I am facing - Security Trimming - File Share
    d. I have a file share with Access Based Enumeration enabled. Some users are given access and some others no access to view certain folders and files. Will this reflect the searches ?. I have set a READ-ONLY access account to the complete fileShare. Does
    the searches appear to those who have access and doesn't appear to those who don't have.
    I am willing to learn and so I ask some guidance where I have gone wrong with the setup.
    Thanks in advance for all the help.
    Cheers
    Jo

    Hi Jo,
    #1. Per my knowledge, the files in file share cannot be previewed with Office Web Apps in SharePoint search results.
    https://social.technet.microsoft.com/Forums/sharepoint/en-US/fdc18024-1782-4acd-a498-70c53c1d2f64/office-web-apps-preview-of-fileshare-documents
    If the documents in the site cannot be previewed, I recommend to use command
    New-SPWOPIBinding to re-create the binding without Action parameter and then do a full crawl tosee how it works.
    #2.  Please check the URL of the file in your search results and then copy the URL in the browser to see if the document can be opened.
    #3. I recommend to extend the web application to the internet zone and do not grant anonymous permission on the search results page in the internet zone. Then when the user wants to do search, then he will need to sign in to access the search results page.
    #4. Yes, if the user has no access to the files, then he will not be able to search the documents in SharePoint and the documents will not appear in search results.
    Best regards.
    Thanks
    Victoria Xia
    TechNet Community Support

  • Problems getting files to open in browser from SP 2010 search results page

    We are in day 4 of having upgraded from MOSS 2007 to SharePoitn 2010 via database attach.
    When a user looks in their document library, and clicks on a PDF, they are asked if they want to check out and open or just open, and when they make the selection, acrobat reader opens the doc.
    When a user performs a search on the same library, and clicks on a PDF in the results page, the user is prompted if they wish to download the file, and then, after they save it, the file is downloaded and nothing else happens.
    The users do not want their disks filled with unnecessary copies of files.
    Note that I did add an "application/pdf" mime type to the allowedInlineDownloadedMimeTypes property .
    This is only occuring when using the download results page.
    Does anyone know a fix for this?
    Thank you.

    Hi lwvirden,
    Generally, if the PDF is added to the Web Application's AllowedInlineDownloadedMimeTypes property , the PDF files will open in browser when clicking them regardless of on the search result page or the document library.
    I recommend to delete the PDF from the Web Application's AllowedInlineDownloadedMimeTypes property and then re-add it to see if the issue still occurs.
    Here is a table summarizes the various PDF rendering behaviors in search and library in the link below(same for SharePoint 2010):
    http://stevemannspath.blogspot.in/2013/04/sharepoint-2013-pdf-support-and.html
    More reference:
    http://social.technet.microsoft.com/wiki/contents/articles/8073.sharepoint-browser-file-handling-deep-dive.aspx#DownloadFunctions
    Best regards.
    Thanks
    Victoria Xia
    TechNet Community Support

  • Search Result Web Part - "Sorry, something went wrong " Unless users have edit rights.

    I have a SharePoint 2013 farm.  On content pages, we are using search result web parts.  If the user has edit rights, they work but if the user has only read rights there is a "Sorry, something went wrong." Error. 
    Thanks for your help in advance. 

    This is a pretty generic error in SharePoint that can be caused by any number of things. You can take a look a the Web Parts Maintenance Page by adding "?content=1" to the URL of your page. If you recently added a web part to the page or some other customization,
    this will allow you to turn it off.
    More than likely though, you will have to do some digging. Whenever you are in that page and get an error, you get a correlation id like in your example above. You can dig deep into the logs by finding them (typically in C:\program files\common files\microsoft
    shared\15\logs). Look for the most recent file and do a search it in and see if you can find that correlation id. If you can't find it you might try the previous log. When you find matching entries for the correlation id, you should get some idea to the component
    that is failing and causing your issues.

  • User Search result is not displaying

    Hello friends,
    i am facing new problem in the Portal, when i am searching any user in User Admin-> search.
    its dislaying some  information but its not displaying the Contact information.
    can any one perovide me some help in this regard...
    This error i am getting..
    Unparseable date: "en_US".
    Exception id: 03:44_27/03/08_0056_7377050
    See the details for the exception ID in the log file
    Regards.

    did you check the log file under
    http://host:port/nwa--monitoring-logs and traces-sap logs

Maybe you are looking for