Take the 2-minute tour ×
ExpressionEngine® Answers is a question and answer site for administrators, end users, developers and designers for ExpressionEngine® CMS. It's 100% free, no registration required.

Based on the documentation, I can do "exact" and "contains" matching.

Is it possible to do a "starts with" search? For example, lets say I have this entries in the database

  1. Web design
  2. Web development
  3. SEO and Web Marketing

when I search for web, I want to get the first and second entries but NOT the third.

share|improve this question

2 Answers 2

up vote 3 down vote accepted

The search-parameter for the Channel Entries tag does not allow you to target a Title field. So either get creative with the Query module, or try one of these options:

1. Low Search

Low Search's Field Search filter can target entry titles and allows you to match by 'starts with'. That would look something like this:

{exp:low_search:results channel="services" search:title="web" starts_with="search:title"} 

Or, alternatively:

{exp:low_search:results channel="services" search:title="^web"}

2. Channel Query

Channel Query is like the Query module, but calls the native channel:entries module with its result. You should be able to use it like this (untested):

{exp:channel_query sql="SELECT entry_id FROM exp_channel_titles WHERE title LIKE 'web%' AND channel_id = 1"}
share|improve this answer

I don't think this can be done.

The only way I can think about is to write addons to do this.

I think this plugin will be useful https://github.com/croxton/Search_fields

this plugin use the same way as EE but with some additional features.

u can hack it and add "starts with" feature.

Regard's.

share|improve this answer
    
I've used Search Fields before, and it works quite nicely. –  Jeremy Gimbel Mar 14 at 15:28

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.