Using a content Search class

The search class below works. When I try to pass the String array
into a servlet using:
Searcher search_instance = new Searcher();
String[] servlet_array = search_instance.getRes();
it always fails. When I configure the class as a stand-alone
class (with the 'getRes' method called from a 'main' method. It
works. Also, when I tried to convert this code into a servlet,
it fails as well. I simply want to return search results to a
browser using a servlet or JSP. Has anyone solved a similiar
problem?
import oracle.ifs.beans.LibraryService;
import oracle.ifs.beans.LibrarySession;
import oracle.ifs.common.CleartextCredential;
import oracle.ifs.common.IfsException;
import oracle.ifs.beans.DirectoryUser;
import oracle.ifs.beans.PrimaryUserProfile;
import oracle.ifs.beans.PublicObject;
import oracle.ifs.beans.Document;
import oracle.ifs.beans.Folder;
import oracle.ifs.beans.ContentObject;
import oracle.ifs.beans.Search;
import oracle.ifs.beans.SearchResultObject;
import oracle.ifs.search.ContextSearchSpecification;
import oracle.ifs.search.SearchClassSpecification;
import oracle.ifs.search.SearchSortSpecification;
import oracle.ifs.search.SearchClause;
import oracle.ifs.search.SearchQualification;
import oracle.ifs.search.JoinQualification;
import oracle.ifs.search.FolderRestrictQualification;
import oracle.ifs.search.AttributeQualification;
import oracle.ifs.search.ContextQualification;
import oracle.ifs.common.AttributeValue;
public class Searcher extends Object {String[] results = new
String[100];
public String[] getRes(){
try {
LibraryService ifsService = LibraryService.startService
("ifsDefault", "ifssys");
CleartextCredential cred = new CleartextCredential
("bill","bill");
LibrarySession ifsSession = ifsService.connect(cred, null);
DirectoryUser thisUser = ifsSession.getUser();
String[] ctxClauseName = {"Test1"}; // order by SCORE
// set DESCENDING sort order
boolean [] sortOrders = {false};
SearchSortSpecification sortSpec =
new SearchSortSpecification(new String[] {"DOCUMENT"},
new String[]
{ContextQualification.ORDER_PREFIX + "." +
                                    ctxClauseName[0]},
sortOrders);
// create a query expression using interMedia Text query
syntax
String searchWord1 = "Clareos";
String searchWord2 = "cart";
String queryOperator = " & ";
//String queryExpr = searchWord1 + queryOperator +
searchWord2;
String queryExpr = searchWord1 ;
// create a ContextQualification and specify the query
expression
ContextQualification cq = new ContextQualification();
cq.setQuery( "?" );
cq.setName(ctxClauseName[0]);
// now join with CONTENTOBJECT
JoinQualification jq = new JoinQualification();
jq.setLeftAttribute("DOCUMENT", "CONTENTOBJECT");
jq.setRightAttribute("CONTENTOBJECT", null);
SearchClause sc = new SearchClause( cq, jq,
SearchClause.AND );
ContextSearchSpecification cp = new
ContextSearchSpecification();
cp.setContextClassname("CONTENTOBJECT");
cp.setSearchClassSpecification(new SearchClassSpecification
(new String[]
{"DOCUMENT", "CONTENTOBJECT"}));
cp.setSearchQualification(sc);
cp.setSearchSortSpecification(sortSpec);
Search s = new Search(ifsSession, cp);
AttributeValue[] bindValue = new AttributeValue[1];
bindValue[0] = AttributeValue.newAttributeValue( queryExpr );
int y=0;
s.open(bindValue);
while (y<results.length){
results[y]= s.next().getLibraryObject().getName();
System.out.println(results[y]);
y++;
s.close();ifsSession.disconnect();} catch (IfsException e){}
return results;}
}

Hi,
Please try to use the following query text.
(CONTAINS(PlacesId, 'a2ce9dd7-f801-4403-affb-1944bf253255') OR (PlacesId > ''))
Here are two materials for you to take a look at:
http://blog.mastykarz.nl/excluding-empty-text-values-sharepoint-search/
http://social.msdn.microsoft.com/Forums/sharepoint/en-US/2ad1963f-f6e5-4c01-8826-444a6ba8de40/fulltextsqlquery-for-null-value?forum=sharepointdevelopmentprevious
Thanks,
Dennis Guo
TechNet Community Support
Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
[email protected]
Dennis Guo
TechNet Community Support

Similar Messages

  • Use a Content Search Web Part to Display a Picture

    Hello -
    Is there a way to use the Content Search Web Part to display the most recently added picture to a specified application?
    Please let me know if you need additional information to answer this question.
    Thanks,
    Jordan

    Hello Jordan,
    I believe you could do this :
    filetype:jpg OR filetype:png OR  (and so on for all
    images types)
    AND path:"http://yoursite/youlibrary"
    Regards
    Samuel
    Sharepointerie.com

  • Content search is it normal to get an error when using the PublishedDateOWSDATE (blog) property

    basic use of Content search employed on a single blog
    I use the template called 2 lines. First line is for the title, second line I would like to have either the published date or the categories (of the blog). While the latter is more complicated, I thought the date was fairly simple.
    I have placed PublishedDateOWSDATE and when I saved, I got the error message 
    Object does not support property or method 'indexof' (corerender: {path}item-twolines.js)
    What am I doing wrong?

    Hi suxxxann,
    Let's verify the followings:
    Whether you used a custom display templete for the Content Search web part.
    Whether you mapped the managed property to the associated crawled property.
    I did a test, however, I couldnot reproduce your issue. My steps are:
    Create a column in a library, and upload some documents into it.
    Do a crawl for my content source, then create a managed property called "Test" and map it to the related crawled property.
    Create a page, insert a Content Search web part.
    Edit the Content Search Web Part. Expand the Display Templates section, Item: Two lines.
    Expand Property Mappings, Line 1: Title, Line 2: Test.
    Click OK, and save the page
    In my testing, everything worked well. Please try to do as my above steps, compare the result.
    Best Regards,
    Wendy
    Wendy Li
    TechNet Community Support

  • How to retrive latest items from different site collection using content search web part

    I have a web application that contains two site collections(team site + enterprise wiki), with the following URLs:-
    -http://applicationname/teamsite
    -http://applicationname/enterprisewik
    Now I need to display the latest 10 wiki pages that are inside the enterprise wiki site collection (according to the modified date) inside the team site. So I read that using Content search web part allows for cross-site content query.
    So I added a new content search web part , inside my team site, and I click on “change query” button. But I am not sure how I can reference the enterprise wiki site collection's library and to specify that I need to get the latest 10 wiki pages using the
    content search web part's query dialog box? Can anyone advice please ?
    Thanks

    Edit the webpart and click change query in search criteria.  click on switch to advanced mode and enter your path:
    (path:"http://applicationname/teamsite" OR path:"http://applicationname/enterprisewik")
    you can specify sorting by created date and click ok.  in number of items to show, type 10.  this should fulfill your requirement.
    For further reading, here are some links:
    http://office.microsoft.com/en-001/office365-sharepoint-online-enterprise-help/configure-a-content-search-web-part-in-sharepoint-HA104119042.aspx
    http://blogs.technet.com/b/tothesharepoint/archive/2013/04/30/stage-9-configure-the-
    query-in-a-content-search-web-part-on-a-category-page.aspx
    http://blogs.technet.com/b/tothesharepoint/archive/2013/05/23/stage-10-configure-the-query-in-a-content-search-web-part-on-a-catalog-item-page.aspx
    kashif

  • Usage if the ifs-search classes

    hi,
    I look for an example of the use of the search classes -- Oracle.ifs.search.*, Oracle.ifs.beans.Search and Oracle.ifs.beans.SearchResultObject.
    It would be nice if you could give me a small codeexample
    TIA
    Oliver

    * This method seaches and gets the content of an iFS document.
    private static String getStyleSheetContent(LibrarySession ifs, String xslName)
    throws IfsException
    String retString = "";
    String className[] = {"DOCUMENT"};
    SearchClassSpecification scs = new SearchClassSpecification(className);
    scs.addResultClass("DOCUMENT");
    AttributeQualification aq1 = new AttributeQualification();
    aq1.setAttribute("DOCUMENT", "NAME");
    aq1.setOperatorType(AttributeQualification.LIKE);
    aq1.setValue(xslName);
    SearchSortSpecification ss = new SearchSortSpecification();
    ss.add("NAME" , SearchSortSpecification.ASCENDING);
    AttributeSearchSpecification ass = new AttributeSearchSpecification();
    ass.setSearchClassSpecification(scs);
    ass.setSearchQualification(aq1);
    ass.setSearchSortSpecification(ss);
    Search srch = new Search(ifs, ass);
    srch.open();
    try
    { while (true)
    LibraryObject lo = srch.next().getLibraryObject();
    Document d = (Document)lo;
    InputStream is = d.getContentStream();
    BufferedReader br = new BufferedReader(new InputStreamReader(is));
    for (String nextLine = br.readLine(); nextLine != null; nextLine = br.readLine())
    retString += nextLine;
    br.close();
    catch (IfsException e)
    if (e.getErrorCode() == ERRORCODE)
    if (DEBUG)
    System.out.println("Reached the end of the search data");
    else
    throw e;
    catch (IOException ioe)
    System.err.println("IOException reading XSL : " + ioe.toString());
    srch.close();
    if (DEBUG)
    System.out.println("Returning :[" + retString + "]");
    return retString;
    null

  • Content Search Web Part Has No Results

    Hello,
    I have been working on a site for a few weeks now and have been trying to make a simple Image Slider. I have found many tutorials and all are helpful -- except I get stuck at the same part every time. I am trying to use a Content Search Web Part in order
    to pull images from a library/list and display them. I go through almost the same instructions every time but my query never shows any results.
    I have went in to 'Change Query' and set the following:
    Select a query: Pictures (System)
    Restrict By App: Specify a URL --> Then changed to mysite/myimagelibrary
    I have tried a few things. I have changed the Result Source to multiple different things, including the default 'Recently Changed Items.' I have also tried to put the images in a list rather than a Picture Library. I have also tried MANY different ways of
    putting in the 'specific URL.'
    I don't know why I can't seem to get results from my query. Any help or suggestions would be appreciated. Thank you.

    Hi,According to your post, my understanding is that you used a Content Search Web part to search images from a library/list , it didn’t display any
    Results.
    Please check which content type you used for these images . Maybe its content type is document rather than picture. Please make sure your images’ content type is picture.
    You can go in to 'Change Query' and set the following:
    Select a query: Items matching a content type(System)
    Restrict by App: Current site
    Restrict by content type: Picture
    As you have mentioned in your description “Specify a URL --> Then changed to mysite/myimagelibrary”.
    Here is a similar issue, you can use as a reference:
    http://social.technet.microsoft.com/forums/sharepoint/en-US/4a683be5-354d-4497-88da-672dd6335358/content-by-search-web-part-shows-no-results
    If the issue still exists, please feel free to let me know.
    Best Regards,
    Lisa Chen

  • Content Search web part - Display Project Enterprise Custom Fields and Lookup Tables

    My ultimate goal is to display a rollup table of our active projects (from PWA) on another site collection using the content search web part. I can return default properties (such as the project name, author and URL) fairly easily using the same basic steps
    in the link below.
    http://en.share-gate.com/blog/roll-up-sharepoint-2013-sites-using-search
    My problem is that I want to also display information associated with each project from our PWA enterprise custom fields (such as risk, phase, etc.)
    Because these custom fields do not appear to be site columns, I'm at a bit of a loss as to how this data is searched / indexed / mapped.
    Is it possible to display PWA enterprise custom fields in a content search web part?

    Hi Jennifer,
    According to your description, my understanding is that you want to display PWA enterprise custom fields in a Content Search web part in SharePoint 2013.
    As your active projects were from different site collection with the Content Search web part, you need to do a crawl for the content source, then create a managed property for the column in CA->Search Service Application->Search Schema. When you create
    the managed property, select Searchable, Queryable, Retrievable.  Then  map it to the crawled property based on the custom column. You can find the crawled property by searching the name of the column in crawled properties.
    More information, please refer to the link:
    http://technet.microsoft.com/en-us/library/jj219667(v=office.15).aspx
    I hope this helps.
    Thanks,
    Wendy
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
    [email protected]
    Wendy Li
    TechNet Community Support

  • Content Search Web Part Error / Control_list.js not found

    Hello,
    I am trying to use the Content Search Web Part but I receive an error:
    Display Error: The display template had an error. You can correct it by fixin the template or by changing the display template used in either the Web Part properties or Result Types;
    Template '~sitecollection/_catalog/masterpage/Display Templates/Content Web Parts/Control_List.js not found or has syntax errors. (Load Template;)
    I am working on a fresh installation (out of the box) Sharepoint 2013 SP1 on which I have applied the latest CU.
    I have checked the folder and I only have one file 'Group_Content.js'. I searched over the web and I found out that I am missing a lot of file in that folder.
    Anybody can help me solve this without re-installation of SP?
    Thank you!

    Yep you are missing a lot of display templates if you only have the one.
    Is this the root site collection or a new site-collection under /sites? If it's the root site collection, then I would suggest creating a new web application and site collection and seeing if the problem exists in that. If it does, then you may need to repair/rebuild
    your SharePoint installation.
    If it's a sub-site-collection and the root site doesn't have that problem, try creating a new site-collection and testing in that. Also ensure that you have publishing features enabled in the site collection.
    Paul.
    Please ensure that you mark a question as Answered once you receive a satisfactory response. This helps people in future when searching and helps prevent the same questions being asked multiple times.

  • Display Search Results of Content Search WebPart in a Calendar Style

    Hi,
    I have currently the requirement to gather events from calendars (event list) that are spread among dozens of site collections. Calendar rollup or overlay only works within a sitecollection (right?). 
    I thought that I might be able to use the Content Search WebPart for this task. Is it possible to create displaytemplates that transform the search results into a calendar like view?
    Thanks
    Sven

    Hi Sven,
    As I tested, I can overlay SharePoint calendars across site collections in the same web application. However, by design it doesn't work across web applications.
    I'd like to confirm if you are overlaying calendars across site collections or web applications. If your situation is the former, did you recieve any error message?
    Regards,
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
    [email protected] .
    Rebecca Tu
    TechNet Community Support

  • Content search webpart sorting not working

    Using the Content Search webpart I have created a query that rollsup all the subsites of a particular path, which is working well. However, I have tried sorting using he sort by term SPSiteURL, unfortunatly that is not working. Does anyone have any idea
    what I am doing wrong.
    davidh

    Hi Cameron,
    Thanks for the reply. I find that hard to accept becuase I can get the same webpart to sort like I want it to at our SharePoint Online sites, granted the sorting feature is in a diferent location within the edit webpart dialog but still basically the same
    feature. Also, I would think that the SPSiteURL sort term does and should include the entire URL, which is unique to each site, which means that it should sort on the entire URL.
    I think that it is reasonable to expect to be able to achieve this in some manner, maybe not the way I am trying to do it, but I have to think I am not the first person to want to present the results of subsites sorted alpha-numerically.
    Thanks,
    davidh

  • Using Content search web part to retrieve items from another site collection

    I have a web application that contains two site collections(team site + enterprise wiki), with the following URLs:-
    -http://applicationname/teamsite
    -http://applicationname/enterprisewiki
    Now I need to display the latest 10 wiki pages from the enterprise wiki site collection(according to the modified date) inside the team site. So I read that using Content search web part allow for cross-site content query. Currently I added a new content
    search web part , inside my team site, and I click on “change query” button. But I am not sure how I can reference the enterprise wiki site collection's wiki page library and to specify that I need to get the latest 10 wiki pages , inside the following dialog:-
    Basically this setting partially worked for me, I provide the following settings inside the “Build Your Query” dialog:-
    From the “Select a Query” I defined the following:- “items matching content type(system).”
    Restrict by app : “Do not restrict results by app”
    Restrict by content type “Enterprise Wiki Page”.
    This showed all the sites, lists and even pages are based on the “Enterprise Wiki Page” content type. But I am facing these three problems:-
    1. The above setting showed only the sites,lists and pages matching the “Enterprise Wiki Page” content type, that exists on another web application, and not that exists inside the current web application.
    2. To test the web part , I got the following results, But I was not able to add additional info for the items such as created by, modified by ,etc.
    3.  Also there is no way to sort the wiki pages by the modified date, as in the Sorting tab inside the “Build Your query” dialog I cannot find the “modified” inside the Soft by list
    So can anyone advice how to fix these three problems

    Hi,
    1. In "Build Your Query" dialog, we can select "Specify a URL" in
    Restrict by app and enter another site URL.
    2. If you want to add more information for the items, we need customize the display template, the following link for your reference:
    http://blogs.technet.com/b/sharepoint_quick_reads/archive/2013/08/01/sharepoint-2013-customize-display-template-for-content-by-search-web-part-cswp-part-1.aspx
    3. In the Sorting tab, we can use "LastModifiedTime" to instead of "Modified".
    Best Regards 
    Dennis Guo
    TechNet Community Support

  • Sharepoint 2013 :Content Search Web part Property Filter By Query String - How to use ?

    Hi,
    I would like to filter data that is displayed in content search web part  by using  URL.
    I tried to use Value of a parameter from a URL - Query String.Parameter1
    But have no idea how to use it.
    Can someone help me pleas ?

    duplicate thread
    http://social.msdn.microsoft.com/Forums/en-US/f9fef155-1aa3-43b5-b285-5eae5d036b8d/content-search-webpart-property-filter-by-query-string-how-to-use-?forum=sharepointgeneral
    My Blog- http://www.sharepoint-journey.com|
    If a post answers your question, please click Mark As Answer on that post and Vote as Helpful

  • Use Navigation Node Title of Term Store in a Content Search webpart

    Hi,
    Do you have an idea on how to use the Navigation Node Title of a Term in Term Store to a Content Search webpart? I can now get the value of the Term itself, but I need is the Navigation Node Title of that term. I'm using managed properties. Thanks in advance. 
    Regards,
    Napster

    Take a look at this article that explains all the variables available while writitng search queries.  There is a whole section on managed metadata navigation terms.
    http://technet.microsoft.com/en-us/library/jj683123(v=office.15).aspx
    Paul Stork SharePoint Server MVP
    Principal Architect: Blue Chip Consulting Group
    Blog: http://dontpapanic.com/blog
    Twitter: Follow @pstork
    Please remember to mark your question as "answered" if this solves your problem.

  • Using term set as refiner in content search web part does not show all used terms

    When you create a terms set (12 terms with +/- 10-20 child terms) , attach it to a site column and allow multiple values to be selected the search service does not find all used values in the REFINERS tab of the content search web part.
    Example:
    Field ‘Tags’ is the term set which can be refined. We want to do this in the REFINERS tab of the content search web part.
    Tags is containing following fields:
    •Course document
    •Poster
    •ALS
    •Before
    •During
    •CPR/AED I
    In all libraries we used +/- 15 different tags already.
    Example of a tag field in the library:   "Poster;ALS;Belgium"
    The problem is we can’t see all of the used tags in the refiners tab when you open it for the first time.  (You can see Belgium or Cyprus is not in the list of tags.)
    When you select one tag and add it as a refiner, the others eventually do show up. But never all of them together.   It’s like he is only showing the most used (and maybe first selected?) tags first. I also think he might be having some trouble
    with multi value selections in the tag field.
     Does anyone else have the same issue as we do? And is there a solution already?

    Hi Sasha,
    According to your description, my understanding is that all the used terms cannot display in the Refiners in Content Search web part.
    If the results display in the Search Result Preview, then the terms used in these results can be displayed in the Refiners tab.
    I tested the same scenario per your post, and when I first opened it I can view all the terms which were used in the search results listed under owsmetadatafacetinfo.
    I recommend to do a full crawl and then you can view all the terms used in the search results are displayed under owsmetadatafacetinfo.
    Best regards.
    Thanks
    Victoria Xia
    TechNet Community Support

  • Query anonymous using Content Search Web Part

    I'm using the Content Serach Web Part in a template with public access, trying to query list data. It works fine when logged in, but as an anonymous user I get an error with correlation-id 000000000000-0000-0000-0000-000000000000. I do have anonymous
    access to the list data I query. Also I have added ViewFormPages to the AnonymousPermMask property as suggested, but with no luck.
    Anyone know how to search anonymous using the Content Serach Web Part, please share! Thanks in advance.

    http://social.msdn.microsoft.com/Forums/sharepoint/en-US/09a40222-36a4-472d-a9b8-28436ff3b78d/content-by-search-web-part-not-working-properly-for-anonymous-user?forum=sharepointdevelopment
    Please try to break inheritance permission for the anonymous users, and add ‘View Application Pages’ permission for them, it seems that the permission for anonymous users is moved by the lockdown feature, you can use the following PowerShell Script to change
    this:
    $web = get-spweb "http://yoursiteurl/subweb/subsubweb"
    $list = $web.Lists["ListName"]
    $list.BreakRoleInheritance($true)
    $list.AnonymousPermMask = $list.AnonymousPermMask -bor ([int][Microsoft.SharePoint.SPBasePermissions]::ViewFormPages) #binary or adding the permissions
    $list.Update()
    More information, How to Make List Items Visible to Anonymous Users (in Search):
    http://soerennielsen.wordpress.com/2012/05/29/how-to-make-list-items-visible-to-anonymous-users-in-search/
    http://www.mavention.com/blog/anonymous-search-results-cache-sharepoint-2013-public-websites
    <a:KeyValueOfstringanyType>
      <a:Key>TryCache</a:Key>
      <a:Value i:type="b:boolean"
    xmlns:b="http://www.w3.org/2001/XMLSchema">true</a:Value>
    </a:KeyValueOfstringanyType>
    http://magenic.com/BlogArchive/SharePoint2013ContentSearchWebPartsCatalogs
    http://blog.mastykarz.nl/inconvenient-anonymous-search-results-cache-user-segments/
    If this helped you resolve your issue, please mark it Answered

Maybe you are looking for

  • Sales order is blocked for Delivery-ZH Cost estimate Req

    Hi experts, When I am saving the sales order I am getting the informative message standard cost estimate for material xxxx is missing. when i am creating delivery with reference to sales order  it is not allowing me to do delivery it is showing that

  • Automatic table logs?

    Hi, Logging table changes, produced by dml operations, is a very often requirement in today's information systems (what was changed, by whom, from which machine, when, etc). The best I could do in the past, explicitly with Oracle, was to automaticall

  • Configuration Wizard failed at 8th step after installing sp3 patching in Moss 2007

    Hi While running in the config wizard it failed at 8th step please give me some suggestion on this [SPManager] [ERROR] [2/9/2014 8:18:52 AM]: ReflexiveUpgrade [SPServer Name=***** Parent=SPFarm Name=SharePoint_Config] failed. ] [ERROR] [2/9/2014 8:18

  • HT4140 How can I update Mac OS X 10.5.8 into Mac OS X 10.6?

    I have the software Mac OS X 10.5.8 right now but I need to update into a Mac OS X 10.6 in order to get the Mountain Lion... But I can't seem to be able to do it... Help?

  • Basic problem displaying components

    I downloaded Creator today to see if I could make the basic JSF code and then fill in the parts that Creator would not know about. I"ve used similar tools before, like VIsual Basic, as well as the component palette in a Java IDE or two. I'm haivng a