Search URL

Events happening in the community are now at Drupal community events on www.drupal.org.
dlo001's picture

I am trying to integrate lucene api search to my site. But have run into an issue with my ad servers. The URL is example.com/search/luceneapi_node/{querystring} . The problem is that "luceneapi_node" in the url generates ads that are related to lucene and open source. This is a business journal magazine site with ads coming from various feeds and networks. So getting rid of or changing the url path is ideal here.

How do I change the url path or create an apache redirects to go to an ideal "/search/site/{querystring}" or "/search/qry/{querystring}"

Comments

Hi dlo001. I replied to the

cpliakas's picture

Hi dlo001.

I replied to the issue you posted in my queue. http://drupal.org/node/580768#comment-2075546

Thanks,
Chris

It's difficult but not

steev's picture

It's difficult but not impossible.
I wanted to change the search url on our drupal 5 installation because we were using apachesolr instead of the core search and didn't want users to see /search/apachesolr_search or to have access to the core search- we wanted the url to just be /search
I found that I had to make 4 changes to the core search module:
around line 882:

+  // We're not allowing any other "types" of search. so anything after arg(0) is a key
+  // $path = explode('/', $_GET['q'], 3);
+  // return count($path) == 3 ? $path[2] : $_REQUEST['keys'];
+  $path = explode('/', $_GET['q'], 2);
+  return count($path) == 2 ? $path[1] : $_REQUEST['keys'];

at ~898 added:

  $type = 'apachesolr_search';

at 989:

 // $action = url('search/'. $type);
    $action = url('search');

and at 1041:

  // return 'search/'. $type .'/'. $keys;
  return 'search/'. $keys;

Of course in the apachesolr module i had to tweak a couple things too since it assumes the url has an extra arg too.
It's unfortunate that the core Search module was designed to make it so hard to have a drop-in replacement, but at least this is some kind of work-around. hope this helps.

steev

Lucene, Nutch and Solr

Group organizers

Group categories

Projects

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: