This forum is in READ-ONLY mode.
You can look around, but if you want to ask a new question, please use Stack Overflow.

Search filter

Questions relating to sfLucenePlugin, sfSearch etc

Search filter

by wigglesby85 » Mon Jun 15, 2009 3:38 pm

Hi

I have a page called listResultsSuccess.php which displays a list of data that is pulled from a db.

Some of them have a field called 'type' and what I'm looking to do, is to keep the existing default list of all of the data but then create a search filter.

So from a select list, have the types in a list and if 'type1' is picked, the page will then display all of the items in the db that has a type of type1.

Is this possible?

Thanks
wigglesby85
Senior Member
 
Posts: 150
Joined: Fri May 15, 2009 1:22 pm

Re: Search filter

by wigglesby85 » Mon Jun 15, 2009 4:53 pm

Anyone?

Even if it's a link to an example would be good :)~ :-)~ :smile:
wigglesby85
Senior Member
 
Posts: 150
Joined: Fri May 15, 2009 1:22 pm

Re: Search filter

by halfer » Fri Jun 19, 2009 12:25 pm

Sure, that should be quite easy. You could always have your 'type' filter on-screen (as an ordinary drop-down list) and set the first option to "No filter" or "All rows". The other options would be the types you wish to filter on.

Then all you need do is link this into your database. Assuming you're using Propel, this would be a case of modifying your Criteria object before generating your list (or sfPropelPager object).
halfer
Faithful Member
 
Posts: 10148
Joined: Mon Jan 30, 2006 1:16 pm
Location: West Midlands, UK

Re: Search filter

by srozie » Sat Nov 21, 2009 6:08 pm

Hello,

I am implementing search according to the steps described in Jobeet - search 17th chapter.

Now for example if I write a word in the textbox, then it looks for this word, and retrieves all the data that contains this word, but what I want is to retrieve only the exact word.

for example:
I have two fields in the table: 1) word 2) description

now if I write 'computer' in the textbox, it should look for the exact word 'computer' in the word field and retrieve its description.

Can you please help me with this??

I also modified this method:

static public function getForLuceneQuery($query)
{
$hits = self::getLuceneIndex()->find($query);

$pks = array();
foreach ($hits as $hit)
{
$pks[] = $hit->pk;
}

$criteria = new Criteria();
$criteria->add(self::ID, $pks, Criteria::IN);
$criteria->setLimit(20);

return self::doSelect($criteria);
}

and deleted the Criteria::IN so that it would take its default criteria EQUAL, but then it brings no result at all.

thanks.
srozie
Junior Member
 
Posts: 25
Joined: Sun Jul 26, 2009 5:57 pm

Re: Search filter

by srozie » Sun Nov 22, 2009 7:56 pm

anybody has a solution???? please let me know! :(~ :-(~ :sad:
srozie
Junior Member
 
Posts: 25
Joined: Sun Jul 26, 2009 5:57 pm