• dc23

    (@datenchef)


    Hi! I do have a setup with facet wp and do use relevanssi as search engine. So i use the search facet https://facetwp.com/help-center/facets/facet-types/search/. my out listing has this query

    [
    "products"
    ],
    "post_status" => [
    "publish"
    ],
    "meta_query" => [
    "sort_0" => [
    "key" => "artikelnummer",
    "type" => "CHAR"
    ]
    ],
    "orderby" => [
    "sort_0" => "ASC"
    ],
    "posts_per_page" => 50
    ];


    the meta query sort by articelnumber does not work. lets say we have 20 results, 10 are fine and then comes a number gap. should i ask facet or does somebody here have an idea? thanks!

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Mikko Saari

    (@msaari)

    This seems correct to me. Does it work if you try the simpler structure?

    [
    "products"
    ],
    "post_status" => [
      "publish"
    ],
    "meta_key" => "artikelnummer",
    "orderby" => [
      "meta_value" => "ASC"
    ],
    "posts_per_page" => 50
    ];
    
    Thread Starter dc23

    (@datenchef)

    No, stays the same. I tested further, it seems that no sort by parameter is being used. Doenst matter if title or id, text or numeric, and so on… result order stays the same. Privat window tested…

    Thread Starter dc23

    (@datenchef)

    I think my output.php will doesnt matter since the query is made before this php but for completeness i do post it.

    <div class="row">
    <?php 
    $count = 0; 
    
    if ( have_posts() ) : while ( have_posts() ) : the_post();
    
    $meta_values = get_post_meta( get_the_ID() ); 
    ?>
    
    <div class="column">
    <?php echo do_shortcode('[elementor-template id="xxx"]'); ?>
    </div>
    
    <?php endwhile; else : ?> 
    <p>No results</p>
    <?php endif; ?>
    
    </div>
    Plugin Author Mikko Saari

    (@msaari)

    The relevanssi_orderby hook filters the orderby parameter Relevanssi gets. You can check what value passes through that filter to see if Relevanssi is getting the correct value.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘sort order of search result page’ is closed to new replies.