Nivaldo,

The search:suggest call uses the same parser as the rest of the API. To the 
parser, your query is indeed treated as two separate terms unless you quote it 
to signal that it should be treated as a single term.  The completion is being 
done only on the second term.

Does this explain the behavior?

--Colleen

On Jul 26, 2010, at 6:52 PM, "Fernandes, Nivaldo" 
<[email protected]<mailto:[email protected]>> wrote:

Hi,

I have been experiencing this problem reported here:
<http://developer.marklogic.com/pipermail/general/2010-May/005436.html>http://developer.marklogic.com/pipermail/general/2010-May/005436.html
I did not see any responses to this and perhaps the solution is obvious but it 
has not occurred to me.

Here is my query:
>>> BEGIN QUERY
xquery version "1.0-ml";
import module namespace search = "http://marklogic.com/appservices/search";
    at "/MarkLogic/appservices/search/search.xqy";

let $input :=  "Criminal"

let $options :=
<search:options xmlns="http://marklogic.com/appservices/search";>
 <default-suggestion-source>
  <range type="xs:string">
    <element ns="http://apa.org/pimain"; name="ClassificationDescription"/>
  </range>
</default-suggestion-source>
</search:options>

let $results := search:suggest($input, $options)

return $results
>>> END QUERY

This returns:
"Criminal Behavior & Juvenile Delinquency"
"Criminal Law & Adjudication"
"Criminal Rehabilitation & Penology"

So, I go ahead and set my input as:
let $input := “Criminal B”

And here is what is returned:
Criminal "Behavior Disorders & Antisocial Behavior"
Criminal "Behavior Therapy & Behavior Modification"
Criminal "Behavioral & Psychological Treatment of Physical Illness"

Please note 2 things with the new results:
1) “Criminal Behavior $ Juvenile Delinquency” is no longer part of the 
suggestions;
2) All suggestions returned seem to be a composite of “Criminal” and “B…” (e.g. 
“Behavior Therapy & Behavior Modification” is actually a separate entry in 
itself, that has nothing to do with the word Criminal). It is as if the space 
between “Criminal” and “B” in the $input are being taken as multiple search 
terms although I was under the impression that this should be matching as a 
whole string against the value lexicon in ClassificationDescription.

I am sure the solution is simple but I cannot see it at the moment. Help is 
appreciated.

Thanks!
Nivaldo Fernandes

_______________________________________________
General mailing list
[email protected]<mailto:[email protected]>
http://developer.marklogic.com/mailman/listinfo/general
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to