Oracle Endeca – Keyword search in Endeca using presentation API.

Sample client which connect to an Oracle Endeca MDEX server and make keyword search. Query will be applied with nid zero and the search term will be searched against all searchable keys in the index. This client connect to MDEX installed in localhost at default port 15000.

10 thoughts on “Oracle Endeca – Keyword search in Endeca using presentation API.

  1. Sathish Kumar said:

    Thanks a lot !! It was hard to find sample(working) code for endeca .. You made my day :) … One question, How do we query against a property type ( For E.g Product_Name=”XYZ” )?

    • Madhukanth Reddy said:

      Hi,
      Hi,
      I am new to Endeca, I want to write a endeca query in java for searching products based on product ids(Its Multiple Ids at one shot) in java, I am able to write it for a single id
      final ENEQuery query = new ENEQuery();
      final DimValIdList dimValIdList = new DimValIdList(“0″);
      query.setNavDescriptors(dimValIdList);
      final ERecSearchList searches = new ERecSearchList();
      final ERecSearch eRecSearch = new ERecSearch(“P_product_code”,”180479110421272″);
      searches.add(eRecSearch);
      query.setNavERecSearches(searches);

      In this case i am getting the out put, but when i want to search the product based on two Ids i,e 180479110421272 and 260036825042 at a time , then i am not getting how to build the query, Kindly help me out .

      when i write for 2 productIds then its not showing any records.(I am not sure wheather its right or worng)
      final ERecSearchList searches = new ERecSearchList();
      final ENEQuery query = new ENEQuery();
      final DimValIdList dimValIdList = new DimValIdList(“0″);
      query.setNavDescriptors(dimValIdList);
      final ERecSearchList searches = new ERecSearchList();
      final ERecSearch eRecSearch = new ERecSearch();
      searches.add(eRecSearch);
      searches.add( new ERecSearch(“P_product_code”,”180479110421272″));
      searches.add( new ERecSearch(“P_product_code”,”260036825042″));
      query.setNavERecSearches(searches);

  2. vijaya said:

    I am new to the endeca.I need to write query in java to search the product based on product code(one of the properties) in java.

    I have written below code for it

    final ERecSearchList searches = new ERecSearchList();

    final ENEQuery query = new ENEQuery();

    final DimValIdList dimValIdList = new DimValIdList(“0?);

    final ERecSearch eRecSearch = new ERecSearch(“P_product_code”,”1234235″);;

    searches.add(eRecSearch);

    query.setNavERecSearches(searches);

    For the above code I am able to get output which contain attributes of DERIVED PROPERTIES and few attributes of REPRESENTATIVE REC PROPERTIES(able to get all the attributes of DERIVED PROPERTIES and few attributes of REPRESENTATIVE REC PROPERTIES).

    But I need to write query in java to get the record level details all the attributes .

    • Sanju Thomasourownjava said:

      hi Vijaya, I didn’t understand your question clearly. Ideally speaking ERec.getProperties() would return a key value pair of all the indexed and stored attributes of record. Check if those attributes are listed in the jsp reference application.

  3. vijaya said:

    Hi,
    On search of product code below attributes are displayed in the jsp reference page. I am also able to query these attributes.

    2herhew895749835 (1 Record)
    PROPERTIES:
    MIN_SALE: 10
    MAX_SALE: 4
    MIN_LIST: 6
    MAX_LIST: 6
    REC PROPERTIES:
    Store: N
    online: ahgsja
    clearance: s
    color: G
    color: Pewter
    comp_size: One Size
    INVENTORY_AVAIL: 16
    inventory_level: 16
    isPattern: F
    listPrice: 60.000000

    After the search result obtained .On further click on the record(2herhew895749835) in jsp reference page below attributes are obtained.
    Now I need to write the query in java to obtain all the attribute present below at record level.

    2herhew895749835 (1 Record)
    PROPERTIES:
    MIN_SALE: 10
    MAX_SALE: 4
    MIN_LIST: 6
    MAX_LIST: 6
    REC PROPERTIES:
    Store: N
    online:
    brand Ahgsja
    sdfdsfff
    clearance: s
    color: G
    color: Pewter
    comp_size: One Size
    INVENTORY_AVAIL: 16
    inventory_level: 16
    isPattern: F
    listPrice: 60
    reserved: 0
    saleprice: 4
    sku_code: 048
    sku_upc: 126329
    skus_sale_price: 44
    vendor_number: 2tyut
    vendor_style: vnjvnjvjgjg
    wedding_skus_sale_price: T876868
    RECORDSPEC: Y6326598432 jdhfiu
    ROLLUPKEY: 398257 nfeor84u09tc8

    • Sanju Thomasourownjava said:

      All the record level properties can be extracted from ERec, You may not have to do anything with Query. You have to look at ERec.getProperties(), This method returns all the record properties, its a key value of pair. Key is what you see in the jsp application before “:” and value is what is shown after the “:”. (sku_code: 048) Check out this code segment.

      for (Object result : results.getNavigation().getERecs()) {
      final ERec eRec = (ERec) result;
      for (Object key : eRec.getProperties().keySet()) {
      System,out.println(key);
      System.out.println(eRec.getProperties().get(key));
      }
      }
  4. balachandar said:

    Hey team u r rocking …