editing com_search to find more from other components
Moderators: tjay, seadap, Rogue4ngel, matthewhayashida
editing com_search to find more from other components
I have installed a few more components, and i would like to search the contents of these components by modifying the com_search method to do so. Though I am new to joomla and I am not 100% sure where to start looking, I assumed it would be a matter of adding to the sql query the search has to call somehow into the db, like basically adding the tables from the components I know that will be installed (namely e-portfolio and seyret video module). The seyret module has a search for those that use it but its seperate and not uniform with the rest of a joomla based site. So any pointing in the right direction would help. I poked around the com_search folder and saw the search.html.php and the search.php but I cannot figure out where the actual calls into the SQL db are being made... like how does it know what tables to search to bring back your main results the search already returns.
Thanks
Shane
Thanks
Shane
- manuman
- Joomla! Enthusiast
- Posts: 211
- Joined: Fri Aug 12, 2005 1:58 am
- Location: Albany - Western Australia
- Contact:
Re: editing com_search to find more from other components
Hi there,
You don't any existing files to extend search. You can extend search's by creating searchbots(plugin). If you have a look at some of the standard installed ones(weblinks is a good option) then you'll see how they work. They are found in plugins/search in your Joomla! file system.
If your comfortable in php then the rest is a breeze.
Cheers
Shayne
You don't any existing files to extend search. You can extend search's by creating searchbots(plugin). If you have a look at some of the standard installed ones(weblinks is a good option) then you'll see how they work. They are found in plugins/search in your Joomla! file system.
If your comfortable in php then the rest is a breeze.
Cheers
Shayne
Core Team Member :: Project Manager & Foundation WG Coordinator
OSM Board Member :: Treasurer
Vote for Joomla! http://www.packtpub.com/nominations-homepage
OSM Board Member :: Treasurer
Vote for Joomla! http://www.packtpub.com/nominations-homepage
Re: editing com_search to find more from other components
I don't have my main dev machine here, but I just downloaded joomla to the pc I am to start poking around the files and it seems I don't have a plugin folder anywhere. I see a modules and components but no plugins folder.
Thanks,
Shane
Thanks,
Shane
Re: editing com_search to find more from other components
You did not specify which version of Joomla! you are referring to. It sounds like you are referring to 1.0.x series. The mambots folder is the equivalent to the plugins folder in Joomla! 1.5 series.codejoy wrote:I don't have my main dev machine here, but I just downloaded joomla to the pc I am to start poking around the files and it seems I don't have a plugin folder anywhere. I see a modules and components but no plugins folder.
Thanks,
Shane
http://springhillalumni.org • Springhill High School Alumni Association
Re: editing com_search to find more from other components
yes its 1.0, I see the file but I am confused by say the content.searchbot. I am guessing its searching one of the content tables ? where is the table name being specified, I found the query:
$query = "SELECT params"
. "\n FROM #__mambots"
. "\n WHERE element = 'content.searchbot'"
. "\n AND folder = 'search'"
but the __mambots and the element and folder confuse me. Whats __mambots? what is the element in the WHERE ? and whats the folder in AND its not the sql i am used to and cannot figure out whre it is specifying an actual table to query. Though it does seem once I figure this out I can just add my own searchbot for say the video content and also the eportfolio content?
$query = "SELECT params"
. "\n FROM #__mambots"
. "\n WHERE element = 'content.searchbot'"
. "\n AND folder = 'search'"
but the __mambots and the element and folder confuse me. Whats __mambots? what is the element in the WHERE ? and whats the folder in AND its not the sql i am used to and cannot figure out whre it is specifying an actual table to query. Though it does seem once I figure this out I can just add my own searchbot for say the video content and also the eportfolio content?
Re: editing com_search to find more from other components
The query you listed was to extract the parameters for that mambot (plugin). To see the other queries, you will need to scroll further down.
http://springhillalumni.org • Springhill High School Alumni Association
Re: editing com_search to find more from other components
okay I see.. i did reopen the newsfeeds.php file and see the query. Most of it makes sense: but I am curious as to what the FROM is getting from? i see the #__newsfeeds and the #__categories , I don't see where those are defined or where they are coming from, I am not sure if this is php (I have some limited experience in php but this is sorta new to me). I also noted a $database->Quote( _SEARCH_NEWSFEEDS ) which was suprising as well...
I know I can figure this out but my general methods of hacking this stuff isn't flying here. I tried to go into my joomla install under administrator and unpublish and publish the search mambots to see how its working. I also noticed that there is a line in the final query (again using the newsfeeds example) that says:
"\n CONCAT( 'index.php?option=com_newsfeeds@task=view@feedid=', a.id ) AS href, " which I wasn't sure what that itself was doing... though noticing I am sure the categories search and that replace ?option=com_newsfeeds with some other components, and I am sure for the seyret video and the e-portfolio I would be doing the same (replacing the com_newsfeeds with the other components...)
still not sure where it knows to access the tables. Seems to me for my searches I would have to determine whats searchable (say video title, etc) and change the query to deal with that those fields from my particular table i want to search..
I know I can figure this out but my general methods of hacking this stuff isn't flying here. I tried to go into my joomla install under administrator and unpublish and publish the search mambots to see how its working. I also noticed that there is a line in the final query (again using the newsfeeds example) that says:
"\n CONCAT( 'index.php?option=com_newsfeeds@task=view@feedid=', a.id ) AS href, " which I wasn't sure what that itself was doing... though noticing I am sure the categories search and that replace ?option=com_newsfeeds with some other components, and I am sure for the seyret video and the e-portfolio I would be doing the same (replacing the com_newsfeeds with the other components...)
still not sure where it knows to access the tables. Seems to me for my searches I would have to determine whats searchable (say video title, etc) and change the query to deal with that those fields from my particular table i want to search..
Re: editing com_search to find more from other components
The FROM statement is telling you which table in the database to get the results from. Joomla! will replace the #__ of the table names with the database prefix as defined in the configuration.php file.
The _SEARCH_NEWSFEEDS inside the parenthesis is a variable. Previously in that file that variable was defined.
The CONCAT SQL statement was combining the a predefined link ('index.php?option=com_newsfeeds@task=view@feedid=') with the article id (a.id) and assigning it to a field of href for the returned record.
That is correct. You will need to supply in your search mambot (plugin) what fields you want searchable.
The _SEARCH_NEWSFEEDS inside the parenthesis is a variable. Previously in that file that variable was defined.
The CONCAT SQL statement was combining the a predefined link ('index.php?option=com_newsfeeds@task=view@feedid=') with the article id (a.id) and assigning it to a field of href for the returned record.
That is correct. You will need to supply in your search mambot (plugin) what fields you want searchable.
http://springhillalumni.org • Springhill High School Alumni Association
Re: editing com_search to find more from other components
Thank You, I am beginning to see how truly dynamic and well thought out Joomla is for extending. It seems to me then, that if i were to create say an eportfolio search mambot the files it might have are:
mambots: eportfolio.searchbot.php, eportfolio.searchbot.xml (not overly sure what the xml file does). and inside that query somewhere i would have that url ('index.php?option=com_newsfeeds@task=view@feedid=') with the ('index.php?option=com_eportfolio@task=view@feedid=')...something to that effect, making sure the eportfolio.searchbot.php is querying the correct database fields. then I guess I just make sure that file is there and publish that mambot and I am good to go for searching eportfolios...
or at least this is what I am thinking, thank you again for your prompt and courteous responses.
mambots: eportfolio.searchbot.php, eportfolio.searchbot.xml (not overly sure what the xml file does). and inside that query somewhere i would have that url ('index.php?option=com_newsfeeds@task=view@feedid=') with the ('index.php?option=com_eportfolio@task=view@feedid=')...something to that effect, making sure the eportfolio.searchbot.php is querying the correct database fields. then I guess I just make sure that file is there and publish that mambot and I am good to go for searching eportfolios...
or at least this is what I am thinking, thank you again for your prompt and courteous responses.
Re: editing com_search to find more from other components
Is there an eportfolio component? If so, does it have a task labeled view? Or include a feed id ?
http://springhillalumni.org • Springhill High School Alumni Association
Re: editing com_search to find more from other components
There is an eportfolio component, since im helping a friend with his joomla based site I am not sure where it came from...so I cannot say if it has a feed id? or a task labeled view....this could hold true for that seyret video component too from:
http://www.joomlaholic.com/
http://www.joomlaholic.com/
Re: editing com_search to find more from other components
In the portfolio component, how does it display a portfolio? That is the type of link you would supply there.
The same concept would work for the seyret component.
The same concept would work for the seyret component.
http://springhillalumni.org • Springhill High School Alumni Association
Re: editing com_search to find more from other components
ahhh okay i see, is that defined by what files are in a component? i.e. its a labeled view if there is a component_name.html file in the component folder?
etc.. ? or is that defined what kind of view it is (feed id, labled view, other) in some other manner?
etc.. ? or is that defined what kind of view it is (feed id, labled view, other) in some other manner?
Re: editing com_search to find more from other components
I'm not sure. I have not coded much (read any) for the 1.0.x series. I'm also just beginning to code php for the one component I'm working on.
What I would do at the moment, and I'm sure there are other ways to do this, would be to view a few of the portfolios. Check the link provided to get to each portfolio and note the differences. Hopefully, the id of the portfolio is the difference. You could then use the common aspects of the link in your search SQL CONCAT statement.
Figuring out which fields to include in your search may require a bit more fiddling with the component and its' associated tables.
What I would do at the moment, and I'm sure there are other ways to do this, would be to view a few of the portfolios. Check the link provided to get to each portfolio and note the differences. Hopefully, the id of the portfolio is the difference. You could then use the common aspects of the link in your search SQL CONCAT statement.
Figuring out which fields to include in your search may require a bit more fiddling with the component and its' associated tables.
http://springhillalumni.org • Springhill High School Alumni Association
Re: editing com_search to find more from other components
I am comfy with the database stuff, but the link stuff is whats throwing me off, what is its purpose? is that a like "returned link" so to speak that is processed by something else in order to provide the results of a search?
thanks again for all the help really its really helping.
thanks again for all the help really its really helping.
Re: editing com_search to find more from other components
When you do a search, that link "stuff" is what will be shown on the search results page. It will need to go to a valid page or the users of the site won't find it very useful.
http://springhillalumni.org • Springhill High School Alumni Association
Re: editing com_search to find more from other components
okay it just made sense, that link is partially whats returned from the database, i.e. if you search for a news blurb that has the word "firefox" in it, and there are three articles with that word, then it will return in the link the proper id's and what not to display the articles (or the links in the page that list the articles).