Hi Jakob, sorry I didn't jump on this sooner -- I was just reminded to
do so.
I think your solution is really simple.
On 11/23/2012 03:41 PM, Jakob Fix wrote:
> [second attempt]
>
> Hi,
>
> For search:suggest I want to search titles and subtitles elements and
> return their complete contents as suggestions (not just a matching
> word):
>
> <default-suggestion-source>
> <word>
> <field name="suggest-titles"/>
> </word>
> </default-suggestion-source>
Here you're getting back words beecause it's a <word> constraint.
>
> With the above I get results from both elements, but only matching
> words (not the complete titles).
>
> The other approach using the recommended <range> element:
>
> <default-suggestion-source>
> <range type="xs:string">
> <element ns="" name="title"/><!-- impossible to have more than
> one element -->
> </range>
> </default-suggestion-source>
Here you're getting values from one element because there's only one
specified.
What you want is a -- wait for it -- field range index!
<default-suggestion-source>
<range type="xs:string">
<field name="suggest-titles"/>
</range>
</default-suggestion-source>
You'll need to set up the field range index (introduced in MarkLogic 5)
but it looks like that should work for you.
Charles
>
> returns complete titles, but I can't apparently have more than one
> element (title and subtitle). The range index correctly contains both
> elements.
>
> ----
>
> Still for search:suggest: another, related question: Let's say I
> wanted to search both titles and subtitles, and if a search term
> occurs in either of them, return them both inside a wrapper element,
> in order to display them in a rich-text drop-down menu underneath the
> type-ahead search box. Is that still possible with search:suggest, or
> do we have to use search:search, and if so will performance become an
> issue?
>
> The database itself is rather small (about 40K documents).
>
>
> Thanks,
> Jakob.
> _______________________________________________
> General mailing list
> [email protected]
> http://developer.marklogic.com/mailman/listinfo/general
--
Charles Greer
Senior Engineer
MarkLogic Corporation
[email protected]
Phone: +1 707 408 3277
www.marklogic.com
This e-mail and any accompanying attachments are confidential. The information
is intended solely for the use of the individual to whom it is addressed. Any
review, disclosure, copying, distribution, or use of this e-mail communication
by others is strictly prohibited. If you are not the intended recipient, please
notify us immediately by returning this message to the sender and delete all
copies. Thank you for your cooperation.
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general