Webmastersite.net
Register Log In

How to search based on True/False value
Custom searching with a custom boolean

Comments on How to search based on True/False value

LinksGuy
Beginner

Usergroup: Customer
Joined: Apr 08, 2006

Total Topics: 2
Total Comments: 5
Posted Apr 08, 2006 - 2:08 PM:

I've created a custom boolean field entitled "Editor's Pick"

I want to create a search button which will cause only sites whose Editor's Pick value = true to be displayed (these would be sites within the currently displayed category).

I've read how to create custom searches, but there's no reference on how to reference boolean and true-false values.

Any help would be appreciated.
Paul
developer

Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California

Total Topics: 61
Total Comments: 7868
Paul
Posted Apr 09, 2006 - 2:06 AM:

Set the value to 1 for yes and 0 for no.
LinksGuy
Beginner

Usergroup: Customer
Joined: Apr 08, 2006

Total Topics: 2
Total Comments: 5
Posted Apr 09, 2006 - 10:06 AM:

With another look I realize that I can't create a boolean input type, but can use the Integer field type along with a checkbox.

However, coding it like this still doesn't work and always displays the Advanced Search page rather than any search results.

directory.com/search.php?fi...ks&incat=5&editorschoice=1


All I want to do is display only links in category 5 whose EditorsChoice=1.


By the way, using the Advanced Search page to search for the EditorsChoice=1 (using a form checkbox) does not work either. It simply brings me back to the same Advanced Search page.
Paul
developer

Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California

Total Topics: 61
Total Comments: 7868
Paul
Posted Apr 10, 2006 - 12:56 AM:

Please take the time to read the manual instead of inventing your own way of passing search values: scripts.webmastersite.net/w...nks/wsnmanual/articles/246

By the way, using the Advanced Search page to search for the EditorsChoice=1 (using a form checkbox) does not work either.

Do not invent your own way of specifying fields in the form either, use what all the other standard fields use.
LinksGuy
Beginner

Usergroup: Customer
Joined: Apr 08, 2006

Total Topics: 2
Total Comments: 5
Posted Apr 10, 2006 - 6:46 AM:

The documentation for this is vague and unclear.
To search only in a particular field, use a url like 
search.php?action=filter&filled=1&whichtype=categories&namesearch=test&namecondition==

For any sort of search, the process to construct a url for it is just to examine the form being submitted in the template and add the values that you would want to be getting submitted into the URL. Examine the names given to the selectors in the advanced search template and transfer them to the url.


Going by that, I come up with this

search.php?action=filter&filled=1&whichtype=links&namesearch=editorschoice&namecondition==1

I'm very confused with this. Where do i specify the category id?

All I need is to show EditorsChoice=1 in Category 5.
Paul
developer

Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California

Total Topics: 61
Total Comments: 7868
Paul
Posted Apr 11, 2006 - 8:30 AM:

I believe catid=5 works as a shortcut, but going by the instructions it'd be catidcondition==&catidsearch=5
LinksGuy
Beginner

Usergroup: Customer
Joined: Apr 08, 2006

Total Topics: 2
Total Comments: 5
Posted Apr 11, 2006 - 1:19 PM:

I appreciate your prompt response, but your answers are bits-and-pieces which aren't giving me the full picture of the issue. I cannot tell from the documentation or your examples what is meant to be an actual value to be passed in a URL and what is meant to be a variable placeholder used for the example.

Based on what I've gotten from you and the vague documentation on clickable search results I've come up with this...

search.php?action=filter&filled=1&whichtype=links&namesearch=editorschoice&namecondition==1&catidcondition==&catidsearch=5

However, from the resultset, it's clear that the EditorsChoice field has no effect.

Would you please tell me what the correct syntax for the full line would be?

Thanks so much
Paul
developer

Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California

Total Topics: 61
Total Comments: 7868
Paul
Posted Apr 12, 2006 - 7:47 AM:

The template goes on like this:
Find all links where 
<br>the title <select name="titlecondition">
<option value="like">contains</option>
<option value="=">is exactly</option>
<option value="!=">is not</option>
<option value="or">has any of the words</option>
<option value="and">has all of the words</option>
<option value="bool">boolean</option>
</select>
<input type="text" size="{STANDARDSIZE}" name="titlesearch">
<br>and the description <select name="descriptioncondition">
<option value="like">contains</option>
<option value="=">is exactly</option>
<option value="!=">is not</option>
<option value="or">has any of the words</option>
<option value="and">has all of the words</option>
<option value="bool">boolean</option>
</select>
<input type="text" size="{STANDARDSIZE}" name="descriptionsearch">
<br>and the URL <select name="urlcondition">
<option value="like">contains</option>
<option value="=">is exactly</option>
<option value="!=">is not</option>
<option value="or">has any of the values</option>
<option value="and">has all of the values</option>
<option value="bool">boolean</option>
</select>
et cetera...


Have a look at the fields it's posting to the form. When someone types that they want to search for a title, they're typing in an input box named "titlesearch". When they set the condition they're doing it in a selector named "titlecondition". When they search for a description, they type in "descriptionsearch" and set the condition in "descriptioncondition". What does this tell you about where they would be typing for a field named "editorschoice"? You can conclude that "editorschoicesearch" fits the pattern.

Now transfer it into the url instead of writing it in the form.
Search thread for
Download thread as
  • 0/5
  • 1
  • 2
  • 3
  • 4
  • 5



This thread is closed, so you cannot post a reply.