Node table has been cleaned up and no more Old style url content exist in the node table.

Old style url == article/billclinton/
new style url == article/billclinton/guid(1234567890)

When end user, hit the bookmark URL ....such as Old style url == article/billclinton/ ( which intend drupal throws 404 as no data).
Before it throws 404 to the user, want to fetch the path/itemID/ from Url_alias table

Example :
SELECT source,itemID FROM url_alias WHERE alias = '$article_title';
+--------++--------+
| source |ItemID |
| node/2 |34223232|
| node/1 |55454545|
+--------+--------+

and match the ItemID from node table.

Do we need to create (something) archive table to store itemID from url_alias and next-time lookup in this table and based on itemID fetch the date from ApacheSolr
column 1 == old style url (/article/slug)
column 2 == new archive style ( /archive/article/slug/itemID)

Comments

skwashd’s picture

Status: Needs work » Closed (works as designed)

This isn't an issue with the url_alias module. You should look at using the redirect module.

athakhan’s picture

Thanks Skwashd.

Am able to find out the solution in this manner....

We can approach by implementing hook_boot which will capture HTTP 404 call path and render the data page on fly through fetching the data from Apache Solr. Rather creating a new table in DB and executing multiple calls.

For example ::
/*
* Implements hook_boot
* To capture 404 calls
*
*/
function custom_404_boot() {
$req_path = request_path();
$check_404 = request_path_node_exists($req_path);
if($check_404) {
$page_body = 'Page body text'; //this will come from solr
$node = new stdClass(); // Create a new node object
$node->type = 'page'; // Content type
$node->language = LANGUAGE_NONE; // Or e.g. 'en' if locale is enabled
node_object_prepare($node); //Set some default values

$node->title = 'Page title'; //this will come from solr
$node->body[$node->language][0]['value'] = $page_body;
$node->body[$node->language][0]['summary'] = text_summary($page_body);
$node->body[$node->language][0]['format'] = 'full_html';

$node->status = 1;
$node->promote = 0;
$node->sticky = 0;
$node->comment = 1;
$node->uid = 1;
$node->date = '2015-06-06';
$node->created = strtotime('2015-06-06');
$node->path = array('alias' => $req_path);
node_save($node);
drupal_goto($req_path);
}