Hi, these days I need to implement the rest services for getting suggestion results for link autosuggestion. In my design, I think the suggestion results should be filtered and ranked by the following conditions. (for example user types "[[mytest" in page "xwiki:main.newpage") First [[ is triggered, when user keep typing, the page and attachment suggestion results should be filtered and ranked by the following rules: 1. Prefix matched (only for page name and attachment name) - The pages which are in the same wiki and space of the document current edited.( Prior A) - The pages which are in the same wiki but different space of the document current edited;(Prior B) - The pages which are in different wiki and different space of the document current edited; (Prior C); 2. Partial matched (only for page name and attachment name) - The pages which are in the same wiki and space of the document current edited.( Prior C) - The pages which are in the same wiki but different space of the document current edited;(Prior D) - The pages which are in different wiki and different space of the document current edited; (Prior E) 3. If no page and attachment matches the above two rules, the suggestion box will be disappeared.(eclipse way)
However, sometimes user might insert the space name too, for example, user will type "[[Main", following the rule 1 and rule 2, the pages begins with "Main" will be first retrieved as the suggestion results untill user types "." after "Main", the suggestion result will be retreved from the pages under the space "Main" only. Filters still obey the above three rules. And also when user types "attach:", the suggestion result will be retrieved the attachments only following the above three rules. And if the link is under the attachment context, when "@" is typed, the attachments only will be retrieved following the above three rules. In order to do this, I investigated the rest services already existed( http://platform.xwiki.org/xwiki/bin/view/Features/XWikiRESTfulAPI), but I found none is perfect suitable for my needs. So I talk with Marius, he suggested me to use the existed services which are closed to my needs first, and then write the perfect one later. However, I only found the rest service:/wikis/{wiki}/search is the most closed one for the pages suggestion to my needs, there is no attachment search rest service for attachment suggestion, Marius adviced me to use " http://localhost:8080/xwiki/bin/get/XWiki/SuggestLuceneService?outputSyntax=plain&query=name:__INPUT__*%20AND%20type:attachment&nb={number}&input={query}" instead, but I found the search result is in xml format(not json), and also the information of the results got from SuggestLuceneService is limit. I have read the document of how to write custom rest service, but the information is limit, any one can guide me to run an helloworld? -- Best wishes, 许凌志(Jame Xu) MOE KLINNS Lab and SKLMS Lab, Xi'an Jiaotong University Department of Computer Science and Technology, Xi’an Jiaotong University _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs

