4
votes

I am going by Marklogic Tutorial for Oscars to develop an application for my documents that I have ingested in the database. What I am not able to understand is that though the Search box performs autocomplete, but it doesnot do that for elements..i.e if I type Cha...then it should start suggesting all names starting with Cha..sucha as Charles, Charley etc.Sample Oscars Application

As shown in figure: I can write Decade(which will get autocompleted..) and select one among 1920s..1930s..etc. But I dont want to specify Field name as such.I just want to type actor name and it should provide auto suggest on that...

I have looked for it in the documentation where it says that search:suggest function can do this; but I am new to xquery etc and dont know how to proceed...

Do I need to modify this function or add something to it?How?

1

1 Answers

3
votes

If you enter a full-text search term, then autocomplete works on words and phrases from the full-text index. If you prepend a search field keyword, then the autocomplete limits to that.

I don't know the search field keywords by name, but I'd guess they are award:, decade: and winners:. So, if you type in decade:, then autocomplete should come up with decades only.

--edit--

Based on your comment, it sounds you want to change the source for autocomplete if you don't specify a specific search field. That is very easy. If you start the wizard to create an Oscar Example application, that option is on the first screen. You can also revisit that same wizard from the Application Builder after creation to apply changes.

Just open that wizard, go to the Search step, and look for a button 'Advanced Settings'. In the middle of the overlay screen there should be a caption called 'Suggestions', and below a drop-down to specify the Default Source, which is the source for autocompletion when you don't prefix your search term. Change that to 'name' if you want unprefixed terms to autocomplete against actor names..

HTH!