• Hello, thanks for you great plugin.

    We would like to show a message on the Search results page, saying, for each individual result, something like “this search result matches 3 of the 6 criteria you searched“.

    Currently, our search results URL is like so (it’s broken down here), and we are using essentially, custom post types categories and custom post types custom fields to create the search query:

    OURWEBSITE.COM/search/?geodir_search=1
    &stype=restaurant&
    s&
    s=+&
    snear=&
    spost_category[]=5&
    spost_category[]=11&
    scompany_size[]=&
    scompany_founded[]=&
    stimezone[]=&
    slanguages_spoken[]=Spanish&
    scost_per_hour_senior_developer[]=&
    scost_per_hour_medior_developer[]=&
    scost_per_hour_junior_developer[]=&
    scost_per_hour_project_manager[]=&
    scost_per_month_full_time_senior_developer[]=700€-1000€&
    scost_per_month_full_time_medior_developer[]=&
    scost_per_month_full_time_junior_developer[]=&
    scost_per_month_full_time_project_manager[]=&
    sgeo_lat=&
    sgeo_lon=

    In the example avobe, the user searched (filled) 4 criteria:

    • category 5
    • category 11
    • languaje spanish
    • salary 700€-1000€

    The search produced 6 results, each at varying degrees of adecuacy, ie. the first had all 4 criteria, the rest 2 or 3.

    How can we display a small message stating how many criteria where matched?
    Can you give us some direction on how to get such a thing?

    Thanks.

    Note: we are using Geodirectory plugin if this helps.

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

    (@msaari)

    In the post loop, for each post go through all the criteria and check if it matches. That would be the most straightforward method. Relevanssi doesn’t know, the taxonomy restrictions are done in the database query and that doesn’t provide the information, only the results.

Viewing 1 replies (of 1 total)
  • The topic ‘“This search result matches 3 of 6 custom fields searched”’ is closed to new replies.