• Resolved emanuelsw

    (@emanuelsecurityweek)


    Using the plugin is it possible to add widget in the sidebar to sort (order) by date, relevance and so on?

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Hi @emanuelsecurityweek

    Overall yes, but we definitely don’t have the sortby widget in place in the out-of-box template file. This is because indexes only have one sorting per index, however with replicas, you can change the sorting parameter without much effort, and replicas will all be self-managed for content. That means you wouldn’t suddenly have extra things to keep in sync. Algolia will have all that covered for you.

    You can read more about the sortBy widget at Algolia’s documentation here: https://www.algolia.com/doc/api-reference/widgets/sort-by/js/

    Replica information can be found at https://www.algolia.com/doc/guides/managing-results/refine-results/sorting/how-to/creating-replicas/

    For template customization in regards to the instantsearch.php file that WP Search with Algolia specifically ships, you can find that information at https://github.com/WebDevStudios/wp-search-with-algolia/wiki/Customize-Templates

    If you have any other questions, feel free to let us know and we’ll answer as best we can.

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    @emanuelsecurityweek

    Any news or further questions here?

    Thread Starter emanuelsw

    (@emanuelsecurityweek)

    I was able to create a replica, customize the instantsearch template, add the sort widget but when changing the values it does not do anything

    // SortBy widget for sorting
    instantsearch.widgets.sortBy({
    	container: '#sortby',
    	items: [
            	{ label: 'Newest', value: wp_searchable_posts_sort },
    	{ label: 'Oldest', value: wp_searchable_post_sort_date },
    	],
    }),
    <aside id="ais-facets">
         <div>
    	<h3 class="widgettitle"><?php esc_html_e( 'Sort by', 'wp-search-with-algolia' ); ?></h3>
    	<section class="ais-facets" id="sortby"></section>
         </div>
    ...

    And in Algolia I have a main indices ‘wp_searchable_posts’ and have created a replica index called ‘wp_searchable_post_sort_date’

    What else am I missing?

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    At least in terms of the markup above, that looks all standard and matching essentially with some previous sorting work I’ve done for others.

    Do you have a link to where we can see the attempted ordering in action/inaction?

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Did you ever get this working @emanuelsecurityweek?

    Thread Starter emanuelsw

    (@emanuelsecurityweek)

    Nope. Tried a few times but was unable to make it work.

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    To be certain, you set up 2 replicas both around date sorting correct, one for ASC order and one for DESC order? or did you have just one and the other provided sortby was the default original?

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Just checking in again here @emanuelsecurityweek Hopefully we can get things figured out.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Order search results’ is closed to new replies.