Welcome Guest, Not a member yet? Register   Sign In
Search results - good query and URI
#1

[eluser]someone Smile[/eluser]
Hello,
I'm working on some script and I would like to create search. My project is based on CodeIgniter and my desire is to have all code content compatibile with it.

So, I have already working on the query for searching but it's not good because it doesn't support more words than one. So if I enter word "test" in my search form (assume that the test word is in database in one of fields) there will be few results, but if I enter words "test test test" (again assume that the test words are in database in one of fields) there will be no any result.

My previous query:

Code:
$this->db->select('title, content, date, hyperlink')->or_like(array('title' => $query, 'content' => $query))->order_by('id_article', 'desc')->get('news');

And after some tweaks:

Code:
$this->db->select('title, content, date, hyperlink');
foreach ($parts as $q)
{
    $this->db->or_like(array('title' => $q, 'content' => $q));
}
$this->order_by('id_article', 'desc')
$show_results = $this->db->get('news');

The next problem is with URI because if I search for "some article, today is sunny" there is problem with comma and in other cases probably with other disallowed characters too. I have read few other question there, but all that I found is
Code:
$this->uri->uri_to_assoc()
, which I think in my case wouldn't work, because I don't use English in my project. In some other topic on this forum it was said, the best way for search URIs is to disable nice URIs and have GET type of URIs.

What's the best solution for these two problems?

Thanks a lot! :-)
#2

[eluser]someone Smile[/eluser]
Anyone?

Thanks! :-)




Theme © iAndrew 2016 - Forum software by © MyBB