close ad
Install the LAtest Updates to Work with CC 2017 and CC 2018
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

DataAssist -> Search -> Refine results

Thread began 12/19/2009 2:42 pm by elizabeth130596 | Last modified 12/21/2009 3:31 pm by Eric Mittman | 1182 views | 3 replies |

elizabeth130596

DataAssist -> Search -> Refine results

Hi - I have a site where we will be searching on members' credentials.
We are searching First upon their Interests,
Second upon Age groups treated,
Third upon their geographic location.

I am hoping that this feature, using the Search asisstn wizard from within Data Assist, will help me achieve this.

However, the search seems to only work to filter one criterion, the first one.
If a keyword exists within the first field Interests, but the following two conditions are not true, it will still return the results as long as the first result is true.

Search terms are taken from a drop down list and if they are included in the field being searched, the result gets returned. There are manytext words within the field being searched, so it is OK to return a lot of results.

Each search term uses the drop down list, and if that term is contained within the field being searched we want the result.

However, we are getting results when one or two conditions are true, not all three. That's bad.

Say I want a doctor who treats depression in children in syracuse new york, I do not want to see the doctors in New York city, yet that is what I get.

In the data assist search screen I am using Filter on Keyword, included in field and the AND connector for the other two criteria.

How can I refine my searches so that all conditions are true, only returning those results, and giving an Empty results reply when the results are false?

AND, if that doesn't work, how can I apply a second search behavior on a results page?

thanks. URLS are:

SEARCH PAGE:
search_by_INTERESTS.php

RESULTS PAGE:
results_..._interests.php


elizabeth

Sign in to reply to this post

Eric Mittman

Using the AND separators within the DataAssist Search server behavior should account for exactly this type of situation.

When I try the search like you mention in your post I see what looks like a single record returned. Perhaps you are working on this and results are varying based on some things you are trying.

The best way to troubleshoot why the search may not be returning records that it should is to print out the query that is used. This will give you a good idea about what is actually going on in the query and may hold the answer as to why you are getting these results. You can print out the query that is being executed by looking for the line that starts out like this:

php:
$query_limit_



You will put in a new line just after this line and add a die statement with this full variable referenced in it. The full name of this variable will depend on the table you are searching but the line you should add will look something like this:

php:
die($query_limit_WADA<table name>);



When you add this to the results page it will print the query to the screen. If you cannot determine why the query is returning the results or is setup like you see it post back with the query and some more details about the search criteria you have crafted in the DataAssist Search server behavior.

Sign in to reply to this post

elizabeth130596

Hi Eric, Actually, the search behavior is returning too MANY results. (Plus, at this point we only have 2 dummy records) What is happening is that when a person searches for a doctor who treats, say Anxiety, in Adults... the Search Assist returns doctors who treat anxiety (good) in children (bad). But even that is enough to have a not-specific result set returns. Code block for DataSearch is below.
1st param = Interests
2nd param = ages served

we want BOTH to be true in order to be included, not just one.

-------

<?php
//WA Database Search (Copyright 2005, WebAssist.com)
//Recordset: rsPractice1;
//Searchpage: ;
//Form: ;
$WADbSearch1_DefaultWhere = "SELECT * FROM Vmempublic";
if (!session_id()) session_start();
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$WADbSearch1 = new FilterDef;
$WADbSearch1->initializeQueryBuilder("MYSQL","1");
//keyword array declarations
$KeyArr1 = array("INTERESTS");
$KeyArr2 = array("ages_served");

//comparison list additions
$WADbSearch1->keywordComparison($KeyArr1,"".((isset($_POST["INTERESTS"]))?$_POST["INTERESTS"]:"") ."","AND","Includes","%20AND%20","%20OR%20","%22","%22",0);
$WADbSearch1->keywordComparison($KeyArr2,"".((isset($_POST["ages_served"]))?$_POST["ages_served"]:"") ."","AND","Includes",",%20","%20","%22","%22",0);

//save the query in a session variable
if (1 == 1) {
$_SESSION["WADbSearch1_search_matrix_v3_INT"]=$WADbSearch1->whereClause;
}
}
else {
$WADbSearch1 = new FilterDef;
$WADbSearch1->initializeQueryBuilder("MYSQL","1");
//get the filter definition from a session variable
if (1 == 1) {
if (isset($_SESSION["WADbSearch1_search_matrix_v3_INT"]) && $_SESSION["WADbSearch1_search_matrix_v3_INT"] != "") {
$WADbSearch1->whereClause = $_SESSION["WADbSearch1_search_matrix_v3_INT"];
}
else {
$WADbSearch1->whereClause = $WADbSearch1_DefaultWhere;
}
}
else {
$WADbSearch1->whereClause = $WADbSearch1_DefaultWhere;
}
}
$WADbSearch1->whereClause = str_replace("\\''", "''", $WADbSearch1->whereClause);
$WADbSearch1whereClause = '';
?>

Sign in to reply to this post

Eric Mittman

It seems that you have both of these set with the AND correctly. It may be your includes part of the search, it looks like you are using keyword type searches with 'includes' for the content. That means that if any of the values you are looking for are even partially present in the record it will be returned.

If you are getting the values from some dynamic select lists on the page then you should use text searches with exact matches. This should eliminate any extra results that are occurring because they contain partial matches.

If you continue to have troubles with this please try using the die statement for the query so that the query that is being used can be seen and investigated to determine what is going on.

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...