Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4087360
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T18:50:43+00:00 2026-05-20T18:50:43+00:00

I am trying to add OpenSearch functionality to my Yii application and have trouble

  • 0

I am trying to add OpenSearch functionality to my Yii application and have trouble configuring the UrlManager to route a search request to the right controller (called query in this case) and method (called index). The search works great if there are no white space in the search words. Whenever someone searches for more than one word, the UrlManager cannot find the controller and method to handle the search.

The url in the search.xml file that triggers the search is like this:

<Url type="text/html" template="[pathToMyApp]/application/index.php/query/{searchTerms}"/>

And my UrlManager is configured like this:

'urlManager' => array(
  'urlFormat' => 'path',
  'rules' => array(
     '<_c:(name|tag)>s/*' => '<_c>/index',
     '<controller:\w+>/<action:\w+>/<id:\d+>' => '<controller>/<action>',
     'query/suggest/<needle:\w+>'=>'query/suggest',  // used to route OpenSearch JSON suggestions - works
     'query/findbox'=>'query/findbox',  // routes search queries from a form in the application - works
     'query/<needle:\w+>'=>'query/index', // works only for search strings with no white space
  ),
  'showScriptName' => true,
),
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T18:50:44+00:00Added an answer on May 20, 2026 at 6:50 pm

    It seems that in query/<needle:\w+>, the \w+ part will stop matching at the first non-word char (e.g. a space). Changing the \w to something more forgiving (e.g. [\w ]) will probably do the trick.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Trying to add a functionality to our JSF 2 application to list active users
Trying to add django-registration to my app. I have installed setup tools to use
Trying to add dynamic borders on my website top, left, and right sides... The
Trying to add a button to the right side of the toolbar of the
I have been trying add facebook login to my page. I have facebook login
I'm trying add Taskbar Icon overlay with text to windows7 application icon, I did
I have been playing about with a GUI today and trying add different elements
Trying to add a view that combines data from two tables with a right
Trying to add rounded corners to images, that also have a border. Came up
I'm trying add vertical lines to my grid. I have found some examples but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.