Modify the search query

Home Forums Calendar Products Events Calendar PRO Modify the search query

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #1016081
    Pablo
    Participant

    Hello guys,

    I would like to change slightly the behaviour of the search functionality on the front end.

    Basically, I would like that it searches not only in the title and descriptions of a post but also on the venue… so when you search for “XYZ venue”, those terms are not only searched on the post titles and descriptions but on the venues as well.

    Let me know if I did not explain it well.

    Thanks and regards,

    Pablo

    #1016127
    Brook
    Participant

    Hello Pablo,

    Thank you for clearly explaining your question.

    That is going to be extremely complicated to do. The search aspect is handled by WordPress as part of the WP_Query. If you want to include events in the results based on words found in their venue, you will have to do a pretty hefty modification of WordPress search involving some SQL joins and many other modifications to the standard WP search query.

    It would be easier to include the venue itself as a returned result when someones search text matches the venue title or content. If they clicked on the venue it would then show them a list of events for that venue. This will still requires some good knowledge of WP queries and themes to accomplish though. You would add an action to pre_get_posts, and check that $_REQUEST[‘tribe-bar-search’] is not empty(). From there you could change the post_type to include venues. However, the venues will not have pertinent information for search results, such as start/end times. So you will need to modify the templates to account for this, and likely force all search to be done with List View (which is yet another modification).

    Either way it won’t be easy. I wish it was, but building or modifying search queries is one of the more difficult things to do. Does that answer your question?

    Cheers!

    – Brook

    #1016370
    Pablo
    Participant

    Hei Brook,

    Thanks a lot for your kind answer. I was afraid that it was like that… so you confirm my hunches.

    The guidelines that you provide are very helpful to me!

    Thanks and regards,

    Pablo

    #1016551
    Brook
    Participant

    You are welcome, Pablo. I wish I had better news there.

    I know some users have found things like the Filter Bar to be helpful for improving search. The Filter Bar can add a list of all of your venues to the main events page, then a user can click on one or multiple to show events from those venues. Does that sound like it might help you here?

    Cheers!

    – Brook

    #1016625
    Pablo
    Participant

    Hei Brook,

    Thanks for your suggestion. It could work… but in fact I am looking for something more “inclusive”. The way you suggest would exclude those events out of the selected venues, and I still want that the search term functionality work as expected (include events from all the venues).

    At the other hand, I think that it could be a good idea to suggest venues matching the search term in the moment that the user is writing… I think that could be user friendly and what the user expect to see nowadays.

    Thanks a lot for your help!

    Best regards,

    Pablo

    #1017027
    Brook
    Participant

    That’s understandable Pablo. I think we would be interested in seeing if that is a popular feature suggestion. If this is something you would like to see in the calendar in the future please officially suggest it on UserVoice. Thanks for the feedback!

    Cheers!

    – Brook

    #1022509
    Support Droid
    Keymaster

    This topic has not been active for quite some time and will now be closed.

    If you still need assistance please simply open a new topic (linking to this one if necessary)
    and one of the team will be only too happy to help.

Viewing 7 posts - 1 through 7 (of 7 total)
  • The topic ‘Modify the search query’ is closed to new replies.