Thanks Coleen, it does explain the behavior...it completes on the second
term, B, and simply returns the first term, Criminal, as entered.
However, I thought this behavior would be the result of sending a
sequence of strings as the first parameter to search:suggest (the 2nd
and 3rd examples given under search:suggest) and not of sending a single
string with spaces in it.
Would you please consider replying with a bare-bones example on how to
quote the string to signal it as a single term to the parser, as you
explained?
[I attempted this with the use of a paired constraint and
suggestion-source, as in the last example under search:suggest), with
the addition of a term-option element under constraint (see the options
snippet I used immediately below), but that is not giving me the desired
behavior of getting completions for "Criminal B" (and not just for "B").
I must be approaching the concept of signalling the string as a single
term to the parser in the wrong way (search:parse perhaps?).
<constraint name="tag">
<range type="xs:string">
<element ns="http://apa.org/pimain"
name="ClassificationDescription"/>
</range>
<term>
<term-option>whitespace-insensitive</term-option>
</term>
</constraint>
<suggestion-source name="tag">
<range type="xs:string">
<element ns="http://apa.org/pimain"
name="ClassificationDescription"/>
</range>
</suggestion-source>]
Thanks again!
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of
[email protected]
Sent: Tuesday, July 27, 2010 3:00 PM
To: [email protected]
Subject: General Digest, Vol 73, Issue 62
Send General mailing list submissions to
[email protected]
To subscribe or unsubscribe via the World Wide Web, visit
http://developer.marklogic.com/mailman/listinfo/general
or, via email, send a message with subject or body 'help' to
[email protected]
You can reach the person managing the list at
[email protected]
When replying, please edit your Subject line so it is more specific
than "Re: Contents of General digest..."
Today's Topics:
1. search:suggest and apparent space problems (Fernandes, Nivaldo)
2. Re: search:suggest and apparent space problems (Colleen Whitney)
----------------------------------------------------------------------
Message: 1
Date: Mon, 26 Jul 2010 21:52:28 -0400
From: "Fernandes, Nivaldo" <[email protected]>
Subject: [MarkLogic Dev General] search:suggest and apparent space
problems
To: <[email protected]>
Message-ID:
<[email protected]>
Content-Type: text/plain; charset="us-ascii"
Hi,
I have been experiencing this problem reported here:
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
http://developer.marklogic.com/pipermail/general/attachments/20100726/a6
17f3f9/attachment-0001.html
------------------------------
Message: 2
Date: Mon, 26 Jul 2010 19:51:40 -0700
From: Colleen Whitney <[email protected]>
Subject: Re: [MarkLogic Dev General] search:suggest and apparent space
problems
To: General Mark Logic Developer Discussion
<[email protected]>
Message-ID: <[email protected]>
Content-Type: text/plain; charset="utf-8"
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>h
ttp://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
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
http://developer.marklogic.com/pipermail/general/attachments/20100726/47
8f8a67/attachment-0001.html
------------------------------
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general
End of General Digest, Vol 73, Issue 62
***************************************
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general