All Low add-ons are now owned by EEHarbor. Read the blog post.

Support archive

Performing searches programmatically

Chris Roberts 20 Jun 2014 23:15 question, complete

We're using Low Search alongside a feature that allows users to save searches. We also want to be able to process those saved searches later and perform various actions with the results.

How would I go about performing a programmatic search from within my custom extension? Is this already documented somewhere?

Thanks!

Replies

  1. Low 21 Jun 2014 10:37

    Not quite sure what you mean by "programmatic search". Can you elaborate?

  2. Chris Roberts 21 Jun 2014 17:05

    Sure. I have an extension that hooks into post updates. Any time posts in a particular channel get updated, I want to re-run our saved searches. This means the user won't be sitting at a browser using the form to run a search, we'll be running searches entirely from the back-end code.

  3. Low 22 Jun 2014 16:36

    What do you consider saved searches? Do you mean the Shortcuts? Or are you actually saving entry IDs?

    If you bookmark search results, they will keep up to date when entries change, unlike EE's native search.

  4. Simon Watson 25 Jul 2014 06:06

    Hi Chris & Low,

    Did you manage to work out a way to run a Low Search from within your own extension?

    I'm interested to find out if there is an API to be able to run a Low Search from inside another module without using saved searches. For example if I wanted to build a restful API module like Entry API - http://devot-ee.com/add-ons/entry-api would it be possible to create a Search Entries endpoint in my own module that ran Low Search internally and then output the results as JSON or XML?

    So is it possible to run Low Search in a custom add-on module instead of in a template?

    Thanks

  5. Low 25 Jul 2014 08:08

    As soon as you're returning results, you need to parse them. Think about typography, fieldtypes like Grid or Matrix, the list goes on. For this, you need templates. I don't see a way to return any sort of data, maybe other than just entry IDs, without using the template engine. So creating an API through templates is the only way for now.