• Would love to have facet support for the query API calls. You could add a filter to the following line to open up altering the search query to AWS.

    cloud-search/actions/cloud-search-action-search.php #228

    I’ve been rewriting some of your code to use return facet search. Not a lot of work, just adding a few extra return fields in the function:
    acs_index_documents_search

    • This topic was modified 7 years, 8 months ago by acodesmith.
Viewing 9 replies - 1 through 9 (of 9 total)
  • Thread Starter acodesmith

    (@acodesmith)

    Ok, dug into the codebase some more. Whoa! A lot going on with the $response and how it’s handled. Had to modify a few different functions to return the new facet property the API returns normally. Got it working pretty well.

    Plugin Author Andrea Landonio

    (@lando1982)

    Hi!

    I’m working on other minor fix on the plugin… I can plan facet support for the future releases.. if you want you can send me a snippet of you code (or give me more info about what you are expecting from API responses), I can include it in the next release..

    Keep in touch,
    BYe

    Plugin Author Andrea Landonio

    (@lando1982)

    Hi @acodesmith, I’m very busy in this period.. but facet support will be the next plugin major upgrades..

    I’ll keep you updated..

    Thread Starter acodesmith

    (@acodesmith)

    @lando1982 Thanks for the update! I’ve since reverted all of my Facet changes. It was getting deep in the code. One thing I did alter was the ability for the admin-ajax api calls to return full counts for the search.

    For example: Show 1-25 of 1,000,000. The AWSCloudSearch API returns that information naturally.

    Upon digging into the code I suggest decoupling the API calls and your front end search jQuery magic. That way people who want custom front end stuff can still get access to raw/core AWSCloudSearch result data. Your front-end stuff could still work but it would be using a wider more adaptable search result object.

    For example cloud-search-api.php function acs_format_response could use a action or filter to return all results from the AWSCloudSearch API, not just the items.

    One last thing I would also suggest is an opt-in option for private fields. I noticed you were ignoring fields which started with _. Normally a great idea BUT WooCommerce set’s all their prices to _price. I altered that statement to include _ options so I could run advanced queries for a WooCommerce store.

    Main take away, is all your hard work building the sync is super awesome, just de-couple the front end stuff so more advanced developers can hook and filter their way to happiness.

    Thanks again for all the hard work!

    Plugin Author Andrea Landonio

    (@lando1982)

    Hi @acodesmith, I’m working on facets… I have some question for you…

    I have added a JSON element to the API results (JSON or XML, no other acs_format_response action), like:

    
    facets: {
    post_type: {
    buckets: [
    {
    value: "post",
    count: 6
    },
    {
    value: "page",
    count: 1
    }
    ]
    },
    post_format: {
    buckets: [
    {
    value: "0",
    count: 5
    },
    {
    value: "aside",
    count: 1
    },
    {
    value: "video",
    count: 1
    }
    ]
    }
    }
    

    You can specify the facet response fields by adding in the API query string something like this (I’ll give you all the info when updates are ready):

    https://localhost/wp-admin/admin-ajax.php?action=acs_api_search_full&keyword=lorem&facet.post_type=%7B%22sort%22:%22count%22,%20%22size%22:5%7D&facet.post_format=%7B%7D

    In other words:

    facet.post_type={"sort":"count", "size":5}&facet.post_format={}

    This could be correct for you? You have some suggestion for me? You are the only one that request to me the facets support, I’m using use to prepare the best user experience.. let me know..

    PS: the problem regarding the field staring with “_” in the next step..after facets.. ??

    Bye

    Thread Starter acodesmith

    (@acodesmith)

    That looks great. Very helpful!

    Plugin Author Andrea Landonio

    (@lando1982)

    Ok, in a couple of days I think the plugin should be ready.. ??

    Plugin Author Andrea Landonio

    (@lando1982)

    Hi @acodesmith, facet support is ready… ??

    Plugin Author Andrea Landonio

    (@lando1982)

    Please add “_price” values in the “Custom field types prefix/suffix” input box, in this way you can find the private field in the “Field types” list.. ??

    Last question @acodesmith, what do you mean when you say to “de-couple the front end sync”? You need a way to schedule a documents sync? Can you give me more info?

    Bye

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Add Facet Support’ is closed to new replies.